diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index c65d8f2..97a14f3 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -340,7 +340,7 @@ procline(struct str *l, int nottext) matches[m++] = pmatch; /* matches - skip further patterns */ if ((color != NULL && !oflag) || qflag || lflag) - break; + goto skip; } } @@ -348,9 +348,6 @@ procline(struct str *l, int nottext) c = !c; break; } - /* One pass if we are not recording matches */ - if ((color != NULL && !oflag) || qflag || lflag) - break; if (st == (size_t)pmatch.rm_so) break; /* No matches */ @@ -358,6 +355,7 @@ procline(struct str *l, int nottext) } else c = !vflag; +skip: if (c && binbehave == BINFILE_BIN && nottext) return (c); /* Binary file */