patch by glenn burkhardt to allow recursive excluding of directories.
authorSamba Release Account <samba-bugs@samba.org>
Thu, 24 Jul 1997 20:04:16 +0000 (20:04 +0000)
committerSamba Release Account <samba-bugs@samba.org>
Thu, 24 Jul 1997 20:04:16 +0000 (20:04 +0000)
glenn@aoi.ultranet.com

lkcl
(This used to be commit 4aac8449ae1f4e9d214071e8b254ce8b391496a4)

source3/client/clitar.c

index 5afff63de488721ded55ef95b4221aaead90bfaf..951947ecb28a592dc926edd6ab72754000a91cb4 100644 (file)
@@ -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);