From: Ian Darwin Date: Wed, 23 Jan 1991 13:56:27 +0000 (+0000) Subject: Delint. X-Git-Tag: FILE3_27~297 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4a3b97be9b45715fd895d6bc4908a75f36cab40d;p=file Delint. --- diff --git a/src/ascmagic.c b/src/ascmagic.c index 2d9e987c..4b2e2cbd 100644 --- a/src/ascmagic.c +++ b/src/ascmagic.c @@ -33,7 +33,7 @@ #ifndef lint static char *moduleid = - "@(#)$Header: /home/glen/git/file/cvs/file/src/ascmagic.c,v 1.6 1991/01/23 13:22:06 ian Exp $"; + "@(#)$Header: /home/glen/git/file/cvs/file/src/ascmagic.c,v 1.7 1991/01/23 13:56:27 ian Exp $"; #endif /* lint */ char *ckfmsg = "write error on output"; @@ -42,13 +42,13 @@ char *ckfmsg = "write error on output"; #define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) ascmagic(buf, nbytes) -register char *buf; +unsigned char *buf; int nbytes; /* size actually read */ { - int i, isblock, is_tar(), is_compress(); - char *s, *strtok(), *token; + int i, isblock, is_tar(), is_compress(), has_escapes = 0; + unsigned char *s; + char *strtok(), *token; register struct names *p; - short has_escapes = 0; extern int zflag; /* these are easy, do them first */ @@ -59,12 +59,12 @@ int nbytes; /* size actually read */ * and other trash from real troff input. */ if (*buf == '.') { - char *p = buf + 1; + unsigned char *tp = buf + 1; - while (isascii(*p) && isspace(*p)) - ++p; /* skip leading whitespace */ - if ((isascii(*p) && (isalnum(*p) || *p=='\\') && - isascii(*(p+1)) && (isalnum(*(p+1)) || *p=='"'))) { + while (isascii(*tp) && isspace(*tp)) + ++tp; /* skip leading whitespace */ + if ((isascii(*tp) && (isalnum(*tp) || *tp=='\\') && + isascii(*(tp+1)) && (isalnum(*(tp+1)) || *tp=='"'))) { ckfputs("troff or preprocessor input text", stdout); return 1; } @@ -98,13 +98,13 @@ int nbytes; /* size actually read */ if (i = is_compress(buf, &isblock)) { if (zflag) { - char *newbuf; + unsigned char *newbuf; int newsize; newsize = uncompress(buf, nbytes, &newbuf); try(newbuf, newsize); /* free(newbuf) */ - printf("(%scompressed data - %d bits)", + printf(" (%scompressed data - %d bits)", isblock ? "block " : "", i); } else printf("%scompressed data - %d bits", diff --git a/src/compress.c b/src/compress.c index 38670146..0b922097 100644 --- a/src/compress.c +++ b/src/compress.c @@ -11,7 +11,7 @@ */ int is_compress(p, b) -char *p; +unsigned char *p; int *b; { diff --git a/src/file.c b/src/file.c index 4437a47c..d1d970f6 100644 --- a/src/file.c +++ b/src/file.c @@ -34,7 +34,7 @@ #ifndef lint static char *moduleid = - "@(#)$Header: /home/glen/git/file/cvs/file/src/file.c,v 1.17 1991/01/23 13:23:23 ian Exp $"; + "@(#)$Header: /home/glen/git/file/cvs/file/src/file.c,v 1.18 1991/01/23 13:56:37 ian Exp $"; #endif /* lint */ extern char *ckfmsg; @@ -123,7 +123,7 @@ char *argv[]; for (; optind < argc; optind++) process(argv[optind], 1); - exit(0); + return 0; } /* @@ -132,7 +132,7 @@ char *argv[]; unwrap(fn) char *fn; { -#define FILENAMELEN 128 +#define FILENAMELEN 1024 char buf[FILENAMELEN]; FILE *f; @@ -151,12 +151,13 @@ char *fn; /* * process - process input file */ +/*ARGSUSED1*/ /* why is top no longer used? */ process(inname, top) char *inname; int top; /* true if called from top level */ { int fd; - char buf[HOWMANY]; + unsigned char buf[HOWMANY]; struct utimbuf utbuf; if (strcmp("-", inname) == 0) { @@ -185,7 +186,7 @@ readit: /* * try looking at the first HOWMANY bytes */ - if ((nbytes = read(fd, buf, HOWMANY)) == -1) + if ((nbytes = read(fd, (char *)buf, HOWMANY)) == -1) warning("read failed"); if (nbytes == 0) { ckfputs("empty", stdout); @@ -205,16 +206,16 @@ readit: (void) putchar('\n'); } -try(buf, nbytes) -char *buf; -int nbytes; +try(buf, nb) +unsigned char *buf; +int nb; { /* * try tests in /etc/magic (or surrogate magic file) */ - if (softmagic(buf, nbytes) == 1) + if (softmagic(buf, nb) == 1) /*NULLBODY*/; - else if (ascmagic(buf, nbytes) == 1) + else if (ascmagic(buf, nb) == 1) /* * try known keywords, check for ascii-ness too. */ diff --git a/src/fsmagic.c b/src/fsmagic.c index c95a5c69..411585df 100644 --- a/src/fsmagic.c +++ b/src/fsmagic.c @@ -42,7 +42,7 @@ #ifndef lint static char *moduleid = - "@(#)$Header: /home/glen/git/file/cvs/file/src/fsmagic.c,v 1.11 1991/01/23 12:12:20 ian Exp $"; + "@(#)$Header: /home/glen/git/file/cvs/file/src/fsmagic.c,v 1.12 1991/01/23 13:56:40 ian Exp $"; #endif /* lint */ extern char *progname; @@ -110,7 +110,8 @@ char *fn; buf[nch] = '\0'; /* readlink(2) forgets this */ /* If dangling symlink, say so and quit early. */ - if (stat(buf, tstatbuf) < 0) { +/*###113 [lint] stat arg. 2 used inconsistently llib-lc(661) :: fsmagic.c(113)%%%*/ + if (stat(buf, &tstatbuf) < 0) { ckfputs("dangling symbolic link", stdout); return 1; } diff --git a/src/is_tar.c b/src/is_tar.c index e0c32d7f..4aeb6d71 100644 --- a/src/is_tar.c +++ b/src/is_tar.c @@ -25,9 +25,10 @@ long from_oct(); /* Decode octal number */ * 2 for Unix Std (POSIX) tar file. */ int -is_tar(header) - register union record *header; +is_tar(buf) +unsigned char *buf; { + register union record *header = (union record *)buf; register int i; register long sum, recsum; register char *p; diff --git a/src/softmagic.c b/src/softmagic.c index 531c469b..ee346646 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -30,7 +30,7 @@ #ifndef lint static char *moduleid = - "@(#)$Header: /home/glen/git/file/cvs/file/src/softmagic.c,v 1.8 1990/10/03 17:53:10 ian Exp $"; + "@(#)$Header: /home/glen/git/file/cvs/file/src/softmagic.c,v 1.9 1991/01/23 13:56:45 ian Exp $"; #endif /* lint */ extern char *progname; @@ -45,8 +45,10 @@ static int magindex; * (already read from /etc/magic by apprentice.c). * Passed the name and FILE * of one file to be typed. */ -softmagic(buf) -char *buf; +/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */ +softmagic(buf, nbytes) +unsigned char *buf; +int nbytes; { magindex = 0; if (match(buf)) @@ -60,7 +62,7 @@ char *buf; * Be sure to process every continuation of this match. */ match(s) -char *s; +unsigned char *s; { while (magindex < nmagic) { /* if main entry matches, print it... */ @@ -91,7 +93,7 @@ char *s; mprint(m,s) struct magic *m; -char *s; +unsigned char *s; { register union VALUETYPE *p = (union VALUETYPE *)(s+m->offset); register long v; @@ -121,7 +123,7 @@ char *s; int mcheck(s, m) -char *s; +unsigned char *s; struct magic *m; { register union VALUETYPE *p = (union VALUETYPE *)(s+m->offset);