Make -q override -l and -q in pcre2grep for compatibility with other greps.
This commit is contained in:
parent
4003ae5911
commit
537f8b1a3d
|
@ -105,6 +105,9 @@ fuzzer.
|
|||
27. Fixed an issue when \p{Any} inside an xclass did not read the current
|
||||
character.
|
||||
|
||||
28. If pcre2grep was given the -q option with -c or -l, or when handling a
|
||||
binary file, it incorrectly wrote output to stdout.
|
||||
|
||||
|
||||
Version 10.20 30-June-2015
|
||||
--------------------------
|
||||
|
|
|
@ -530,6 +530,14 @@ echo "aaaaa" >>testtemp1grep
|
|||
(cd $srcdir; $valgrind $pcre2grep --line-offsets '(?<=\Ka)' $builddir/testtemp1grep) >>testtrygrep 2>&1
|
||||
echo "RC=$?" >>testtrygrep
|
||||
|
||||
echo "---------------------------- Test 108 ------------------------------" >>testtrygrep
|
||||
(cd $srcdir; $valgrind $pcre2grep -lq PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
|
||||
echo "RC=$?" >>testtrygrep
|
||||
|
||||
echo "---------------------------- Test 109 -----------------------------" >>testtrygrep
|
||||
(cd $srcdir; $valgrind $pcre2grep -cq lazy ./testdata/grepinput*) >>testtrygrep
|
||||
echo "RC=$?" >>testtrygrep
|
||||
|
||||
# Now compare the results.
|
||||
|
||||
$cf $srcdir/testdata/grepoutput testtrygrep
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -751,3 +751,7 @@ RC=0
|
|||
2:3,1
|
||||
2:4,1
|
||||
RC=0
|
||||
---------------------------- Test 108 ------------------------------
|
||||
RC=0
|
||||
---------------------------- Test 109 -----------------------------
|
||||
RC=0
|
||||
|
|
Loading…
Reference in New Issue