version 1.28, 2011/01/21 23:30:31 |
version 1.31.8.1, 2013/02/25 00:27:50 |
Line 180 static void qprintf(const char *, Char |
|
Line 180 static void qprintf(const char *, Char |
|
#endif |
#endif |
|
|
int |
int |
glob(const char *pattern, int flags, int (*errfunc)(const char *, int), |
glob(const char * __restrict pattern, int flags, int (*errfunc)(const char *, |
glob_t *pglob) |
int), glob_t * __restrict pglob) |
{ |
{ |
const u_char *patnext; |
const u_char *patnext; |
int c; |
int c; |
Line 612 glob2(Char *pathbuf, Char *pathend, Char |
|
Line 612 glob2(Char *pathbuf, Char *pathend, Char |
|
const Char *p; |
const Char *p; |
Char *q; |
Char *q; |
int anymeta; |
int anymeta; |
Char *pend; |
|
ptrdiff_t diff; |
|
|
|
_DIAGASSERT(pathbuf != NULL); |
_DIAGASSERT(pathbuf != NULL); |
_DIAGASSERT(pathend != NULL); |
_DIAGASSERT(pathend != NULL); |
Line 638 glob2(Char *pathbuf, Char *pathend, Char |
|
Line 636 glob2(Char *pathbuf, Char *pathend, Char |
|
errno = 0; |
errno = 0; |
*pathend++ = SEP; |
*pathend++ = SEP; |
*pathend = EOS; |
*pathend = EOS; |
printf("stat limit\n"); |
|
return GLOB_NOSPACE; |
return GLOB_NOSPACE; |
} |
} |
if (((pglob->gl_flags & GLOB_MARK) && |
if (((pglob->gl_flags & GLOB_MARK) && |
Line 666 printf("stat limit\n"); |
|
Line 663 printf("stat limit\n"); |
|
*q++ = *p++; |
*q++ = *p++; |
} |
} |
|
|
/* |
if (!anymeta) { |
* No expansion, or path ends in slash-dot shash-dot-dot, |
|
* do next segment. |
|
*/ |
|
if (pglob->gl_flags & GLOB_PERIOD) { |
|
for (pend = pathend; pend > pathbuf && pend[-1] == '/'; |
|
pend--) |
|
continue; |
|
diff = pend - pathbuf; |
|
} else { |
|
/* XXX: GCC */ |
|
diff = 0; |
|
pend = pathend; |
|
} |
|
|
|
if ((!anymeta) || |
|
((pglob->gl_flags & GLOB_PERIOD) && |
|
(diff >= 1 && pend[-1] == DOT) && |
|
(diff >= 2 && (pend[-2] == SLASH || pend[-2] == DOT)) && |
|
(diff < 3 || pend[-3] == SLASH))) { |
|
pathend = q; |
pathend = q; |
pattern = p; |
pattern = p; |
while (*pattern == SEP) { |
while (*pattern == SEP) { |
Line 790 glob3(Char *pathbuf, Char *pathend, Char |
|
Line 768 glob3(Char *pathbuf, Char *pathend, Char |
|
if (pglob->gl_flags & GLOB_ALTDIRFUNC) |
if (pglob->gl_flags & GLOB_ALTDIRFUNC) |
readdirfunc = pglob->gl_readdir; |
readdirfunc = pglob->gl_readdir; |
else |
else |
readdirfunc = (struct dirent *(*)__P((void *))) readdir; |
readdirfunc = (struct dirent *(*)(void *)) readdir; |
while ((dp = (*readdirfunc)(dirp)) != NULL) { |
while ((dp = (*readdirfunc)(dirp)) != NULL) { |
u_char *sc; |
u_char *sc; |
Char *dc; |
Char *dc; |
Line 800 glob3(Char *pathbuf, Char *pathend, Char |
|
Line 778 glob3(Char *pathbuf, Char *pathend, Char |
|
errno = 0; |
errno = 0; |
*pathend++ = SEP; |
*pathend++ = SEP; |
*pathend = EOS; |
*pathend = EOS; |
return GLOB_NOSPACE; |
error = GLOB_NOSPACE; |
|
break; |
} |
} |
|
|
/* |
/* |