- ret->pattern = strdup(pattern);
-
- if (!ret->pattern) out_of_memory("make_exclude");
-
- if (strpbrk(pattern, "*[?")) {
- ret->regular_exp = 1;
- ret->fnmatch_flags = FNM_PATHNAME;
- if (strstr(pattern, "**")) {
- static int tested;
- if (!tested) {
- tested = 1;
- if (fnmatch("a/b/*", "a/b/c/d", FNM_PATHNAME)==0) {
- rprintf(FERROR,"WARNING: fnmatch FNM_PATHNAME is broken on your system\n");
- }
- }
- ret->fnmatch_flags = 0;
- }
+ if (exclude_path_prefix)
+ ret->match_flags |= MATCHFLG_ABS_PATH;
+ if (exclude_path_prefix && *pattern == '/')
+ ex_len = strlen(exclude_path_prefix);
+ else
+ ex_len = 0;
+ ret->pattern = new_array(char, ex_len + pat_len + 1);
+ if (!ret->pattern)
+ out_of_memory("make_exclude");
+ if (ex_len)
+ memcpy(ret->pattern, exclude_path_prefix, ex_len);
+ strlcpy(ret->pattern + ex_len, pattern, pat_len + 1);
+ pat_len += ex_len;
+
+ if (strpbrk(ret->pattern, "*[?")) {
+ ret->match_flags |= MATCHFLG_WILD;
+ if ((cp = strstr(ret->pattern, "**")) != NULL) {
+ ret->match_flags |= MATCHFLG_WILD2;
+ /* If the pattern starts with **, note that. */
+ if (cp == ret->pattern)
+ ret->match_flags |= MATCHFLG_WILD2_PREFIX;
+ }