diff options
Diffstat (limited to 'openbsd-compat/bsd-cygwin_util.c')
-rw-r--r-- | openbsd-compat/bsd-cygwin_util.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/openbsd-compat/bsd-cygwin_util.c b/openbsd-compat/bsd-cygwin_util.c index f721fca9d..1e4cdc928 100644 --- a/openbsd-compat/bsd-cygwin_util.c +++ b/openbsd-compat/bsd-cygwin_util.c | |||
@@ -128,7 +128,7 @@ free_windows_environment(char **p) | |||
128 | */ | 128 | */ |
129 | 129 | ||
130 | static int | 130 | static int |
131 | __match_pattern (const wchar_t *s, const wchar_t *pattern, int caseinsensitive) | 131 | __match_pattern (const wchar_t *s, const wchar_t *pattern) |
132 | { | 132 | { |
133 | for (;;) { | 133 | for (;;) { |
134 | /* If at end of pattern, accept if also at end of string. */ | 134 | /* If at end of pattern, accept if also at end of string. */ |
@@ -152,8 +152,7 @@ __match_pattern (const wchar_t *s, const wchar_t *pattern, int caseinsensitive) | |||
152 | */ | 152 | */ |
153 | for (; *s; s++) | 153 | for (; *s; s++) |
154 | if (*s == *pattern && | 154 | if (*s == *pattern && |
155 | __match_pattern(s + 1, pattern + 1, | 155 | __match_pattern(s + 1, pattern + 1)) |
156 | caseinsensitive)) | ||
157 | return 1; | 156 | return 1; |
158 | /* Failed. */ | 157 | /* Failed. */ |
159 | return 0; | 158 | return 0; |
@@ -163,7 +162,7 @@ __match_pattern (const wchar_t *s, const wchar_t *pattern, int caseinsensitive) | |||
163 | * match at each position. | 162 | * match at each position. |
164 | */ | 163 | */ |
165 | for (; *s; s++) | 164 | for (; *s; s++) |
166 | if (__match_pattern(s, pattern, caseinsensitive)) | 165 | if (__match_pattern(s, pattern)) |
167 | return 1; | 166 | return 1; |
168 | /* Failed. */ | 167 | /* Failed. */ |
169 | return 0; | 168 | return 0; |
@@ -176,8 +175,7 @@ __match_pattern (const wchar_t *s, const wchar_t *pattern, int caseinsensitive) | |||
176 | return 0; | 175 | return 0; |
177 | 176 | ||
178 | /* Check if the next character of the string is acceptable. */ | 177 | /* Check if the next character of the string is acceptable. */ |
179 | if (*pattern != '?' && (*pattern != *s && | 178 | if (*pattern != '?' && towlower(*pattern) != towlower(*s)) |
180 | (!caseinsensitive || towlower(*pattern) != towlower(*s)))) | ||
181 | return 0; | 179 | return 0; |
182 | 180 | ||
183 | /* Move to the next character, both in string and in pattern. */ | 181 | /* Move to the next character, both in string and in pattern. */ |
@@ -188,7 +186,7 @@ __match_pattern (const wchar_t *s, const wchar_t *pattern, int caseinsensitive) | |||
188 | } | 186 | } |
189 | 187 | ||
190 | static int | 188 | static int |
191 | _match_pattern(const char *s, const char *pattern, int caseinsensitive) | 189 | _match_pattern(const char *s, const char *pattern) |
192 | { | 190 | { |
193 | wchar_t *ws; | 191 | wchar_t *ws; |
194 | wchar_t *wpattern; | 192 | wchar_t *wpattern; |
@@ -202,7 +200,7 @@ _match_pattern(const char *s, const char *pattern, int caseinsensitive) | |||
202 | return 0; | 200 | return 0; |
203 | wpattern = (wchar_t *) alloca((len + 1) * sizeof (wchar_t)); | 201 | wpattern = (wchar_t *) alloca((len + 1) * sizeof (wchar_t)); |
204 | mbstowcs(wpattern, pattern, len + 1); | 202 | mbstowcs(wpattern, pattern, len + 1); |
205 | return __match_pattern (ws, wpattern, caseinsensitive); | 203 | return __match_pattern (ws, wpattern); |
206 | } | 204 | } |
207 | 205 | ||
208 | /* | 206 | /* |
@@ -212,7 +210,7 @@ _match_pattern(const char *s, const char *pattern, int caseinsensitive) | |||
212 | * a positive match, 0 if there is no match at all. | 210 | * a positive match, 0 if there is no match at all. |
213 | */ | 211 | */ |
214 | int | 212 | int |
215 | match_pattern_list(const char *string, const char *pattern, int caseinsensitive) | 213 | cygwin_ug_match_pattern_list(const char *string, const char *pattern) |
216 | { | 214 | { |
217 | char sub[1024]; | 215 | char sub[1024]; |
218 | int negated; | 216 | int negated; |
@@ -248,7 +246,7 @@ match_pattern_list(const char *string, const char *pattern, int caseinsensitive) | |||
248 | sub[subi] = '\0'; | 246 | sub[subi] = '\0'; |
249 | 247 | ||
250 | /* Try to match the subpattern against the string. */ | 248 | /* Try to match the subpattern against the string. */ |
251 | if (_match_pattern(string, sub, caseinsensitive)) { | 249 | if (_match_pattern(string, sub)) { |
252 | if (negated) | 250 | if (negated) |
253 | return -1; /* Negative */ | 251 | return -1; /* Negative */ |
254 | else | 252 | else |