From 29b030df67f46bdb351f5a6bd7d9d3b4dc6b5d63 Mon Sep 17 00:00:00 2001 From: Bernhard Rosenkraenzer Date: Fri, 18 Aug 2006 22:00:30 +0000 Subject: --exclude-dir * lib/savedir.c, lib/savedir.h, src/grep.c, doc/*: Add --exclude-dir option (patch #5051) --- lib/savedir.c | 10 +++++++++- lib/savedir.h | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/savedir.c b/lib/savedir.c index 3990c266..974787e2 100644 --- a/lib/savedir.c +++ b/lib/savedir.c @@ -100,7 +100,7 @@ isdir1 (const char *dir, const char *file) Return NULL if DIR cannot be opened or if out of memory. */ char * savedir (const char *dir, off_t name_size, struct exclude *included_patterns, - struct exclude *excluded_patterns) + struct exclude *excluded_patterns, struct exclude *excluded_directory_patterns ) { DIR *dirp; struct dirent *dp; @@ -143,6 +143,14 @@ savedir (const char *dir, off_t name_size, struct exclude *included_patterns, && excluded_filename (excluded_patterns, dp->d_name, 0)) continue; } + + if ( excluded_directory_patterns + && isdir1 (dir, dp->d_name) ) + { + if (excluded_directory_patterns + && excluded_filename (excluded_directory_patterns, dp->d_name, 0)) + continue; + } if (size_needed > name_size) { diff --git a/lib/savedir.h b/lib/savedir.h index 49c331b5..a5f6e446 100644 --- a/lib/savedir.h +++ b/lib/savedir.h @@ -13,6 +13,7 @@ extern char * savedir PARAMS ((const char *dir, off_t name_size, - struct exclude *, struct exclude *)); + struct exclude *, struct exclude *, + struct exclude *)); #endif -- cgit v1.2.1