Lines Matching refs:pattern
52 * Set in gl_flags if pattern contained a globbing character.
54 * Same as GLOB_NOCHECK, but it will only append pattern if it did
184 glob(const char * __restrict pattern, int flags, int (*errfunc)(const char *,
192 _DIAGASSERT(pattern != NULL);
194 patnext = (const unsigned char *) pattern;
232 * Expand recursively a glob {} pattern. When there is no more expansion
237 globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
239 const Char* ptr = pattern;
242 _DIAGASSERT(pattern != NULL);
252 if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
253 return glob0(pattern, pglob, limit);
256 if (!globexp2(ptr, pattern, pglob, &rv, limit))
259 return glob0(pattern, pglob, limit);
265 * If it succeeds then it invokes globexp1 with the new pattern.
266 * If it fails then it tries to glob the rest of the pattern and returns.
269 globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv,
278 _DIAGASSERT(pattern != NULL);
283 for (lm = patbuf, pm = pattern; pm != ptr; *lm++ = *pm++)
309 /* Non matching braces; just glob the pattern */
312 * we use `pattern', not `patbuf' here so that that
315 *rv = glob0(pattern, pglob, limit);
352 * Append the rest of the pattern after the
358 /* Expand the current pattern */
383 globtilde(const Char **qpatnext, const Char *pattern, Char *patbuf,
399 _DIAGASSERT(pattern != NULL);
402 *qpatnext = pattern;
404 if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
408 for (p = pattern + 1, d = (char *)(void *)patbuf;
456 /* Append the rest of the pattern */
471 * The main glob() routine: compiles the pattern (optionally processing
472 * quotes), calls glob1() to do the real pattern matching, and finally
478 glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
485 _DIAGASSERT(pattern != NULL);
488 if ((error = globtilde(&qpatnext, pattern, patbuf, sizeof(patbuf),
554 * If there was no match we are going to append the pattern
556 * specified and the pattern did not contain any magic
563 return globextend(pattern, pglob, limit);
587 glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit)
591 _DIAGASSERT(pattern != NULL);
595 if (*pattern == EOS)
602 pathbuf + (sizeof(pathbuf) / sizeof(*pathbuf)) - 1, pattern,
608 * of recursion for each segment in the pattern that contains one or more
612 glob2(Char *pathbuf, Char *pathend, Char *pathlim, const Char *pattern,
622 _DIAGASSERT(pattern != NULL);
629 * Loop over pattern segments until end of pattern or until
633 if (*pattern == EOS) { /* End of pattern? */
661 p = pattern;
672 pattern = p;
673 while (*pattern == SEP) {
676 *pathend++ = *pattern++;
679 return glob3(pathbuf, pathend, pathlim, pattern, p,
680 pattern, pglob, limit);
686 glob3(Char *pathbuf, Char *pathend, Char *pathlim, const Char *pattern,
709 _DIAGASSERT(pattern != NULL);
728 error = pglobstar == pattern && termstar == restpattern ?
734 glob3(pathbuf, pathend, pathlim, pattern, restpattern,
794 if (dp->d_name[0] == DOT && *pattern != DOT)
839 if (!match(pathend, pattern, termstar))
851 if (!match(pathend, pattern, restpattern)) {
943 * pattern matching function for filenames.
1034 glob_pattern_p(const char *pattern, int quote)
1038 for (; *pattern; pattern++)
1039 switch (*pattern) {
1045 if (quote && pattern[1] != EOS)
1046 ++pattern;