X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fexclude.c;h=7b71c1242168ce107d8ba380cdf422334fd240e4;hb=c0ebdfe226c38c72db7c1944113fd19ff534e362;hp=34b563671116c24585e538acf0c7255a59eb8368;hpb=6207255863f1fb5172ead8b03cda5e4b0b7336a4;p=gnulib.git diff --git a/lib/exclude.c b/lib/exclude.c index 34b563671..7b71c1242 100644 --- a/lib/exclude.c +++ b/lib/exclude.c @@ -134,6 +134,26 @@ fnmatch_pattern_has_wildcards (const char *str, int options) return false; } +static void +unescape_pattern (char *str) +{ + int inset = 0; + char *q = str; + do + { + if (inset) + { + if (*q == ']') + inset = 0; + } + else if (*q == '[') + inset = 1; + else if (*q == '\\') + q++; + } + while ((*str++ = *q++)); +} + /* Return a newly allocated and empty exclude list. */ struct exclude * @@ -480,6 +500,8 @@ add_exclude (struct exclude *ex, char const *pattern, int options) seg = new_exclude_segment (ex, exclude_hash, options); str = xstrdup (pattern); + if (options & EXCLUDE_WILDCARDS) + unescape_pattern (str); p = hash_insert (seg->v.table, str); if (p != str) free (str);