Page MenuHomeFreeBSD

grep: fix combination of quite and count flag
ClosedPublic

Authored by oshogbo on Jul 8 2021, 11:45 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 26, 2:46 AM
Unknown Object (File)
Sat, Apr 25, 12:47 PM
Unknown Object (File)
Tue, Apr 21, 2:06 PM
Unknown Object (File)
Fri, Apr 17, 7:28 PM
Unknown Object (File)
Wed, Apr 8, 4:51 AM
Unknown Object (File)
Wed, Apr 8, 12:51 AM
Unknown Object (File)
Tue, Apr 7, 11:48 AM
Unknown Object (File)
Mar 26 2026, 1:43 PM
Subscribers
None

Details

Summary

When the quite (-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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable