393 |
/* Search backward starting at the end of the path we just read in, |
/* Search backward starting at the end of the path we just read in, |
394 |
for the character at the end of the last glob-free subpattern |
for the character at the end of the last glob-free subpattern |
395 |
in PATHPART. */ |
in PATHPART. */ |
396 |
if (ignore_case) |
for(prev_fast_match=false; s>=cutoff; s--) |
397 |
{ |
{ |
398 |
for (prev_fast_match = false; s >= cutoff; s--) |
char *s2; /* Scan the path we read in. */ |
399 |
/* Fast first char check. */ |
register char *p2; /* Scan `patend'. */ |
|
if (TOLOWER(*s) == *patend) |
|
|
{ |
|
|
char *s2; /* Scan the path we read in. */ |
|
|
register char *p2; /* Scan `patend'. */ |
|
400 |
|
|
401 |
for (s2 = s - 1, p2 = patend - 1; *p2 != '\0' && TOLOWER(*s2) == *p2; |
/* Fast first char check. */ |
402 |
s2--, p2--) |
if(ignore_case) |
403 |
; |
{ |
404 |
if (*p2 == '\0') |
if(TOLOWER(*s)!=*patend) |
405 |
{ |
continue; |
406 |
/* Success on the fast match. Compare the whole pattern |
} |
407 |
if it contains globbing characters. */ |
else if(*s!=*patend) |
408 |
prev_fast_match = true; |
continue; |
|
if (globflag == false || fnmatch (pathpart, path, FNM_CASEFOLD) == 0) |
|
|
{ |
|
|
if (!check_existence || stat(path, &st) == 0) |
|
|
{ |
|
|
puts (path); |
|
|
++printed; |
|
|
} |
|
|
} |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
else { |
|
|
|
|
|
for (prev_fast_match = false; s >= cutoff; s--) |
|
|
/* Fast first char check. */ |
|
|
if (*s == *patend) |
|
|
{ |
|
|
char *s2; /* Scan the path we read in. */ |
|
|
register char *p2; /* Scan `patend'. */ |
|
409 |
|
|
410 |
for (s2 = s - 1, p2 = patend - 1; *p2 != '\0' && *s2 == *p2; |
if(ignore_case) |
411 |
s2--, p2--) |
for(s2=s-1, p2=patend-1; *p2!='\0' && TOLOWER(*s2)==*p2; s2--, p2--); |
412 |
; |
else |
413 |
if (*p2 == '\0') |
for(s2=s-1, p2=patend-1; *p2!='\0' && *s2==*p2; s2--, p2--); |
414 |
{ |
|
415 |
/* Success on the fast match. Compare the whole pattern |
if(*p2!='\0') |
416 |
if it contains globbing characters. */ |
continue; |
417 |
prev_fast_match = true; |
/* Success on the fast match. Compare the whole pattern |
418 |
if (globflag == false || fnmatch (pathpart, path, |
if it contains globbing characters. */ |
419 |
0) == 0) |
prev_fast_match = true; |
420 |
{ |
if(globflag) |
421 |
if (!check_existence || stat(path, &st) == 0) |
{ |
422 |
{ |
if(ignore_case) |
423 |
puts (path); |
{ |
424 |
++printed; |
if(fnmatch(pathpart,basename(path),FNM_CASEFOLD)!=0) |
425 |
} |
break; |
426 |
} |
} |
427 |
break; |
else |
428 |
} |
if(fnmatch(pathpart,basename(path),0)!=0) |
429 |
} |
break; |
430 |
} |
} |
431 |
|
if(check_existence && stat(path,&st)!=0) |
432 |
|
break; |
433 |
|
puts(path); |
434 |
|
++printed; |
435 |
|
break; |
436 |
|
} |
437 |
} |
} |
438 |
|
|
439 |
if (ferror (fp)) |
if (ferror (fp)) |