The branch stable/13 has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c91cdb006e6c83edab702b784c120e51c410e051

commit c91cdb006e6c83edab702b784c120e51c410e051
Author:     Mariusz Zaborski <[email protected]>
AuthorDate: 2021-07-09 12:09:14 +0000
Commit:     Ed Maste <[email protected]>
CommitDate: 2021-09-22 14:05:39 +0000

    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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c
index a2520e24de8e..698e347c192e 100644
--- a/usr.bin/grep/util.c
+++ b/usr.bin/grep/util.c
@@ -388,7 +388,7 @@ procfile(const char *fn)
                clearqueue();
        grep_close(f);
 
-       if (cflag) {
+       if (cflag && !qflag) {
                if (!hflag)
                        printf("%s:", pc.ln.file);
                printf("%u\n", lines);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to