static bool exclude_patopts (struct patopts const *opts, char const *f) { int options = opts->options; return (options & EXCLUDE_REGEX) ? regexec (&opts->v.re, f, 0, NULL, 0) == 0 : exclude_fnmatch (opts->v.pattern, f, options); }
/* Find a match for FILE_NAME (whose string length is LENGTH) in the name list. */ static struct name * namelist_match (char const *file_name, size_t length) { struct name *p; for (p = namelist; p; p = p->next) { if (p->name[0] && exclude_fnmatch (p->name, file_name, p->matching_flags)) return p; } return NULL; }
static bool excluded_file_pattern_p (struct exclude_segment const *seg, char const *f) { size_t exclude_count = seg->v.pat.exclude_count; struct patopts const *exclude = seg->v.pat.exclude; size_t i; bool excluded = !! (exclude[0].options & EXCLUDE_INCLUDE); /* Scan through the options, until they change excluded */ for (i = 0; i < exclude_count; i++) { char const *pattern = exclude[i].pattern; int options = exclude[i].options; if (exclude_fnmatch (pattern, f, options)) return !excluded; } return excluded; }