Lines Matching refs:pat

188 static bool __match_charclass(const char *pat, char c, const char **npat)  in __match_charclass()  argument
192 if (*pat == '!') { in __match_charclass()
194 pat++; in __match_charclass()
196 if (*pat++ == c) /* First character is special */ in __match_charclass()
199 while (*pat && *pat != ']') { /* Matching */ in __match_charclass()
200 if (*pat == '-' && *(pat + 1) != ']') { /* Range */ in __match_charclass()
201 if (*(pat - 1) <= c && c <= *(pat + 1)) in __match_charclass()
203 if (*(pat - 1) > *(pat + 1)) in __match_charclass()
205 pat += 2; in __match_charclass()
206 } else if (*pat++ == c) in __match_charclass()
209 if (!*pat) in __match_charclass()
214 while (*pat && *pat != ']') /* Searching closing */ in __match_charclass()
215 pat++; in __match_charclass()
216 if (!*pat) in __match_charclass()
218 *npat = pat + 1; in __match_charclass()
226 static bool __match_glob(const char *str, const char *pat, bool ignore_space) in __match_glob() argument
228 while (*str && *pat && *pat != '*') { in __match_glob()
235 if (isspace(*pat)) { in __match_glob()
236 pat++; in __match_glob()
240 if (*pat == '?') { /* Matches any single character */ in __match_glob()
242 pat++; in __match_glob()
244 } else if (*pat == '[') /* Character classes/Ranges */ in __match_glob()
245 if (__match_charclass(pat + 1, *str, &pat)) { in __match_glob()
250 else if (*pat == '\\') /* Escaped char match as normal char */ in __match_glob()
251 pat++; in __match_glob()
252 if (*str++ != *pat++) in __match_glob()
256 if (*pat == '*') { in __match_glob()
257 while (*pat == '*') in __match_glob()
258 pat++; in __match_glob()
259 if (!*pat) /* Tail wild card matches all */ in __match_glob()
262 if (__match_glob(str++, pat, ignore_space)) in __match_glob()
265 return !*str && !*pat; in __match_glob()
280 bool strglobmatch(const char *str, const char *pat) in strglobmatch() argument
282 return __match_glob(str, pat, false); in strglobmatch()
293 bool strlazymatch(const char *str, const char *pat) in strlazymatch() argument
295 return __match_glob(str, pat, true); in strlazymatch()