X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/96d3590a08439cf2338939f5f5606ff3a4bc5f7d..63d0331991702d3570078551acf266f0e405faa4:/exclude.c diff --git a/exclude.c b/exclude.c index 9fa83196..274ab904 100644 --- a/exclude.c +++ b/exclude.c @@ -191,17 +191,17 @@ static int check_one_exclude(char *name, struct exclude_struct *ex, static void report_exclude_result(char const *name, struct exclude_struct const *ent, - int name_is_dir) + int name_is_dir, const char *type) { /* If a trailing slash is present to match only directories, * then it is stripped out by make_exclude. So as a special * case we add it back in here. */ if (verbose >= 2) { - rprintf(FINFO, "[%s] %scluding %s %s because of pattern %s%s\n", + rprintf(FINFO, "[%s] %scluding %s %s because of %s %s%s\n", who_am_i(), ent->include ? "in" : "ex", - name_is_dir ? "directory" : "file", name, ent->pattern, - ent->directory ? "/" : ""); + name_is_dir ? "directory" : "file", name, type, + ent->pattern, ent->directory ? "/" : ""); } } @@ -210,13 +210,14 @@ static void report_exclude_result(char const *name, * Return true if file NAME is defined to be excluded by either * LOCAL_EXCLUDE_LIST or the globals EXCLUDE_LIST. */ -int check_exclude(struct exclude_struct **list, char *name, int name_is_dir) +int check_exclude(struct exclude_struct **list, char *name, int name_is_dir, + const char *type) { struct exclude_struct *ent; while ((ent = *list++) != NULL) { if (check_one_exclude(name, ent, name_is_dir)) { - report_exclude_result(name, ent, name_is_dir); + report_exclude_result(name, ent, name_is_dir, type); return !ent->include; } } @@ -236,13 +237,15 @@ int check_exclude(struct exclude_struct **list, char *name, int name_is_dir) static const char *get_exclude_tok(const char *p, int *len_ptr, int *incl_ptr, int xflags) { - const unsigned char *s = (unsigned char *)p; + const unsigned char *s = (const unsigned char *)p; int len; if (xflags & XFLG_WORD_SPLIT) { /* Skip over any initial whitespace. */ while (isspace(*s)) s++; + /* Update for "!" check. */ + p = (const char *)s; } /* Is this a '+' or '-' followed by a space (not whitespace)? */ @@ -262,8 +265,7 @@ static const char *get_exclude_tok(const char *p, int *len_ptr, int *incl_ptr, } else len = strlen(s); - if (*s == '!' && len == 1 && !(xflags & XFLG_NO_PREFIXES) - && (const char *)s == p) + if (*p == '!' && len == 1 && !(xflags & XFLG_NO_PREFIXES)) *incl_ptr = -1; *len_ptr = len;