/* * Loads the exclude lists for the directory containing pathname, then * scans all exclude lists to determine whether pathname is excluded. * Returns the exclude_list element which matched, or NULL for * undecided. */ struct exclude *last_exclude_matching(struct dir_struct *dir, const char *pathname, int *dtype_p) { int pathlen = strlen(pathname); const char *basename = strrchr(pathname, '/'); basename = (basename) ? basename+1 : pathname; prep_exclude(dir, pathname, basename-pathname); if (dir->exclude) return dir->exclude; return last_exclude_matching_from_lists(dir, pathname, pathlen, basename, dtype_p); }
int excluded(struct dir_struct *dir, const char *pathname, int *dtype_p) { int pathlen = strlen(pathname); int st; const char *basename = strrchr(pathname, '/'); basename = (basename) ? basename+1 : pathname; prep_exclude(dir, pathname, basename-pathname); for (st = EXC_CMDL; st <= EXC_FILE; st++) { switch (excluded_from_list(pathname, pathlen, basename, dtype_p, &dir->exclude_list[st])) { case 0: return 0; case 1: return 1; } } return 0; }