- Use dev_t instead of DEV64_T.
[rsync/rsync.git] / exclude.c
index d7fe924..1003f6a 100644 (file)
--- a/exclude.c
+++ b/exclude.c
@@ -246,7 +246,7 @@ void add_exclude(struct exclude_struct ***listp, const char *pattern, int includ
        if (list)
                for (; list[len]; len++) {}
 
-       list = *listp = realloc_array(list, struct exclude_struct *, len+2);
+       list = *listp = realloc_array(list, struct exclude_struct *, len+2);
 
        if (!list || !(list[len] = make_exclude(pattern, include)))
                out_of_memory("add_exclude");
@@ -328,32 +328,34 @@ void send_exclude_list(int f)
                add_exclude(&exclude_list, "/*/*", ADD_EXCLUDE);
 
        if (!exclude_list) {
-               write_int(f,0);
+               write_int(f, 0);
                return;
        }
 
        for (i = 0; exclude_list[i]; i++) {
                unsigned int l;
-               char pattern[MAXPATHLEN+1];
+               char p[MAXPATHLEN+1];
 
-               l = strlcpy(pattern, exclude_list[i]->pattern, sizeof pattern);
+               l = strlcpy(p, exclude_list[i]->pattern, sizeof p);
                if (l == 0 || l >= MAXPATHLEN)
                        continue;
                if (exclude_list[i]->directory) {
-                       pattern[l++] = '/';
-                       pattern[l] = '\0';
+                       p[l++] = '/';
+                       p[l] = '\0';
                }
 
                if (exclude_list[i]->include) {
-                       write_int(f,l+2);
-                       write_buf(f,"+ ",2);
-               } else {
-                       write_int(f,l);
-               }
-               write_buf(f,pattern,l);
+                       write_int(f, l + 2);
+                       write_buf(f, "+ ", 2);
+               } else if ((*p == '-' || *p == '+') && p[1] == ' ') {
+                       write_int(f, l + 2);
+                       write_buf(f, "- ", 2);
+               } else
+                       write_int(f, l);
+               write_buf(f, p, l);
        }
 
-       write_int(f,0);
+       write_int(f, 0);
 }
 
 
@@ -446,7 +448,7 @@ void add_cvs_excludes(void)
        char *p;
        int i;
 
-       for (i=0; cvs_ignore_list[i]; i++)
+       for (i = 0; cvs_ignore_list[i]; i++)
                add_exclude(&exclude_list, cvs_ignore_list[i], ADD_EXCLUDE);
 
        if ((p = getenv("HOME"))