From owner-p4-projects@FreeBSD.ORG Sat Jul 17 00:25:03 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E67A31065676; Sat, 17 Jul 2010 00:25:02 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A99151065674 for ; Sat, 17 Jul 2010 00:25:02 +0000 (UTC) (envelope-from gabor@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 922CB8FC16 for ; Sat, 17 Jul 2010 00:25:02 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o6H0P2vH027702 for ; Sat, 17 Jul 2010 00:25:02 GMT (envelope-from gabor@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o6H0P2HH027700 for perforce@freebsd.org; Sat, 17 Jul 2010 00:25:02 GMT (envelope-from gabor@freebsd.org) Date: Sat, 17 Jul 2010 00:25:02 GMT Message-Id: <201007170025.o6H0P2HH027700@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gabor@freebsd.org using -f From: Gabor Kovesdan To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 181071 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2010 00:25:03 -0000 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)