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)
Sat, Sep 26, 5:04 AM
Unknown Object (File)
Sun, Sep 20, 8:23 AM
Unknown Object (File)
Sun, Sep 13, 1:39 PM
Unknown Object (File)
Sat, Sep 12, 10:24 PM
Unknown Object (File)
Sun, Sep 6, 5:25 PM
Unknown Object (File)
Sat, Sep 5, 2:24 PM
Unknown Object (File)
Fri, Aug 28, 11:57 PM
Unknown Object (File)
Aug 25 2026, 6:57 AM
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