projects
/
debian
/
tar
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 1.24
[debian/tar]
/
gnu
/
exclude.c
diff --git
a/gnu/exclude.c
b/gnu/exclude.c
index 00a053fc70a022ebb5fc4b3ce64be0848085c251..dfa2aabff8f5bd045eb7976f9149b9961cd498b7 100644
(file)
--- a/
gnu/exclude.c
+++ b/
gnu/exclude.c
@@
-136,6
+136,26
@@
fnmatch_pattern_has_wildcards (const char *str, int options)
return false;
}
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 *
/* Return a newly allocated and empty exclude list. */
struct exclude *
@@
-344,7
+364,7
@@
excluded_file_pattern_p (struct exclude_segment const *seg, char const *f)
{
char const *pattern = exclude[i].pattern;
int options = exclude[i].options;
{
char const *pattern = exclude[i].pattern;
int options = exclude[i].options;
- if (exclude
d != exclude
_fnmatch (pattern, f, options))
+ if (exclude_fnmatch (pattern, f, options))
return !excluded;
}
return excluded;
return !excluded;
}
return excluded;
@@
-482,6
+502,8
@@
add_exclude (struct exclude *ex, char const *pattern, int options)
seg = new_exclude_segment (ex, exclude_hash, options);
str = xstrdup (pattern);
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);
p = hash_insert (seg->v.table, str);
if (p != str)
free (str);