• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/lib/libc/gen/

Lines Matching refs:pglob

188 	 int (*errfunc)(const char *, int), glob_t * __restrict pglob)
200 pglob->gl_pathc = 0;
201 pglob->gl_pathv = NULL;
203 pglob->gl_offs = 0;
206 limit.l_path_lim = pglob->gl_matchc;
210 pglob->gl_flags = flags & ~GLOB_MAGCHAR;
211 pglob->gl_errfunc = errfunc;
212 pglob->gl_matchc = 0;
222 return (err_nomatch(pglob, &limit, pattern));
244 return (err_nomatch(pglob, &limit, pattern));
254 return (err_nomatch(pglob, &limit, pattern));
258 return (globexp0(patbuf, pglob, &limit, pattern));
260 return (glob0(patbuf, pglob, &limit, pattern));
264 globexp0(const Char *pattern, glob_t *pglob, struct glob_limit *limit,
271 if ((pglob->gl_flags & GLOB_LIMIT) &&
276 return (glob0(pattern, pglob, limit, origpat));
279 oldpathc = pglob->gl_pathc;
281 if ((rv = globexp1(pattern, pglob, limit)) != 0)
284 return (globfinal(pglob, limit, oldpathc, origpat));
293 globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
298 if ((pglob->gl_flags & GLOB_LIMIT) &&
303 return (globexp2(ptr, pattern, pglob, limit));
306 return (glob0(pattern, pglob, limit, NULL));
316 globexp2(const Char *ptr, const Char *pattern, glob_t *pglob,
354 return (glob0(pattern, pglob, limit, NULL));
399 rv = globexp1(patbuf, pglob, limit);
420 globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
433 if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
532 glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit,
539 qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob);
544 oldpathc = pglob->gl_pathc;
574 pglob->gl_flags |= GLOB_MAGCHAR;
578 pglob->gl_flags |= GLOB_MAGCHAR;
582 pglob->gl_flags |= GLOB_MAGCHAR;
600 if ((err = glob1(patbuf, pglob, limit)) != 0)
604 return (globfinal(pglob, limit, oldpathc, origpat));
610 globfinal(glob_t *pglob, struct glob_limit *limit, size_t oldpathc,
612 if (pglob->gl_pathc == oldpathc)
613 return (err_nomatch(pglob, limit, origpat));
615 if (!(pglob->gl_flags & GLOB_NOSORT))
616 qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
617 pglob->gl_pathc - oldpathc, sizeof(char *), compare);
629 glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit)
637 pattern, pglob, limit));
647 glob_t *pglob, struct glob_limit *limit)
660 if (g_lstat(pathbuf, &sb, pglob))
663 if ((pglob->gl_flags & GLOB_LIMIT) &&
668 if ((pglob->gl_flags & GLOB_MARK) &&
672 g_stat(pathbuf, &sb, pglob) == 0 &&
681 ++pglob->gl_matchc;
682 return (globextend(pathbuf, pglob, limit, NULL));
710 p, pglob, limit));
718 glob_t *pglob, struct glob_limit *limit)
732 if (pglob->gl_errfunc != NULL &&
740 if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
743 err = err_aborted(pglob, errno, buf);
751 /* pglob->gl_readdir takes a void *, fix this manually */
752 if (pglob->gl_flags & GLOB_ALTDIRFUNC)
753 readdirfunc = (struct dirent *(*)(DIR *))pglob->gl_readdir;
766 if ((pglob->gl_flags & GLOB_LIMIT) &&
796 if (too_long && (err = err_aborted(pglob, ENAMETOOLONG,
809 pglob, limit);
816 if (pglob->gl_flags & GLOB_ALTDIRFUNC)
817 (*pglob->gl_closedir)(dirp);
826 (err = err_aborted(pglob, errno, buf)))
850 globextend(const Char *path, glob_t *pglob, struct glob_limit *limit,
858 if ((pglob->gl_flags & GLOB_LIMIT) &&
859 pglob->gl_matchc > limit->l_path_lim) {
864 newn = 2 + pglob->gl_pathc + pglob->gl_offs;
866 pathv = reallocarray(pglob->gl_pathv, newn, sizeof(*pathv));
870 if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
872 pathv += pglob->gl_offs;
873 for (i = pglob->gl_offs + 1; --i > 0; )
876 pglob->gl_pathv = pathv;
894 if ((pglob->gl_flags & GLOB_LIMIT) &&
900 pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
902 pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
979 globfree(glob_t *pglob)
984 if (pglob->gl_pathv != NULL) {
985 pp = pglob->gl_pathv + pglob->gl_offs;
986 for (i = pglob->gl_pathc; i--; ++pp)
989 free(pglob->gl_pathv);
990 pglob->gl_pathv = NULL;
995 g_opendir(Char *str, glob_t *pglob)
1008 if (pglob->gl_flags & GLOB_ALTDIRFUNC)
1009 return ((*pglob->gl_opendir)(buf));
1015 g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
1023 if (pglob->gl_flags & GLOB_ALTDIRFUNC)
1024 return((*pglob->gl_lstat)(buf, sb));
1029 g_stat(Char *fn, struct stat *sb, glob_t *pglob)
1037 if (pglob->gl_flags & GLOB_ALTDIRFUNC)
1038 return ((*pglob->gl_stat)(buf, sb));
1078 err_nomatch(glob_t *pglob, struct glob_limit *limit, const char *origpat) {
1085 if ((pglob->gl_flags & GLOB_NOCHECK) ||
1086 ((pglob->gl_flags & GLOB_NOMAGIC) &&
1087 !(pglob->gl_flags & GLOB_MAGCHAR)))
1088 return (globextend(NULL, pglob, limit, origpat));
1093 err_aborted(glob_t *pglob, int err, char *buf) {
1094 if ((pglob->gl_errfunc != NULL && pglob->gl_errfunc(buf, err)) ||
1095 (pglob->gl_flags & GLOB_ERR))