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

From: Test Rat <ttsestt_at_gmail.com>
Date: Tue, 09 Aug 2011 16:43:47 +0400
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)
_at__at_ -84,7 +84,7 _at__at_ 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
%%
Received on Tue Aug 09 2011 - 10:43:54 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:16 UTC