]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
grep: fix combination of quiet and count flag
authorMariusz Zaborski <oshogbo@FreeBSD.org>
Fri, 9 Jul 2021 12:09:14 +0000 (14:09 +0200)
committerEd Maste <emaste@FreeBSD.org>
Wed, 22 Sep 2021 14:06:39 +0000 (10:06 -0400)
commit42368c6b5f920cda954621c3c541bfdb754ab0c8
tree2a394dc39714bb6d448e0bef8a1d0b9a556e1998
parent4581de213ef452b0e593a7d87b930d48d64aa71d
grep: fix combination of quiet and count flag

When the quiet (-q) flag is provided, we don't expect any output.
Currently, the behavior is broken:
$ grep -cq flag util.c
1

$ grep -cs flag util.c
55

First of all, we print a number to stdout. Secondly, it just returns
0 or 1 (which is unexpected). GNU grep with c and q flags doesn't
print anything.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31108

(cherry picked from commit 24c681a7f6d6c777221fdbd289da64ff65ad8785)
usr.bin/grep/util.c