From: Eric S. Raymond Date: Fri, 12 Sep 2003 08:30:32 +0000 (+0000) Subject: argcount gets set now. X-Git-Tag: 1.4~11 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=e22e7b6ce0b50f2032b897d0b0d07edbb9ba07c4;p=comparator.git argcount gets set now. --- diff --git a/main.c b/main.c index 9df2675..7c1fc41 100644 --- a/main.c +++ b/main.c @@ -363,7 +363,7 @@ main(int argc, char *argv[]) extern char *optarg; /* set by getopt */ extern int optind; /* set by getopt */ - int status, file_only, compile_only; + int status, file_only, compile_only, argcount; struct scf_t *scf; char *dir, *outfile; struct sorthash_t *np; @@ -416,7 +416,8 @@ main(int argc, char *argv[]) sort_count = 0; } - if ((argc - optind) == 0) + argcount = (argc - optind); + if (argcount == 0) usage(); report_time(NULL); @@ -431,7 +432,7 @@ main(int argc, char *argv[]) } /* special case if user gave exactly one tree */ - if (!compile_only && optind == argc - 1) + if (!compile_only && argcount == 1) { write_scf(argv[optind], stdout); exit(0);