aboutsummaryrefslogtreecommitdiffstats
path: root/exclude.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2006-12-28 07:54:19 +0000
committerWayne Davison <wayned@samba.org>2006-12-28 07:54:19 +0000
commitfe04532ad287836dbba6305b734e6fd1978e02c6 (patch)
treec92e985ee3f86c83635c420ef4e335ffb3a2e89b /exclude.c
parente4b619b46d6ad596a8e5ceaa6b5d34b0fd2cc527 (diff)
downloadandroid_external_rsync-fe04532ad287836dbba6305b734e6fd1978e02c6.tar.gz
android_external_rsync-fe04532ad287836dbba6305b734e6fd1978e02c6.tar.bz2
android_external_rsync-fe04532ad287836dbba6305b734e6fd1978e02c6.zip
New support function: change_local_filter_dir().
Diffstat (limited to 'exclude.c')
-rw-r--r--exclude.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/exclude.c b/exclude.c
index cfaed26f..6bf20a5b 100644
--- a/exclude.c
+++ b/exclude.c
@@ -493,6 +493,30 @@ void pop_local_filters(void *mem)
free(pop);
}
+void change_local_filter_dir(const char *dname, int dlen, int dir_depth)
+{
+ static int min_depth = MAXPATHLEN, cur_depth = -1;
+ static void *filt_array[MAXPATHLEN/2+1];
+
+ if (!dname) {
+ while (cur_depth >= min_depth)
+ pop_local_filters(filt_array[cur_depth--]);
+ min_depth = MAXPATHLEN;
+ cur_depth = -1;
+ return;
+ }
+
+ assert(dir_depth < MAXPATHLEN/2+1);
+
+ while (cur_depth >= dir_depth && cur_depth >= min_depth)
+ pop_local_filters(filt_array[cur_depth--]);
+ cur_depth = dir_depth;
+ if (cur_depth < min_depth)
+ min_depth = cur_depth;
+
+ filt_array[cur_depth] = push_local_filters(dname, dlen);
+}
+
static int rule_matches(char *name, struct filter_struct *ex, int name_is_dir)
{
int slash_handling, str_cnt = 0, anchored_match = 0;