Official request: Please make GNU grep the default

Dimitry Andric dimitry at andric.com
Thu Aug 19 20:22:57 UTC 2010


On 2010-08-19 18:42, David Xu wrote:
> When will the grep -H print file name for me ?  it is rather painful 
> that the feature is missing. :-(
> So I can not use it with find:
> 
> find . -exec grep -H {} world \;
> I don't know which file contains the word world.

I think you mean:

  find . -exec grep -H world {} \;

instead?  In any case, the fix is trivial, please try the attachment.
-------------- next part --------------
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 3cb277c..cc710ef 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -682,8 +682,6 @@ main(int argc, char *argv[])
 	if (dirbehave == DIR_RECURSE)
 		c = grep_tree(aargv);
 	else {
-		if (aargc == 1)
-			hflag = true;
 		for (c = 0; aargc--; ++aargv) {
 			if ((finclude || fexclude) && !file_matching(*aargv))
 				continue;


More information about the freebsd-current mailing list