Date: Fri, 27 Jun 2008 14:25:00 GMT From: Gabor Kovesdan <gabor@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 144191 for review Message-ID: <200806271425.m5REP0mg035726@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=144191 Change 144191 by gabor@gabor_server on 2008/06/27 14:24:02 - Restore compatibility of empty regexp Affected files ... .. //depot/projects/soc2008/gabor_textproc/grep/grep.c#52 edit Differences ... ==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#52 (text+ko) ==== @@ -343,7 +343,7 @@ int main(int argc, char *argv[]) { - int c, lastc, prevoptind, newarg, i; + int c, lastc, prevoptind, newarg, i, needpattern; char *ep; unsigned long long l; @@ -382,6 +382,7 @@ lastc = '\0'; newarg = 1; prevoptind = 1; + needpattern = 1; while ((c = getopt_long(argc, argv, optstr, long_options, NULL)) != -1) { switch (c) { @@ -439,6 +440,7 @@ break; case 'e': add_pattern(optarg, strlen(optarg)); + needpattern = 0; break; case 'F': Eflag = Gflag = 0; @@ -446,6 +448,7 @@ break; case 'f': read_patterns(optarg); + needpattern = 0; break; case 'G': Eflag = Fflag = 0; @@ -575,10 +578,10 @@ argc -= optind; argv += optind; - if (argc == 0 && patterns == 0) + if (argc == 0 && needpattern) usage(); - if (patterns == 0) { + if (argc != 0 && needpattern) { add_pattern(*argv, strlen(*argv)); --argc; ++argv;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806271425.m5REP0mg035726>