help.c (38918) | help.c (39599) |
---|---|
1/*- 2 * Copyright (c) 1998 Eric P. Scott <eps@sirius.com> 3 * Copyright (c) 1998 Andrzej Bialecki <abial@nask.pl> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/*- 2 * Copyright (c) 1998 Eric P. Scott <eps@sirius.com> 3 * Copyright (c) 1998 Andrzej Bialecki <abial@nask.pl> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $Id$ | 27 * $Id: help.c,v 1.2 1998/09/07 19:00:34 abial Exp $ |
28 */ 29 30 31#include <stdio.h> 32#include <string.h> 33#include <ar.h> 34#include <sys/ioctl.h> 35 --- 52 unchanged lines hidden (view full) --- 88 register int c, n, o; 89 struct ar_hdr ar; 90 char aname[20]; 91 92 if (!fgets(aname, sizeof aname, fd)) { 93 return 1; 94 } 95 if (strncmp(aname, ARMAG, SARMAG)) return 1; | 28 */ 29 30 31#include <stdio.h> 32#include <string.h> 33#include <ar.h> 34#include <sys/ioctl.h> 35 --- 52 unchanged lines hidden (view full) --- 88 register int c, n, o; 89 struct ar_hdr ar; 90 char aname[20]; 91 92 if (!fgets(aname, sizeof aname, fd)) { 93 return 1; 94 } 95 if (strncmp(aname, ARMAG, SARMAG)) return 1; |
96 (void)sprintf(aname, "%-16.16s", fname); | 96 (void)snprintf(aname, sizeof(aname), "%s/", fname); |
97 for (;;) { 98 if (fread((void *)&ar, sizeof ar, 1, fd)!=1) return 1; 99 if (strncmp(ar.ar_fmag, ARFMAG, 2)) return 1; 100 n=0; 101 p=ar.ar_size; 102 do { 103 if ((c=(int)(*p++-'0'))<0||c>9) break; 104 n*=10; n+=c; 105 } while (p<&ar.ar_size[sizeof ar.ar_size]); | 97 for (;;) { 98 if (fread((void *)&ar, sizeof ar, 1, fd)!=1) return 1; 99 if (strncmp(ar.ar_fmag, ARFMAG, 2)) return 1; 100 n=0; 101 p=ar.ar_size; 102 do { 103 if ((c=(int)(*p++-'0'))<0||c>9) break; 104 n*=10; n+=c; 105 } while (p<&ar.ar_size[sizeof ar.ar_size]); |
106 if (!strncmp(ar.ar_name, aname, 16)) break; | 106 if (!strncmp(ar.ar_name, aname, strlen(aname))) break; |
107 if (fseek(fd, (long)n, SEEK_CUR)<0) return 1; 108 if ((n&1)&&fgetc(fd)!='\n') return 1; 109 } 110 if (cnt>=crt&&more()) return -1; 111 (void)fputc('\n', stdout); 112 cnt++; 113 o=0; while (o<n&&(c=fgetc(fd))!=EOF) { 114 per: --- 17 unchanged lines hidden (view full) --- 132 cnt++; 133 o=0; 134 while (fread((void *)&ar, sizeof ar, 1, fd)==1) { 135 if (strncmp(ar.ar_fmag, ARFMAG, 2)) break; 136 if ((o%6)==0) { 137 (void)fputc('\n', stdout); 138 if (++cnt>=crt&&more()) return -1; 139 } | 107 if (fseek(fd, (long)n, SEEK_CUR)<0) return 1; 108 if ((n&1)&&fgetc(fd)!='\n') return 1; 109 } 110 if (cnt>=crt&&more()) return -1; 111 (void)fputc('\n', stdout); 112 cnt++; 113 o=0; while (o<n&&(c=fgetc(fd))!=EOF) { 114 per: --- 17 unchanged lines hidden (view full) --- 132 cnt++; 133 o=0; 134 while (fread((void *)&ar, sizeof ar, 1, fd)==1) { 135 if (strncmp(ar.ar_fmag, ARFMAG, 2)) break; 136 if ((o%6)==0) { 137 (void)fputc('\n', stdout); 138 if (++cnt>=crt&&more()) return -1; 139 } |
140 *(index(ar.ar_name,'/'))=' '; |
|
140 (void)printf("%.13s", ar.ar_name); 141 ++o; 142 n=0; 143 p=ar.ar_size; 144 do { 145 if ((c=(int)(*p++-'0'))<0||c>9) break; 146 n*=10; n+=c; 147 } while (p<&ar.ar_size[sizeof ar.ar_size]); 148 if (fseek(fd, (long)n, SEEK_CUR)<0) break; 149 if ((n&1)&&fgetc(fd)!='\n') break; 150 } 151 if (cnt>=crt&&more()) return -1; 152 (void)fputc('\n', stdout); 153 cnt++; 154 } 155 return 0; 156} | 141 (void)printf("%.13s", ar.ar_name); 142 ++o; 143 n=0; 144 p=ar.ar_size; 145 do { 146 if ((c=(int)(*p++-'0'))<0||c>9) break; 147 n*=10; n+=c; 148 } while (p<&ar.ar_size[sizeof ar.ar_size]); 149 if (fseek(fd, (long)n, SEEK_CUR)<0) break; 150 if ((n&1)&&fgetc(fd)!='\n') break; 151 } 152 if (cnt>=crt&&more()) return -1; 153 (void)fputc('\n', stdout); 154 cnt++; 155 } 156 return 0; 157} |