Fixes for corner cases (thanks, Bradley!)

This commit is contained in:
Ryan C. Gordon 2003-06-11 09:05:47 +00:00
parent adc1f9a434
commit 33be461bcb
1 changed files with 8 additions and 2 deletions

View File

@ -39,7 +39,11 @@ static int matchesPattern(const char *fname, const char *wildcard,
y = *wildptr;
if (y == '*')
{
wildptr++;
do
{
wildptr++; /* skip multiple '*' in a row... */
} while (*wildptr == '*');
y = (caseSensitive) ? *wildptr : (char) tolower(*wildptr);
while (1)
@ -74,9 +78,11 @@ static int matchesPattern(const char *fname, const char *wildcard,
if (x != y)
return(0);
} /* else */
} /* while */
while (*wildptr == '*')
wildptr++;
return(*fnameptr == *wildptr);
} /* matchesPattern */