Lines Matching refs:pglob
161 glob(pattern, flags, errfunc, pglob) in glob() argument
164 glob_t *pglob;
179 pglob->gl_pathc = 0;
180 pglob->gl_pathv = NULL;
182 pglob->gl_offs = 0;
184 pglob->gl_flags = flags & ~GLOB_MAGCHAR;
185 pglob->gl_errfunc = errfunc;
186 pglob->gl_matchc = 0;
208 return globexp1(patbuf, pglob);
210 return glob0(patbuf, pglob);
219 globexp1(pattern, pglob) in globexp1() argument
221 glob_t *pglob;
228 return glob0(pattern, pglob);
231 if (!globexp2(ptr, pattern, pglob, &rv))
234 return glob0(pattern, pglob);
244 globexp2(ptr, pattern, pglob, rv) in globexp2() argument
246 glob_t *pglob;
283 *rv = glob0(patbuf, pglob);
333 *rv = globexp1(patbuf, pglob);
354 globtilde(pattern, patbuf, patbuf_len, pglob) in globtilde() argument
358 glob_t *pglob;
367 if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
433 glob0(pattern, pglob) in glob0() argument
435 glob_t *pglob;
442 qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob);
443 oldpathc = pglob->gl_pathc;
473 pglob->gl_flags |= GLOB_MAGCHAR;
477 pglob->gl_flags |= GLOB_MAGCHAR;
481 pglob->gl_flags |= GLOB_MAGCHAR;
498 if ((err = glob1(patbuf, patbuf+MAXPATHLEN-1, pglob, &limit)) != 0)
507 if (pglob->gl_pathc == oldpathc) {
508 if ((pglob->gl_flags & GLOB_NOCHECK) ||
509 ((pglob->gl_flags & GLOB_NOMAGIC) &&
510 !(pglob->gl_flags & GLOB_MAGCHAR)))
511 return(globextend(pattern, pglob, &limit));
515 if (!(pglob->gl_flags & GLOB_NOSORT))
516 qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
517 pglob->gl_pathc - oldpathc, sizeof(char *), compare);
528 glob1(pattern, pattern_last, pglob, limitp) in glob1() argument
530 glob_t *pglob;
540 pattern, pattern_last, pglob, limitp));
550 pattern_last, pglob, limitp) in glob2() argument
553 glob_t *pglob;
567 if (g_lstat(pathbuf, &sb, pglob))
570 if (((pglob->gl_flags & GLOB_MARK) &&
573 (g_stat(pathbuf, &sb, pglob) == 0) &&
580 ++pglob->gl_matchc;
581 return(globextend(pathbuf, pglob, limitp));
607 p, pattern_last, pglob, limitp));
614 restpattern, restpattern_last, pglob, limitp) in glob3() argument
617 glob_t *pglob;
637 if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
639 if (pglob->gl_errfunc) {
643 if (pglob->gl_errfunc(buf, errno) ||
644 pglob->gl_flags & GLOB_ERR)
653 if (pglob->gl_flags & GLOB_ALTDIRFUNC)
654 readdirfunc = pglob->gl_readdir;
679 restpattern, restpattern_last, pglob, limitp);
684 if (pglob->gl_flags & GLOB_ALTDIRFUNC)
685 (*pglob->gl_closedir)(dirp);
707 globextend(path, pglob, limitp) in globextend() argument
709 glob_t *pglob;
717 newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
718 pathv = pglob->gl_pathv ? realloc((char *)pglob->gl_pathv, newsize) :
721 if (pglob->gl_pathv) {
722 free(pglob->gl_pathv);
723 pglob->gl_pathv = NULL;
728 if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
731 pathv += pglob->gl_offs;
732 for (i = pglob->gl_offs; --i >= 0; )
735 pglob->gl_pathv = pathv;
746 pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
748 pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
750 if ((pglob->gl_flags & GLOB_LIMIT) &&
814 globfree(pglob) in globfree() argument
815 glob_t *pglob; in globfree()
820 if (pglob->gl_pathv != NULL) {
821 pp = pglob->gl_pathv + pglob->gl_offs;
822 for (i = pglob->gl_pathc; i--; ++pp)
825 free(pglob->gl_pathv);
826 pglob->gl_pathv = NULL;
831 g_opendir(str, pglob) in g_opendir() argument
833 glob_t *pglob;
844 if (pglob->gl_flags & GLOB_ALTDIRFUNC)
845 return((*pglob->gl_opendir)(buf));
851 g_lstat(fn, sb, pglob) in g_lstat() argument
854 glob_t *pglob;
860 if (pglob->gl_flags & GLOB_ALTDIRFUNC)
861 return((*pglob->gl_lstat)(buf, sb));
866 g_stat(fn, sb, pglob) in g_stat() argument
869 glob_t *pglob;
875 if (pglob->gl_flags & GLOB_ALTDIRFUNC)
876 return((*pglob->gl_stat)(buf, sb));