Lines Matching refs:pat

73 static bool __match_charclass(const char *pat, char c, const char **npat)  in __match_charclass()  argument
77 if (*pat == '!') { in __match_charclass()
79 pat++; in __match_charclass()
81 if (*pat++ == c) /* First character is special */ in __match_charclass()
84 while (*pat && *pat != ']') { /* Matching */ in __match_charclass()
85 if (*pat == '-' && *(pat + 1) != ']') { /* Range */ in __match_charclass()
86 if (*(pat - 1) <= c && c <= *(pat + 1)) in __match_charclass()
88 if (*(pat - 1) > *(pat + 1)) in __match_charclass()
90 pat += 2; in __match_charclass()
91 } else if (*pat++ == c) in __match_charclass()
94 if (!*pat) in __match_charclass()
99 while (*pat && *pat != ']') /* Searching closing */ in __match_charclass()
100 pat++; in __match_charclass()
101 if (!*pat) in __match_charclass()
103 *npat = pat + 1; in __match_charclass()
111 static bool __match_glob(const char *str, const char *pat, bool ignore_space, in __match_glob() argument
114 while (*str && *pat && *pat != '*') { in __match_glob()
121 if (isspace(*pat)) { in __match_glob()
122 pat++; in __match_glob()
126 if (*pat == '?') { /* Matches any single character */ in __match_glob()
128 pat++; in __match_glob()
130 } else if (*pat == '[') /* Character classes/Ranges */ in __match_glob()
131 if (__match_charclass(pat + 1, *str, &pat)) { in __match_glob()
136 else if (*pat == '\\') /* Escaped char match as normal char */ in __match_glob()
137 pat++; in __match_glob()
139 if (tolower(*str) != tolower(*pat)) in __match_glob()
141 } else if (*str != *pat) in __match_glob()
144 pat++; in __match_glob()
147 if (*pat == '*') { in __match_glob()
148 while (*pat == '*') in __match_glob()
149 pat++; in __match_glob()
150 if (!*pat) /* Tail wild card matches all */ in __match_glob()
153 if (__match_glob(str++, pat, ignore_space, case_ins)) in __match_glob()
156 return !*str && !*pat; in __match_glob()
171 bool strglobmatch(const char *str, const char *pat) in strglobmatch() argument
173 return __match_glob(str, pat, false, false); in strglobmatch()
176 bool strglobmatch_nocase(const char *str, const char *pat) in strglobmatch_nocase() argument
178 return __match_glob(str, pat, false, true); in strglobmatch_nocase()
189 bool strlazymatch(const char *str, const char *pat) in strlazymatch() argument
191 return __match_glob(str, pat, true, false); in strlazymatch()