summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/grep.c b/grep.c
index 8333661..69195bf 100644
--- 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);
}