From: Ian Darwin Date: Mon, 5 Oct 1987 22:04:55 +0000 (+0000) Subject: If -f namefile was specified, we don't need a list of files on X-Git-Tag: FILE3_27~379 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2bd7103bc8bf077538d30baca1fe1645ddd2b8cc;p=file If -f namefile was specified, we don't need a list of files on the commandline too, though it's still allowable to have both. --- diff --git a/src/file.c b/src/file.c index 8724f902..06a14055 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.10 1987/10/05 21:47:05 ian Exp $"; + "@(#)$Header: /home/glen/git/file/cvs/file/src/file.c,v 1.11 1987/10/05 22:04:55 ian Exp $"; #endif /* lint */ extern char *ckfmsg; int debug = 0, /* huh? */ @@ -61,7 +61,7 @@ int argc; char *argv[]; { int c; - int check = 0, errflg = 0, ret = 0; + int check = 0, didsomefiles = 0, errflg = 0, ret = 0; extern int optind; extern char *optarg; @@ -77,6 +77,7 @@ char *argv[]; break; case 'f': unwrap(optarg); + ++didsomefiles; break; case 'm': magicfile = optarg; @@ -95,8 +96,10 @@ char *argv[]; if (check) exit(ret); - if (optind == argc) - (void)fprintf(stderr, USAGE, progname); + if (optind == argc) { + if (!didsomefiles) + (void)fprintf(stderr, USAGE, progname); + } else for (; optind < argc; optind++) process(argv[optind]);