From 816897d4a2a92e815b4df9a9427b9649a83f841b Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Thu, 24 Jul 1997 20:04:16 +0000 Subject: patch by glenn burkhardt to allow recursive excluding of directories. glenn@aoi.ultranet.com lkcl (This used to be commit 4aac8449ae1f4e9d214071e8b254ce8b391496a4) --- source3/client/clitar.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 5afff63de4..951947ecb2 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -372,10 +372,15 @@ static long unoct(char *p, int ndgs) } /**************************************************************************** -Compare two strings in a slash insensitive way +Compare two strings in a slash insensitive way, allowing s1 to match s2 +if s1 is an "initial" string (up to directory marker). Thus, if s2 is +a file in any subdirectory of s1, declare a match. ***************************************************************************/ -int strslashcmp(char *s1,char *s2) +static +int strslashcmp(char *s1, char *s2) { + char *s1_0=s1; + while(*s1 && *s2 && (*s1 == *s2 || tolower(*s1) == tolower(*s2) @@ -384,6 +389,17 @@ int strslashcmp(char *s1,char *s2) s1++; s2++; } + /* if s1 has a trailing slash, it compared equal, so s1 is an "initial" + string of s2. + */ + if (!*s1 && s1 != s1_0 && (*(s1-1) == '/' || *(s1-1) == '\\')) return 0; + + /* ignore trailing slash on s1 */ + if (!*s2 && (*s1 == '/' || *s1 == '\\') && !*(s1+1)) return 0; + + /* check for s1 is an "initial" string of s2 */ + if (*s2 == '/' || *s2 == '\\') return 0; + return *s1-*s2; } @@ -1128,11 +1144,6 @@ static void do_tar(file_info *finfo) strcpy(exclaim, cur_dir); *(exclaim+strlen(exclaim)-1)='\0'; - if (clipfind(cliplist, clipn, exclaim)) { - DEBUG(3,("Skipping directory %s\n", exclaim)); - return; - } - strcat(exclaim, "\\"); strcat(exclaim, finfo->name); -- cgit