@@ -52,7 +52,7 @@ typedef unsigned char uchar;
5252#define ISXDIGIT (c ) (ISASCII(c) && isxdigit(c))
5353
5454/* Match pattern "p" against "text" */
55- static int dowild (const uchar * p , const uchar * text , int force_lower_case )
55+ static int dowild (const uchar * p , const uchar * text , unsigned int flags )
5656{
5757 uchar p_ch ;
5858 const uchar * pattern = p ;
@@ -62,9 +62,9 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
6262 uchar t_ch , prev_ch ;
6363 if ((t_ch = * text ) == '\0' && p_ch != '*' )
6464 return WM_ABORT_ALL ;
65- if (force_lower_case && ISUPPER (t_ch ))
65+ if (( flags & WM_CASEFOLD ) && ISUPPER (t_ch ))
6666 t_ch = tolower (t_ch );
67- if (force_lower_case && ISUPPER (p_ch ))
67+ if (( flags & WM_CASEFOLD ) && ISUPPER (p_ch ))
6868 p_ch = tolower (p_ch );
6969 switch (p_ch ) {
7070 case '\\' :
@@ -98,7 +98,7 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
9898 * both foo/bar and foo/a/bar.
9999 */
100100 if (p [0 ] == '/' &&
101- dowild (p + 1 , text , force_lower_case ) == WM_MATCH )
101+ dowild (p + 1 , text , flags ) == WM_MATCH )
102102 return WM_MATCH ;
103103 match_slash = 1 ;
104104 } else
@@ -117,7 +117,7 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
117117 while (1 ) {
118118 if (t_ch == '\0' )
119119 break ;
120- if ((matched = dowild (p , text , force_lower_case )) != WM_NOMATCH ) {
120+ if ((matched = dowild (p , text , flags )) != WM_NOMATCH ) {
121121 if (!match_slash || matched != WM_ABORT_TO_STARSTAR )
122122 return matched ;
123123 } else if (!match_slash && t_ch == '/' )
@@ -228,6 +228,5 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
228228int wildmatch (const char * pattern , const char * text ,
229229 unsigned int flags , struct wildopts * wo )
230230{
231- return dowild ((const uchar * )pattern , (const uchar * )text ,
232- flags & WM_CASEFOLD ? 1 :0 );
231+ return dowild ((const uchar * )pattern , (const uchar * )text , flags );
233232}
0 commit comments