Fixed -qv interaction (thanks to a report and patch from David Douthitt).
authorMatt Kraai <kraai@debian.org>
Thu, 4 Jan 2001 15:11:52 +0000 (15:11 -0000)
committerMatt Kraai <kraai@debian.org>
Thu, 4 Jan 2001 15:11:52 +0000 (15:11 -0000)
findutils/grep.c
grep.c

index 83336613e21b978d873451ebdca98219c0941701..69195bfdcaadf7d8910aac39cab75b2be2e74fe4 100644 (file)
@@ -85,6 +85,11 @@ static void grep_file(FILE *file)
 
                }
                else if (ret == REG_NOMATCH && invert_search) {
+                       if (be_quiet) {
+                               regfree(&regex);
+                               exit(0);
+                       }
+
                        nmatches++;
                        print_matched_line(line, linenum);
                }
diff --git a/grep.c b/grep.c
index 83336613e21b978d873451ebdca98219c0941701..69195bfdcaadf7d8910aac39cab75b2be2e74fe4 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -85,6 +85,11 @@ static void grep_file(FILE *file)
 
                }
                else if (ret == REG_NOMATCH && invert_search) {
+                       if (be_quiet) {
+                               regfree(&regex);
+                               exit(0);
+                       }
+
                        nmatches++;
                        print_matched_line(line, linenum);
                }