diff options
Diffstat (limited to 'pcre/pcregrep.c')
-rw-r--r-- | pcre/pcregrep.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pcre/pcregrep.c b/pcre/pcregrep.c index c49a74ffb78..64986b016e6 100644 --- a/pcre/pcregrep.c +++ b/pcre/pcregrep.c @@ -1692,9 +1692,13 @@ while (ptr < endptr) if (filenames == FN_NOMATCH_ONLY) return 1; + /* If all we want is a yes/no answer, stop now. */ + + if (quiet) return 0; + /* Just count if just counting is wanted. */ - if (count_only) count++; + else if (count_only) count++; /* When handling a binary file and binary-files==binary, the "binary" variable will be set true (it's false in all other cases). In this @@ -1715,10 +1719,6 @@ while (ptr < endptr) return 0; } - /* Likewise, if all we want is a yes/no answer. */ - - else if (quiet) return 0; - /* The --only-matching option prints just the substring that matched, and/or one or more captured portions of it, as long as these strings are not empty. The --file-offsets and --line-offsets options output offsets for @@ -2089,7 +2089,7 @@ if (filenames == FN_NOMATCH_ONLY) /* Print the match count if wanted */ -if (count_only) +if (count_only && !quiet) { if (count > 0 || !omit_zero_count) { |