@@ -52,7 +52,7 @@ typedef unsigned char uchar;
52
52
#define ISXDIGIT (c ) (ISASCII(c) && isxdigit(c))
53
53
54
54
/* 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 )
56
56
{
57
57
uchar p_ch ;
58
58
const uchar * pattern = p ;
@@ -62,9 +62,9 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
62
62
uchar t_ch , prev_ch ;
63
63
if ((t_ch = * text ) == '\0' && p_ch != '*' )
64
64
return WM_ABORT_ALL ;
65
- if (force_lower_case && ISUPPER (t_ch ))
65
+ if (( flags & WM_CASEFOLD ) && ISUPPER (t_ch ))
66
66
t_ch = tolower (t_ch );
67
- if (force_lower_case && ISUPPER (p_ch ))
67
+ if (( flags & WM_CASEFOLD ) && ISUPPER (p_ch ))
68
68
p_ch = tolower (p_ch );
69
69
switch (p_ch ) {
70
70
case '\\' :
@@ -98,7 +98,7 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
98
98
* both foo/bar and foo/a/bar.
99
99
*/
100
100
if (p [0 ] == '/' &&
101
- dowild (p + 1 , text , force_lower_case ) == WM_MATCH )
101
+ dowild (p + 1 , text , flags ) == WM_MATCH )
102
102
return WM_MATCH ;
103
103
match_slash = 1 ;
104
104
} else
@@ -117,7 +117,7 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
117
117
while (1 ) {
118
118
if (t_ch == '\0' )
119
119
break ;
120
- if ((matched = dowild (p , text , force_lower_case )) != WM_NOMATCH ) {
120
+ if ((matched = dowild (p , text , flags )) != WM_NOMATCH ) {
121
121
if (!match_slash || matched != WM_ABORT_TO_STARSTAR )
122
122
return matched ;
123
123
} else if (!match_slash && t_ch == '/' )
@@ -228,6 +228,5 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
228
228
int wildmatch (const char * pattern , const char * text ,
229
229
unsigned int flags , struct wildopts * wo )
230
230
{
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 );
233
232
}
0 commit comments