summaryrefslogtreecommitdiff
path: root/pcregrep.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2015-08-05 17:43:19 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2015-08-05 17:43:19 +0000
commit8dda766e48f3bd16df6d8af870e9df4551b6216d (patch)
treea53c4fb5ddb0bb640c362406fad02549753decbc /pcregrep.c
parent7af8e8717def179fd7b69e173abd347c1a3547cb (diff)
downloadpcre-8dda766e48f3bd16df6d8af870e9df4551b6216d.tar.gz
Make pcregrep -q override -l and -c for compatibility with other greps.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1586 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcregrep.c')
-rw-r--r--pcregrep.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pcregrep.c b/pcregrep.c
index c49a74f..64986b0 100644
--- a/pcregrep.c
+++ b/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)
{