|
Lines 156-162
static int globextend(const Char *, glob_t *, size_t *);
Link Here
|
| 156 |
static const Char * |
156 |
static const Char * |
| 157 |
globtilde(const Char *, Char *, size_t, glob_t *); |
157 |
globtilde(const Char *, Char *, size_t, glob_t *); |
| 158 |
static int globexp1(const Char *, glob_t *, size_t *); |
158 |
static int globexp1(const Char *, glob_t *, size_t *); |
| 159 |
static int globexp2(const Char *, const Char *, glob_t *, int *, size_t *); |
159 |
static int globexp2(const Char *, const Char *, glob_t *, size_t *); |
| 160 |
static int match(Char *, Char *, Char *); |
160 |
static int match(Char *, Char *, Char *); |
| 161 |
#ifdef DEBUG |
161 |
#ifdef DEBUG |
| 162 |
static void qprintf(const char *, Char *); |
162 |
static void qprintf(const char *, Char *); |
|
Lines 240-254
static int
Link Here
|
| 240 |
globexp1(const Char *pattern, glob_t *pglob, size_t *limit) |
240 |
globexp1(const Char *pattern, glob_t *pglob, size_t *limit) |
| 241 |
{ |
241 |
{ |
| 242 |
const Char* ptr = pattern; |
242 |
const Char* ptr = pattern; |
| 243 |
int rv; |
|
|
| 244 |
|
243 |
|
| 245 |
/* Protect a single {}, for find(1), like csh */ |
244 |
/* Protect a single {}, for find(1), like csh */ |
| 246 |
if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS) |
245 |
if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS) |
| 247 |
return glob0(pattern, pglob, limit); |
246 |
return glob0(pattern, pglob, limit); |
| 248 |
|
247 |
|
| 249 |
while ((ptr = g_strchr(ptr, LBRACE)) != NULL) |
248 |
if ((ptr = g_strchr(ptr, LBRACE)) != NULL) |
| 250 |
if (!globexp2(ptr, pattern, pglob, &rv, limit)) |
249 |
return globexp2(ptr, pattern, pglob, limit) |
| 251 |
return rv; |
|
|
| 252 |
|
250 |
|
| 253 |
return glob0(pattern, pglob, limit); |
251 |
return glob0(pattern, pglob, limit); |
| 254 |
} |
252 |
} |
|
Lines 260-268
globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
Link Here
|
| 260 |
* If it fails then it tries to glob the rest of the pattern and returns. |
258 |
* If it fails then it tries to glob the rest of the pattern and returns. |
| 261 |
*/ |
259 |
*/ |
| 262 |
static int |
260 |
static int |
| 263 |
globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *limit) |
261 |
globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, size_t *limit) |
| 264 |
{ |
262 |
{ |
| 265 |
int i; |
263 |
int i; |
|
|
264 |
int rv; |
| 266 |
Char *lm, *ls; |
265 |
Char *lm, *ls; |
| 267 |
const Char *pe, *pm, *pm1, *pl; |
266 |
const Char *pe, *pm, *pm1, *pl; |
| 268 |
Char patbuf[MAXPATHLEN]; |
267 |
Char patbuf[MAXPATHLEN]; |
|
Lines 297-304
globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *l
Link Here
|
| 297 |
|
296 |
|
| 298 |
/* Non matching braces; just glob the pattern */ |
297 |
/* Non matching braces; just glob the pattern */ |
| 299 |
if (i != 0 || *pe == EOS) { |
298 |
if (i != 0 || *pe == EOS) { |
| 300 |
*rv = glob0(patbuf, pglob, limit); |
299 |
return glob0(patbuf, pglob, limit); |
| 301 |
return 0; |
|
|
| 302 |
} |
300 |
} |
| 303 |
|
301 |
|
| 304 |
for (i = 0, pl = pm = ptr; pm <= pe; pm++) |
302 |
for (i = 0, pl = pm = ptr; pm <= pe; pm++) |
|
Lines 344-350
globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *l
Link Here
|
| 344 |
#ifdef DEBUG |
342 |
#ifdef DEBUG |
| 345 |
qprintf("globexp2:", patbuf); |
343 |
qprintf("globexp2:", patbuf); |
| 346 |
#endif |
344 |
#endif |
| 347 |
*rv = globexp1(patbuf, pglob, limit); |
345 |
rv = globexp1(patbuf, pglob, limit); |
|
|
346 |
if (rv && rv != GLOB_NOMATCH) /* if errors occured */ |
| 347 |
return rv; |
| 348 |
|
348 |
|
| 349 |
/* move after the comma, to the next string */ |
349 |
/* move after the comma, to the next string */ |
| 350 |
pl = pm + 1; |
350 |
pl = pm + 1; |
|
Lines 354-360
globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *l
Link Here
|
| 354 |
default: |
354 |
default: |
| 355 |
break; |
355 |
break; |
| 356 |
} |
356 |
} |
| 357 |
*rv = 0; |
|
|
| 358 |
return 0; |
357 |
return 0; |
| 359 |
} |
358 |
} |