extras/globbing.c
changeset 575 3bf69b30fe74
parent 573 01112353ffad
child 576 5da65f8e9a50
equal deleted inserted replaced
574:055e731617ff 575:3bf69b30fe74
    37     while ((*wildptr) && (*fnameptr))
    37     while ((*wildptr) && (*fnameptr))
    38     {
    38     {
    39         y = *wildptr;
    39         y = *wildptr;
    40         if (y == '*')
    40         if (y == '*')
    41         {
    41         {
    42             wildptr++;
    42             do
       
    43             {
       
    44                 wildptr++;  /* skip multiple '*' in a row... */
       
    45             } while (*wildptr == '*');
       
    46 
    43             y = (caseSensitive) ? *wildptr : (char) tolower(*wildptr);
    47             y = (caseSensitive) ? *wildptr : (char) tolower(*wildptr);
    44 
    48 
    45             while (1)
    49             while (1)
    46             {
    50             {
    47                 x = (caseSensitive) ? *fnameptr : (char) tolower(*fnameptr);
    51                 x = (caseSensitive) ? *fnameptr : (char) tolower(*fnameptr);
    72             fnameptr++;
    76             fnameptr++;
    73 
    77 
    74             if (x != y)
    78             if (x != y)
    75                 return(0);
    79                 return(0);
    76         } /* else */
    80         } /* else */
       
    81     } /* while */
    77 
    82 
    78     } /* while */
    83     while (*wildptr == '*')
       
    84         wildptr++;
    79 
    85 
    80     return(*fnameptr == *wildptr);
    86     return(*fnameptr == *wildptr);
    81 } /* matchesPattern */
    87 } /* matchesPattern */
    82 
    88 
    83 
    89