Lines Matching +full:dc +full:- +full:current +full:- +full:limit
34 * glob(3) -- a superset of the one defined in POSIX 1003.2.
55 * Number of matches in the current invocation of glob.
102 #define CHAR_RANGE '-'
140 #define M_RNG META('-')
179 pglob->gl_pathc = 0; in glob()
180 pglob->gl_pathv = NULL; in glob()
182 pglob->gl_offs = 0; in glob()
184 pglob->gl_flags = flags & ~GLOB_MAGCHAR; in glob()
185 pglob->gl_errfunc = errfunc; in glob()
186 pglob->gl_matchc = 0; in glob()
196 --patnext; in glob()
273 i--; in globexp2()
303 i--; in globexp2()
311 /* Append the current string */ in globexp2()
321 /* Expand the current pattern */ in globexp2()
352 if (*pattern != CHAR_TILDE || !(pglob->gl_flags & GLOB_TILDE)) in globtilde()
371 h = pwd->pw_dir; in globtilde()
381 h = pwd->pw_dir; in globtilde()
409 size_t limit = 0; in glob0() local
412 oldpathc = pglob->gl_pathc; in glob0()
426 --qpatnext; in glob0()
442 pglob->gl_flags |= GLOB_MAGCHAR; in glob0()
446 pglob->gl_flags |= GLOB_MAGCHAR; in glob0()
450 pglob->gl_flags |= GLOB_MAGCHAR; in glob0()
454 if (bufnext == patbuf || bufnext[-1] != M_ALL) in glob0()
467 if ((err = glob1(patbuf, pglob, &limit)) != 0) in glob0()
476 if (pglob->gl_pathc == oldpathc && in glob0()
477 ((pglob->gl_flags & GLOB_NOCHECK) || in glob0()
478 ((pglob->gl_flags & GLOB_NOMAGIC) && in glob0()
479 !(pglob->gl_flags & GLOB_MAGCHAR)))) in glob0()
480 return(globextend(pattern, pglob, &limit)); in glob0()
481 else if (!(pglob->gl_flags & GLOB_NOSORT)) in glob0()
482 qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, in glob0()
483 pglob->gl_pathc - oldpathc, sizeof(char *), compare); in glob0()
494 glob1(Char *pattern, glob_t *pglob, size_t *limit) in glob1() argument
498 /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */ in glob1()
501 return(glob2(pathbuf, pathbuf, pattern, pglob, limit)); in glob1()
520 size_t *limit) in glob2() argument
536 if (((pglob->gl_flags & GLOB_MARK) && in glob2()
537 pathend[-1] != CHAR_SEP) && (S_ISDIR(sb.st_mode) in glob2()
544 ++pglob->gl_matchc; in glob2()
545 return(globextend(pathbuf, pglob, limit)); in glob2()
564 limit)); in glob2()
571 glob_t *pglob, size_t *limit) in glob3() argument
591 if (pglob->gl_errfunc) { in glob3()
593 if (pglob->gl_errfunc(buf, errno) || in glob3()
594 pglob->gl_flags & GLOB_ERR) in glob3()
603 if (pglob->gl_flags & GLOB_ALTDIRFUNC) in glob3()
604 readdirfunc = pglob->gl_readdir; in glob3()
609 Char *dc; in glob3() local
612 if (dp->d_name[0] == CHAR_DOT && *pattern != CHAR_DOT) in glob3()
614 for (sc = (u_char *) dp->d_name, dc = pathend; in glob3()
615 (*dc++ = *sc++) != CHAR_EOS;) in glob3()
621 err = glob2(pathbuf, --dc, restpattern, pglob, limit); in glob3()
626 if (pglob->gl_flags & GLOB_ALTDIRFUNC) in glob3()
627 (*pglob->gl_closedir)(dirp); in glob3()
639 * crosses a power-of-two boundary; for v7 realloc, this would cause quadratic
649 globextend(const Char *path, glob_t *pglob, size_t *limit) in globextend() argument
657 newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs); in globextend()
658 pathv = pglob->gl_pathv ? in globextend()
659 realloc(pglob->gl_pathv, newsize) : in globextend()
664 if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) { in globextend()
665 /* first time around -- clear initial gl_offs items */ in globextend()
666 pathv += pglob->gl_offs; in globextend()
667 for (i = pglob->gl_offs; --i >= 0; ) in globextend()
668 *--pathv = NULL; in globextend()
670 pglob->gl_pathv = pathv; in globextend()
674 len = (size_t)(p - path); in globextend()
675 *limit += len; in globextend()
678 pathv[pglob->gl_offs + pglob->gl_pathc++] = copy; in globextend()
680 pathv[pglob->gl_offs + pglob->gl_pathc] = NULL; in globextend()
682 if ((pglob->gl_flags & GLOB_LIMIT) && (newsize + *limit) >= ARG_MAX) { in globextend()
748 if (pglob->gl_pathv != NULL) { in globfree()
749 pp = pglob->gl_pathv + pglob->gl_offs; in globfree()
750 for (i = pglob->gl_pathc; i--; ++pp) in globfree()
753 free(pglob->gl_pathv); in globfree()
754 pglob->gl_pathv = NULL; in globfree()
768 if (pglob->gl_flags & GLOB_ALTDIRFUNC) in g_opendir()
769 return((*pglob->gl_opendir)(buf)); in g_opendir()
780 if (pglob->gl_flags & GLOB_ALTDIRFUNC) in g_lstat()
781 return((*pglob->gl_lstat)(buf, sb)); in g_lstat()
791 if (pglob->gl_flags & GLOB_ALTDIRFUNC) in g_stat()
792 return((*pglob->gl_stat)(buf, sb)); in g_stat()
814 --dst; in g_strcat()
825 char *dc; in g_Ctoc() local
827 for (dc = buf; (*dc++ = *str++) != CHAR_EOS;) in g_Ctoc()