X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/c2f0e4d965849a8860c5bb8f59ba548fc28805ec..8e41b68e8f975c02a5d9281be780ba5d1a385107:/exclude.c diff --git a/exclude.c b/exclude.c index cfaed26f..1a0be70f 100644 --- a/exclude.c +++ b/exclude.c @@ -4,11 +4,11 @@ * Copyright (C) 1996-2001 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2002 Martin Pool - * Copyright (C) 2003, 2004, 2005, 2006 Wayne Davison + * Copyright (C) 2003-2007 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -17,8 +17,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + * with this program; if not, visit the http://fsf.org website. */ #include "rsync.h" @@ -493,6 +492,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;