summaryrefslogtreecommitdiff
path: root/src/pcre2grep.c
diff options
context:
space:
mode:
authorMatthew Vernon <matthew@debian.org>2016-02-27 15:00:32 +0000
committerMatthew Vernon <matthew@debian.org>2016-02-27 15:00:32 +0000
commit5fc77543f854bbe609407e8f2d54d906faad2883 (patch)
tree1c6a1c13657d2b80357ea2dadd7d8b3ee5c4e493 /src/pcre2grep.c
parentc27ff5607e8146d7dcacf9ab7c25a931f14e1fbd (diff)
Imported Upstream version 10.21
Diffstat (limited to 'src/pcre2grep.c')
-rw-r--r--src/pcre2grep.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/pcre2grep.c b/src/pcre2grep.c
index d5a5d6d..aadb22a 100644
--- a/src/pcre2grep.c
+++ b/src/pcre2grep.c
@@ -13,7 +13,7 @@ distribution because other apparatus is needed to compile pcre2grep for z/OS.
The header can be found in the special z/OS distribution, which is available
from www.zaconsultants.net or from www.cbttape.org.
- Copyright (c) 1997-2014 University of Cambridge
+ Copyright (c) 1997-2016 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -1691,9 +1691,13 @@ while (ptr < endptr)
if (filenames == FN_NOMATCH_ONLY) return 1;
+ /* If all we want is a yes/no answer, we can return immediately. */
+
+ 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
@@ -1705,8 +1709,8 @@ while (ptr < endptr)
return 0;
}
- /* If all we want is a file name, there is no need to scan any more lines
- in the file. */
+ /* Likewise, if all we want is a file name, there is no need to scan any
+ more lines in the file. */
else if (filenames == FN_MATCH_ONLY)
{
@@ -1714,10 +1718,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
@@ -2069,7 +2069,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)
{
@@ -2421,7 +2421,7 @@ return options;
static char *
ordin(int n)
{
-static char buffer[8];
+static char buffer[14];
char *p = buffer;
sprintf(p, "%d", n);
while (*p != 0) p++;