[bsdgrep] --exclude-dir doesn't work

Test Rat ttsestt at gmail.com
Tue Aug 9 12:43:54 UTC 2011


It seems fnmatch(3) args were accidentally swapped. Try

  $ bsdgrep -Fr --exclude-dir '*.svn*' grep_ usr.bin/grep | bsdgrep -c svn
  72

%%
Index: usr.bin/grep/util.c
===================================================================
--- usr.bin/grep/util.c	(revision 224705)
+++ usr.bin/grep/util.c	(working copy)
@@ -84,7 +84,7 @@ dir_matching(const char *dname)
 
 	for (unsigned int i = 0; i < dpatterns; ++i) {
 		if (dname != NULL &&
-		    fnmatch(dname, dpattern[i].pat, 0) == 0) {
+		    fnmatch(dpattern[i].pat, dname, 0) == 0) {
 			if (dpattern[i].mode == EXCL_PAT)
 				return (false);
 			else
%%


More information about the freebsd-current mailing list