Lines Matching refs:pglob

160 PHPAPI int glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)  in glob()  argument
175 pglob->gl_pathc = 0; in glob()
176 pglob->gl_pathv = NULL; in glob()
178 pglob->gl_offs = 0; in glob()
180 pglob->gl_flags = flags & ~GLOB_MAGCHAR; in glob()
181 pglob->gl_errfunc = errfunc; in glob()
182 pglob->gl_matchc = 0; in glob()
204 return globexp1(patbuf, pglob); in glob()
206 return glob0(patbuf, pglob); in glob()
214 static int globexp1(const Char *pattern,glob_t *pglob) in globexp1() argument
221 return glob0(pattern, pglob); in globexp1()
224 if (!globexp2(ptr, pattern, pglob, &rv)) in globexp1()
227 return glob0(pattern, pglob); in globexp1()
236 static int globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv) in globexp2() argument
272 *rv = glob0(patbuf, pglob); in globexp2()
322 *rv = globexp1(patbuf, pglob); in globexp2()
342 static const Char *globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob) in globtilde() argument
351 if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE)) in globtilde()
416 static int glob0( const Char *pattern, glob_t *pglob) in glob0() argument
423 qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob); in glob0()
424 oldpathc = pglob->gl_pathc; in glob0()
454 pglob->gl_flags |= GLOB_MAGCHAR; in glob0()
458 pglob->gl_flags |= GLOB_MAGCHAR; in glob0()
462 pglob->gl_flags |= GLOB_MAGCHAR; in glob0()
479 if ((err = glob1(patbuf, patbuf+MAXPATHLEN-1, pglob, &limit)) != 0) in glob0()
488 if (pglob->gl_pathc == oldpathc) { in glob0()
489 if ((pglob->gl_flags & GLOB_NOCHECK) || in glob0()
490 ((pglob->gl_flags & GLOB_NOMAGIC) && in glob0()
491 !(pglob->gl_flags & GLOB_MAGCHAR))) in glob0()
492 return(globextend(pattern, pglob, &limit)); in glob0()
496 if (!(pglob->gl_flags & GLOB_NOSORT)) in glob0()
497 qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, in glob0()
498 pglob->gl_pathc - oldpathc, sizeof(char *), compare); in glob0()
508 glob1(pattern, pattern_last, pglob, limitp) in glob1() argument
510 glob_t *pglob;
520 pattern, pattern_last, pglob, limitp));
529 Char *pattern_last, glob_t *pglob, size_t *limitp) in glob2() argument
542 if (g_lstat(pathbuf, &sb, pglob)) in glob2()
545 if (((pglob->gl_flags & GLOB_MARK) && in glob2()
548 (g_stat(pathbuf, &sb, pglob) == 0) && in glob2()
555 ++pglob->gl_matchc; in glob2()
556 return(globextend(pathbuf, pglob, limitp)); in glob2()
582 p, pattern_last, pglob, limitp)); in glob2()
588 Char *restpattern, Char *restpattern_last, glob_t *pglob, size_t *limitp) in glob3() argument
607 if ((dirp = g_opendir(pathbuf, pglob)) == NULL) { in glob3()
609 if (pglob->gl_errfunc) { in glob3()
613 if (pglob->gl_errfunc(buf, errno) || in glob3()
614 pglob->gl_flags & GLOB_ERR) in glob3()
623 if (pglob->gl_flags & GLOB_ALTDIRFUNC) in glob3()
624 readdirfunc = pglob->gl_readdir; in glob3()
649 restpattern, restpattern_last, pglob, limitp); in glob3()
654 if (pglob->gl_flags & GLOB_ALTDIRFUNC) in glob3()
655 (*pglob->gl_closedir)(dirp); in glob3()
676 static int globextend(const Char *path, glob_t *pglob, size_t *limitp) in globextend() argument
683 newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs); in globextend()
684 pathv = pglob->gl_pathv ? realloc((char *)pglob->gl_pathv, newsize) : in globextend()
687 if (pglob->gl_pathv) { in globextend()
688 free(pglob->gl_pathv); in globextend()
689 pglob->gl_pathv = NULL; in globextend()
694 if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) { in globextend()
697 pathv += pglob->gl_offs; in globextend()
698 for (i = pglob->gl_offs; --i >= 0; ) in globextend()
701 pglob->gl_pathv = pathv; in globextend()
712 pathv[pglob->gl_offs + pglob->gl_pathc++] = copy; in globextend()
714 pathv[pglob->gl_offs + pglob->gl_pathc] = NULL; in globextend()
716 if ((pglob->gl_flags & GLOB_LIMIT) && in globextend()
777 PHPAPI void globfree(glob_t *pglob) in globfree() argument
782 if (pglob->gl_pathv != NULL) { in globfree()
783 pp = pglob->gl_pathv + pglob->gl_offs; in globfree()
784 for (i = pglob->gl_pathc; i--; ++pp) in globfree()
787 free(pglob->gl_pathv); in globfree()
788 pglob->gl_pathv = NULL; in globfree()
792 static DIR * g_opendir(Char *str, glob_t *pglob) in g_opendir() argument
803 if (pglob->gl_flags & GLOB_ALTDIRFUNC) in g_opendir()
804 return((*pglob->gl_opendir)(buf)); in g_opendir()
809 static int g_lstat(Char *fn, zend_stat_t *sb, glob_t *pglob) in g_lstat() argument
815 if (pglob->gl_flags & GLOB_ALTDIRFUNC) in g_lstat()
816 return((*pglob->gl_lstat)(buf, sb)); in g_lstat()
820 static int g_stat(Char *fn, zend_stat_t *sb, glob_t *pglob) in g_stat() argument
826 if (pglob->gl_flags & GLOB_ALTDIRFUNC) in g_stat()
827 return((*pglob->gl_stat)(buf, sb)); in g_stat()