Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jul 2010 21:54:16 -0700 (PDT)
From:      Doug Barton <dougb@FreeBSD.org>
To:        Gabor Kovesdan <gabor@FreeBSD.org>
Cc:        freebsd-current@FreeBSD.org
Subject:   Re: [bsdgrep] grep -ql does not supress output
Message-ID:  <alpine.BSF.2.00.1007232153040.1697@qbhto.arg>
In-Reply-To: <alpine.BSF.2.00.1007232143100.1697@qbhto.arg>
References:  <alpine.BSF.2.00.1007232052210.1697@qbhto.arg> <4C4A6F00.9000203@FreeBSD.org> <alpine.BSF.2.00.1007232143100.1697@qbhto.arg>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Fri, 23 Jul 2010, Doug Barton wrote:

> Thanks. I took another look at it, and I think the attached patch does the 
> trick,

Oops, forgot !Lflag in the last bit, this one fixes it.


Doug

-- 

 	Improve the effectiveness of your Internet presence with
 	a domain name makeover!    http://SupersetSolutions.com/

 	Computers are useless. They can only give you answers.
 			-- Pablo Picasso

[-- Attachment #2 --]
Index: grep.c
===================================================================
--- grep.c	(revision 210438)
+++ grep.c	(working copy)
@@ -466,11 +466,11 @@
 			break;
 		case 'L':
 			lflag = false;
-			Lflag = qflag = true;
+			Lflag = true;
 			break;
 		case 'l':
 			Lflag = false;
-			lflag = qflag = true;
+			lflag = true;
 			break;
 		case 'm':
 			mflag = true;
Index: util.c
===================================================================
--- util.c	(revision 210438)
+++ util.c	(working copy)
@@ -226,9 +226,9 @@
 			printf("%s:", ln.file);
 		printf("%u\n", c);
 	}
-	if (lflag && c != 0)
+	if (lflag && !qflag && c != 0)
 		printf("%s\n", fn);
-	if (Lflag && c == 0)
+	if (Lflag && !qflag && c == 0)
 		printf("%s\n", fn);
 	if (c && !cflag && !lflag && !Lflag &&
 	    binbehave == BINFILE_BIN && f->binary && !qflag)
@@ -342,7 +342,7 @@
 		return (c); /* Binary file */
 
 	/* Dealing with the context */
-	if ((tail || c) && !cflag && !qflag) {
+	if ((tail || c) && !cflag && !qflag && !lflag && !Lflag) {
 		if (c) {
 			if (!first && !prev && !tail && Aflag)
 				printf("--\n");
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1007232153040.1697>