From: Wayne Davison Date: Fri, 16 Apr 2004 16:18:43 +0000 (+0000) Subject: Added an exclude-list convenience function. X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/commitdiff_plain/4eddff1630ee489ee5fa856668ec5d1038883a01 Added an exclude-list convenience function. --- diff --git a/perdir-exclude-from.diff b/perdir-exclude-from.diff index bca1ce5..b123b4f 100644 --- a/perdir-exclude-from.diff +++ b/perdir-exclude-from.diff @@ -34,7 +34,21 @@ for (ent = listp->head; ent; ent = next) { next = ent->next; free_exclude(ent); -@@ -209,21 +220,24 @@ static void report_exclude_result(char c +@@ -109,6 +120,13 @@ void free_exclude_list(struct exclude_li + memset(listp, 0, sizeof listp[0]); + } + ++void clear_exclude_list(struct exclude_list_struct *listp, ++ struct exclude_struct *extra) ++{ ++ listp->head = listp->extra = extra; ++ listp->tail = NULL; ++} ++ + static int check_one_exclude(char *name, struct exclude_struct *ex, + int name_is_dir) + { +@@ -209,21 +227,24 @@ static void report_exclude_result(char c /* * Return true if file NAME is defined to be excluded by the specified @@ -63,7 +77,7 @@ } -@@ -249,10 +263,10 @@ static const char *get_exclude_tok(const +@@ -249,10 +270,10 @@ static const char *get_exclude_tok(const p = (const char *)s; } @@ -77,7 +91,7 @@ s += 2; } else *incl_ptr = xflags & XFLG_DEF_INCLUDE; -@@ -382,8 +396,12 @@ void send_exclude_list(int f) +@@ -382,8 +403,12 @@ void send_exclude_list(int f) if (ent->include) { write_int(f, l + 2); @@ -151,22 +165,21 @@ } /* used by the one_file_system code */ -@@ -957,8 +965,14 @@ void send_file_name(int f, struct file_l +@@ -957,8 +965,12 @@ void send_file_name(int f, struct file_l if (recursive && S_ISDIR(file->mode) && !(file->flags & FLAG_MOUNT_POINT)) { struct exclude_list_struct last_list = local_exclude_list; +- memset(&local_exclude_list, 0, sizeof local_exclude_list); + struct exclude_list_struct sub_list = subdir_exclude_list; - memset(&local_exclude_list, 0, sizeof local_exclude_list); -+ memset(&subdir_exclude_list, 0, sizeof subdir_exclude_list); -+ subdir_exclude_list.head = subdir_exclude_list.extra -+ = sub_list.head; ++ clear_exclude_list(&local_exclude_list, NULL); ++ clear_exclude_list(&subdir_exclude_list, sub_list.head); send_directory(f, flist, f_name_to(file, fbuf)); + free_exclude_list(&subdir_exclude_list); + subdir_exclude_list = sub_list; free_exclude_list(&local_exclude_list); local_exclude_list = last_list; } -@@ -1004,6 +1018,18 @@ static void send_directory(int f, struct +@@ -1004,6 +1016,18 @@ static void send_directory(int f, struct io_error |= IOERR_GENERAL; rprintf(FINFO, "cannot cvs-exclude in long-named directory %s\n", @@ -213,9 +226,12 @@ {"copy-links", 'L', POPT_ARG_NONE, ©_links, 0, 0, 0 }, --- proto.h 14 Apr 2004 23:33:30 -0000 1.188 +++ proto.h 15 Apr 2004 21:02:11 -0000 -@@ -53,7 +53,7 @@ void setup_protocol(int f_out,int f_in); +@@ -52,8 +52,10 @@ int daemon_main(void); + void setup_protocol(int f_out,int f_in); int claim_connection(char *fname,int max_connections); void free_exclude_list(struct exclude_list_struct *listp); ++void clear_exclude_list(struct exclude_list_struct *listp, ++ struct exclude_struct *extra); int check_exclude(struct exclude_list_struct *listp, char *name, int name_is_dir, - const char *type); + const char *type, int current_exclusion);