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)
Tue, Oct 21, 8:05 AM
Unknown Object (File)
Thu, Oct 16, 1:51 AM
Unknown Object (File)
Thu, Oct 16, 12:26 AM
Unknown Object (File)
Sat, Oct 4, 8:59 AM
Unknown Object (File)
Tue, Sep 30, 9:48 PM
Unknown Object (File)
Mon, Sep 29, 9:46 PM
Unknown Object (File)
Thu, Sep 25, 9:36 AM
Unknown Object (File)
Sep 22 2025, 9:51 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