diff options
author | rgrimes <rgrimes@FreeBSD.org> | 1995-05-30 06:41:30 +0000 |
---|---|---|
committer | rgrimes <rgrimes@FreeBSD.org> | 1995-05-30 06:41:30 +0000 |
commit | a14d555c873398b14776ca4f2c33f9c69617afb9 (patch) | |
tree | 350f6f98843363254f9afe467ae0c92d5a9d7f43 /usr.bin/file | |
parent | f3a2b348daf9fa6063c38d2d69563f732a2f80e7 (diff) | |
download | FreeBSD-src-a14d555c873398b14776ca4f2c33f9c69617afb9.zip FreeBSD-src-a14d555c873398b14776ca4f2c33f9c69617afb9.tar.gz |
Remove trailing whitespace.
Diffstat (limited to 'usr.bin/file')
-rw-r--r-- | usr.bin/file/Makefile | 8 | ||||
-rw-r--r-- | usr.bin/file/apprentice.c | 30 | ||||
-rw-r--r-- | usr.bin/file/ascmagic.c | 8 | ||||
-rw-r--r-- | usr.bin/file/compress.c | 10 | ||||
-rw-r--r-- | usr.bin/file/file.c | 12 | ||||
-rw-r--r-- | usr.bin/file/file.h | 4 | ||||
-rw-r--r-- | usr.bin/file/fsmagic.c | 10 | ||||
-rw-r--r-- | usr.bin/file/is_tar.c | 12 | ||||
-rw-r--r-- | usr.bin/file/patchlevel.h | 20 | ||||
-rw-r--r-- | usr.bin/file/print.c | 20 | ||||
-rw-r--r-- | usr.bin/file/softmagic.c | 10 |
11 files changed, 77 insertions, 67 deletions
diff --git a/usr.bin/file/Makefile b/usr.bin/file/Makefile index 54c7483..a0b27d2 100644 --- a/usr.bin/file/Makefile +++ b/usr.bin/file/Makefile @@ -1,6 +1,6 @@ -# Makefile for file(1) cmd. +# Makefile for file(1) cmd. # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE. -# @(#)$Id: Makefile,v 1.43 1994/05/03 17:57:59 christos Exp $ +# @(#)$Id: Makefile,v 1.2 1994/09/03 19:31:14 csgr Exp $ # # This software is not subject to any license of the American Telephone # and Telegraph Company or of the Regents of the University of California. @@ -29,11 +29,11 @@ MAGICGRP= bin MAGICMODE= 444 -CFLAGS+= -DMAGIC='"$(MAGIC)"' +CFLAGS+= -DMAGIC='"$(MAGIC)"' PROG= file SRCS= file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \ - compress.c is_tar.c print.c + compress.c is_tar.c print.c MAN1= file.1 MAN5= magic.5 diff --git a/usr.bin/file/apprentice.c b/usr.bin/file/apprentice.c index e1b4f45..6cdacaa 100644 --- a/usr.bin/file/apprentice.c +++ b/usr.bin/file/apprentice.c @@ -32,8 +32,8 @@ #include "file.h" #ifndef lint -static char *moduleid = - "@(#)$Id: apprentice.c,v 1.19 1994/05/03 17:58:23 christos Exp $"; +static char *moduleid = + "@(#)$Id: apprentice.c,v 1.1.1.1 1994/09/03 19:16:22 csgr Exp $"; #endif /* lint */ #define EATAB {while (isascii((unsigned char) *l) && \ @@ -75,7 +75,7 @@ int check; /* non-zero? checking-only run. */ else exit(1); } - + /* parse it */ if (check) /* print silly verbose header for USG compat. */ (void) printf("cont\toffset\ttype\topcode\tmask\tvalue\tdesc\n"); @@ -149,8 +149,8 @@ int *ndx, check; if (nd+1 >= maxmagic){ maxmagic += 20; - if ((magic = (struct magic *) realloc(magic, - sizeof(struct magic) * + if ((magic = (struct magic *) realloc(magic, + sizeof(struct magic) * maxmagic)) == NULL) { (void) fprintf(stderr, "%s: Out of memory.\n", progname); if (check) @@ -165,7 +165,7 @@ int *ndx, check; while (*l == '>') { ++l; /* step over */ - m->cont_level++; + m->cont_level++; } if (m->cont_level != 0 && *l == '(') { @@ -210,7 +210,7 @@ int *ndx, check; } else t = l; - if (*t++ != ')') + if (*t++ != ')') magwarn("missing ')' in indirect offset"); l = t; } @@ -282,7 +282,7 @@ int *ndx, check; } else m->mask = ~0L; EATAB; - + switch (*l) { case '>': case '<': @@ -301,7 +301,7 @@ int *ndx, check; } /* FALL THROUGH */ default: - if (*l == 'x' && isascii((unsigned char)l[1]) && + if (*l == 'x' && isascii((unsigned char)l[1]) && isspace((unsigned char)l[1])) { m->reln = *l; ++l; @@ -311,12 +311,12 @@ int *ndx, check; break; } EATAB; - + if (getvalue(m, &l)) return -1; /* * TODO finish this macro and start using it! - * #define offsetcheck {if (offset > HOWMANY-1) + * #define offsetcheck {if (offset > HOWMANY-1) * magwarn("offset too big"); } */ @@ -344,9 +344,9 @@ GetDesc: return 0; } -/* - * Read a numeric value from a pointer, into the value union of a magic - * pointer, according to the magic type. Update the string pointer to point +/* + * Read a numeric value from a pointer, into the value union of a magic + * pointer, according to the magic type. Update the string pointer to point * just after the number read. Return 0 for success, non-zero for failure. */ static int @@ -517,7 +517,7 @@ int len; else { (void) fputc('\\', fp); switch (c) { - + case '\n': (void) fputc('n', fp); break; diff --git a/usr.bin/file/ascmagic.c b/usr.bin/file/ascmagic.c index 600b0ab..0edb0ca 100644 --- a/usr.bin/file/ascmagic.c +++ b/usr.bin/file/ascmagic.c @@ -35,8 +35,8 @@ #include "names.h" #ifndef lint -static char *moduleid = - "@(#)$Id: ascmagic.c,v 1.17 1994/01/21 01:25:30 christos Exp $"; +static char *moduleid = + "@(#)$Id: ascmagic.c,v 1.1.1.1 1994/09/03 19:16:22 csgr Exp $"; #endif /* lint */ /* an optimisation over plain strcmp() */ @@ -71,7 +71,7 @@ int nbytes; /* size actually read */ return 1; } } - if ((*buf == 'c' || *buf == 'C') && + if ((*buf == 'c' || *buf == 'C') && isascii(*(buf + 1)) && isspace(*(buf + 1))) { ckfputs("fortran program text", stdout); return 1; @@ -88,7 +88,7 @@ int nbytes; /* size actually read */ if (STREQ(p->name, token)) { ckfputs(types[p->type], stdout); if (has_escapes) - ckfputs(" (with escape sequences)", + ckfputs(" (with escape sequences)", stdout); return 1; } diff --git a/usr.bin/file/compress.c b/usr.bin/file/compress.c index a665306..1c0d824 100644 --- a/usr.bin/file/compress.c +++ b/usr.bin/file/compress.c @@ -2,9 +2,9 @@ * compress routines: * zmagic() - returns 0 if not recognized, uncompresses and prints * information if recognized - * uncompress(method, old, n, newch) - uncompress old into new, + * uncompress(method, old, n, newch) - uncompress old into new, * using method, return sizeof new - * $Id: compress.c,v 1.8 1994/01/21 01:38:24 christos Exp $ + * $Id: compress.c,v 1.1.1.1 1994/09/03 19:16:22 csgr Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -22,7 +22,7 @@ static struct { } compr[] = { { "\037\235", 2, { "uncompress", "-c", NULL }, 0 }, { "\037\213", 2, { "gzip", "-dq", NULL }, 1 }, - /* + /* * XXX pcat does not work, cause I don't know how to make it read stdin, * so we use gzip */ @@ -74,7 +74,7 @@ int n; int fdin[2], fdout[2]; if (pipe(fdin) == -1 || pipe(fdout) == -1) { - error("cannot create pipe (%s).\n", strerror(errno)); + error("cannot create pipe (%s).\n", strerror(errno)); /*NOTREACHED*/ } switch (fork()) { @@ -92,7 +92,7 @@ int n; (void) close(2); execvp(compr[method].argv[0], compr[method].argv); - error("could not execute `%s' (%s).\n", + error("could not execute `%s' (%s).\n", compr[method].argv[0], strerror(errno)); /*NOTREACHED*/ case -1: diff --git a/usr.bin/file/file.c b/usr.bin/file/file.c index a8acdd4..4b12a9a 100644 --- a/usr.bin/file/file.c +++ b/usr.bin/file/file.c @@ -25,8 +25,8 @@ * 4. This notice may not be removed or altered. */ #ifndef lint -static char *moduleid = - "@(#)$Id: file.c,v 1.29 1993/10/27 20:59:05 christos Exp $"; +static char *moduleid = + "@(#)$Id: file.c,v 1.1.1.1 1994/09/03 19:16:22 csgr Exp $"; #endif /* lint */ #include <stdio.h> @@ -193,7 +193,7 @@ int wid; if (strcmp("-", inname) == 0) { if (fstat(0, &sb)<0) { - error("cannot fstat `%s' (%s).\n", stdname, + error("cannot fstat `%s' (%s).\n", stdname, strerror(errno)); /*NOTREACHED*/ } @@ -201,7 +201,7 @@ int wid; } if (wid > 0) - (void) printf("%s:%*s ", inname, + (void) printf("%s:%*s ", inname, (int) (wid - strlen(inname)), ""); if (inname != stdname) { @@ -212,7 +212,7 @@ int wid; putchar('\n'); return; } - + if ((fd = open(inname, O_RDONLY)) < 0) { /* We can't open it, but we were able to stat it. */ if (sb.st_mode & 0002) ckfputs("writeable, ", stdout); @@ -232,7 +232,7 @@ int wid; /*NOTREACHED*/ } - if (nbytes == 0) + if (nbytes == 0) ckfputs("empty", stdout); else { buf[nbytes++] = '\0'; /* null-terminate it */ diff --git a/usr.bin/file/file.h b/usr.bin/file/file.h index 12d5c6f..a92c9ff 100644 --- a/usr.bin/file/file.h +++ b/usr.bin/file/file.h @@ -1,6 +1,6 @@ /* * file.h - definitions for file(1) program - * @(#)$Id: file.h,v 1.19 1994/05/03 17:58:23 christos Exp $ + * @(#)$Id: file.h,v 1.1.1.1 1994/09/03 19:16:23 csgr Exp $ * * Copyright (c) Ian F. Darwin, 1987. * Written by Ian F. Darwin. @@ -32,7 +32,7 @@ #define MAXstring 32 /* max leng of "string" types */ struct magic { - short flag; + short flag; #define INDIR 1 /* if '>(...)' appears, */ #define UNSIGNED 2 /* comparison is unsigned */ short cont_level; /* level of ">" */ diff --git a/usr.bin/file/fsmagic.c b/usr.bin/file/fsmagic.c index 684e118..5a66d31 100644 --- a/usr.bin/file/fsmagic.c +++ b/usr.bin/file/fsmagic.c @@ -38,15 +38,15 @@ /* If cc tries to compile this, read and act on it. */ /* On most systems cpp will discard it automatically */ Congratulations, you have found a portability bug. - Please grep /usr/include/sys and edit the above #include + Please grep /usr/include/sys and edit the above #include to point at the file that defines the "major" macro. #endif /*major*/ #include "file.h" #ifndef lint -static char *moduleid = - "@(#)$Id: fsmagic.c,v 1.22 1993/02/19 12:09:04 ian Exp $"; +static char *moduleid = + "@(#)$Id: fsmagic.c,v 1.1.1.1 1994/09/03 19:16:22 csgr Exp $"; #endif /* lint */ int @@ -78,7 +78,7 @@ struct stat *sb; if (sb->st_mode & S_ISUID) ckfputs("setuid ", stdout); if (sb->st_mode & S_ISGID) ckfputs("setgid ", stdout); if (sb->st_mode & S_ISVTX) ckfputs("sticky ", stdout); - + switch (sb->st_mode & S_IFMT) { case S_IFDIR: ckfputs("directory", stdout); @@ -105,7 +105,7 @@ struct stat *sb; struct stat tstatbuf; if ((nch = readlink(fn, buf, BUFSIZ-1)) <= 0) { - ckfprintf(stdout, "unreadable symlink (%s).", + ckfprintf(stdout, "unreadable symlink (%s).", strerror(errno)); return 1; } diff --git a/usr.bin/file/is_tar.c b/usr.bin/file/is_tar.c index 5b036be..fc9cce2 100644 --- a/usr.bin/file/is_tar.c +++ b/usr.bin/file/is_tar.c @@ -5,7 +5,7 @@ * Pubic Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu). * * @(#)list.c 1.18 9/23/86 Public Domain - gnu - * $Id: is_tar.c,v 1.8 1993/09/16 21:09:35 christos Exp $ + * $Id: is_tar.c,v 1.1.1.1 1994/09/03 19:16:22 csgr Exp $ * * Comments changed and some code/comments reformatted * for file command by Ian Darwin. @@ -25,8 +25,8 @@ static long from_oct(); #endif /* - * Return - * 0 if the checksum is bad (i.e., probably not a tar archive), + * Return + * 0 if the checksum is bad (i.e., probably not a tar archive), * 1 for old UNIX tar file, * 2 for Unix Std (POSIX) tar file. */ @@ -58,12 +58,12 @@ int nbytes; /* Adjust checksum to count the "chksum" field as blanks. */ for (i = sizeof(header->header.chksum); --i >= 0;) sum -= 0xFF & header->header.chksum[i]; - sum += ' '* sizeof header->header.chksum; + sum += ' '* sizeof header->header.chksum; if (sum != recsum) return 0; /* Not a tar archive */ - - if (0==strcmp(header->header.magic, TMAGIC)) + + if (0==strcmp(header->header.magic, TMAGIC)) return 2; /* Unix Standard tar archive */ return 1; /* Old fashioned tar archive */ diff --git a/usr.bin/file/patchlevel.h b/usr.bin/file/patchlevel.h index 25f01c8..b33a113 100644 --- a/usr.bin/file/patchlevel.h +++ b/usr.bin/file/patchlevel.h @@ -3,9 +3,19 @@ /* * Patchlevel file for Ian Darwin's MAGIC command. - * $Id: patchlevel.h,v 1.14 1994/05/03 17:58:23 christos Exp $ + * $Id: patchlevel.h,v 1.1.1.1 1994/09/03 19:16:23 csgr Exp $ * * $Log: patchlevel.h,v $ + * Revision 1.1.1.1 1994/09/03 19:16:23 csgr + * Bring in file 3.14 by Ian Darwin (and Christos Zoulas) + * + * The following files were moved to different names: + * - file.man -> file.1 + * - magic.man -> magic.5 + * + * The following file was removed: + * - Magdir/Makefile + * * Revision 1.14 1994/05/03 17:58:23 christos * changes from mycroft@gnu.ai.mit.edu (Charles Hannum) for unsigned * @@ -39,15 +49,15 @@ * Numerous changes from Guy Harris too numerous to mention but including * byte-order independance, fixing "old-style masking", etc. etc. A bugfix * for broken symlinks from martin@@d255s004.zfe.siemens.de. - * + * * Revision 1.7 93/01/05 14:57:27 ian * Couple of nits picked by Christos (again, thanks). - * + * * Revision 1.6 93/01/05 13:51:09 ian * Lotsa work on the Magic directory. - * + * * Revision 1.5 92/09/14 14:54:51 ian * Fix a tiny null-pointer bug in previous fix for tar archive + uncompress. - * + * */ diff --git a/usr.bin/file/print.c b/usr.bin/file/print.c index a91f429..44a079e 100644 --- a/usr.bin/file/print.c +++ b/usr.bin/file/print.c @@ -40,7 +40,7 @@ #ifndef lint static char *moduleid = - "@(#)$Id: print.c,v 1.21 1994/05/03 17:58:23 christos Exp $"; + "@(#)$Id: print.c,v 1.1.1.1 1994/09/03 19:16:22 csgr Exp $"; #endif /* lint */ #define SZOF(a) (sizeof(a) / sizeof(a[0])) @@ -59,14 +59,14 @@ struct magic *m; if (m->flag & INDIR) (void) fprintf(stderr, "(%s,%d),", - (m->in.type >= 0 && m->in.type < SZOF(typ)) ? + (m->in.type >= 0 && m->in.type < SZOF(typ)) ? typ[(unsigned char) m->in.type] : "*bad*", m->in.offset); (void) fprintf(stderr, " %s%s", (m->flag & UNSIGNED) ? "u" : "", - (m->type >= 0 && m->type < SZOF(typ)) ? - typ[(unsigned char) m->type] : + (m->type >= 0 && m->type < SZOF(typ)) ? + typ[(unsigned char) m->type] : "*bad*"); if (m->mask != ~0L) (void) fprintf(stderr, " & %.8x", m->mask); @@ -112,7 +112,7 @@ struct magic *m; * ckfprintf - fprintf, but with error checking */ void -ckfputs(str, fil) +ckfputs(str, fil) const char *str; FILE *fil; { @@ -166,9 +166,9 @@ error(va_alist) f = va_arg(va, const char *); #endif /* cuz we use stdout for most, stderr here */ - (void) fflush(stdout); + (void) fflush(stdout); - if (progname != NULL) + if (progname != NULL) (void) fprintf(stderr, "%s: ", progname); (void) vfprintf(stderr, f, va); va_end(va); @@ -193,10 +193,10 @@ magwarn(va_alist) f = va_arg(va, const char *); #endif /* cuz we use stdout for most, stderr here */ - (void) fflush(stdout); + (void) fflush(stdout); - if (progname != NULL) - (void) fprintf(stderr, "%s: %s, %d: ", + if (progname != NULL) + (void) fprintf(stderr, "%s: %s, %d: ", progname, magicfile, lineno); (void) vfprintf(stderr, f, va); va_end(va); diff --git a/usr.bin/file/softmagic.c b/usr.bin/file/softmagic.c index 8775d12..737e6d6 100644 --- a/usr.bin/file/softmagic.c +++ b/usr.bin/file/softmagic.c @@ -33,8 +33,8 @@ #include "file.h" #ifndef lint -static char *moduleid = - "@(#)$Id: softmagic.c,v 1.1.1.1 1994/09/03 19:16:22 csgr Exp $"; +static char *moduleid = + "@(#)$Id: softmagic.c,v 1.2 1995/05/24 02:54:30 ache Exp $"; #endif /* lint */ static int match __P((unsigned char *, int)); @@ -46,7 +46,7 @@ static void mdebug __P((long, char *, int)); static int mconvert __P((union VALUETYPE *, struct magic *)); /* - * softmagic - lookup one file in database + * softmagic - lookup one file in database * (already read from /etc/magic by apprentice.c). * Passed the name and FILE * of one file to be typed. */ @@ -103,7 +103,7 @@ int nbytes; /* if main entry matches, print it... */ if (!mget(&p, s, &magic[magindex], nbytes) || !mcheck(&p, &magic[magindex])) { - /* + /* * main entry didn't match, * flush its continuations */ @@ -122,7 +122,7 @@ int nbytes; need_separator = 1; /* and any continuations that match */ cont_level++; - while (magic[magindex+1].cont_level != 0 && + while (magic[magindex+1].cont_level != 0 && ++magindex < nmagic) { if (cont_level >= magic[magindex].cont_level) { if (cont_level > magic[magindex].cont_level) { |