#include <string.h>
#include <errno.h>
#include <fnmatch.h>
+#include <ctype.h>
#include <unistd.h>
/** Private flag: Used to mark that we currently adding the root directory of
if (*pp == '\\')
*pp = '/';
+ /* Remove drive letter */
+ if (eol - p > 2 && isalpha(*p) && *(p + 1) == ':')
+ p += 2;
+
if (strcmp(p, "[ExclusionList]") == 0)
type = EXCLUSION_LIST;
else if (strcmp(p, "[ExclusionException]") == 0)
const char *pat = list->pats[i];
const char *string;
if (pat[0] == '/')
+ /* Absolute path from root of capture */
string = path;
- else
- string = path_basename;
- if (fnmatch(pat, string, FNM_PATHNAME) == 0) {
+ else {
+ if (strchr(pat, '/'))
+ /* Relative path from root of capture */
+ string = path + 1;
+ else
+ /* A file name pattern */
+ string = path_basename;
+ }
+ if (fnmatch(pat, string, FNM_PATHNAME
+ #ifdef FNM_CASEFOLD
+ | FNM_CASEFOLD
+ #endif
+ ) == 0)
+ {
DEBUG("`%s' matches the pattern \"%s\"",
string, pat);
return true;