Date: Sat, 17 Jul 2010 00:25:02 GMT From: Gabor Kovesdan <gabor@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 181071 for review Message-ID: <201007170025.o6H0P2HH027700@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@181071?ac=10 Change 181071 by gabor@gabor_server on 2010/07/17 00:24:22 - Fix cases, where -v and multiple -e switches are specified together. Affected files ... .. //depot/projects/soc2008/gabor_textproc/grep/util.c#89 edit Differences ... ==== //depot/projects/soc2008/gabor_textproc/grep/util.c#89 (text+ko) ==== @@ -84,6 +84,7 @@ errx(2, "%s: %s", p->fts_path, strerror(p->fts_errno)); break; case FTS_DP: + /* FALLTHROUGH */ case FTS_D: break; case FTS_DC: @@ -260,11 +261,11 @@ if (fg_pattern[i].pattern) { r = grep_search(&fg_pattern[i], (unsigned char *)l->dat, l->len, &pmatch); - r = (r == 0) ? (vflag ? REG_NOMATCH : 0) : (vflag ? 0 : REG_NOMATCH); + r = (r == 0) ? 0 : REG_NOMATCH; st = pmatch.rm_eo; } else { r = regexec(&r_pattern[i], l->dat, 1, &pmatch, eflags); - r = (r == 0) ? (vflag ? REG_NOMATCH : 0) : (vflag ? 0 : REG_NOMATCH); + r = (r == 0) ? 0 : REG_NOMATCH; st = pmatch.rm_eo; } if (r == REG_NOMATCH) @@ -298,10 +299,15 @@ if (m == 0) c++; if (m < MAX_LINE_MATCHES) - matches[m] = pmatch; - m++; + matches[m++] = pmatch; + /* Matches - no need to check more patterns */ + break; } - break; + } + + if (vflag) { + c = !c; + break; } /* One pass if we are not recording matches */ if (!oflag && !color)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007170025.o6H0P2HH027700>