version 1.42, 2020/07/05 23:59:45 |
version 1.43, 2020/11/03 22:53:12 |
|
|
* Returns true if the given string matches the pattern (which may contain ? |
* Returns true if the given string matches the pattern (which may contain ? |
* and * as wildcards), and zero if it does not match. |
* and * as wildcards), and zero if it does not match. |
*/ |
*/ |
|
|
int |
int |
match_pattern(const char *s, const char *pattern) |
match_pattern(const char *s, const char *pattern) |
{ |
{ |
|
|
return !*s; |
return !*s; |
|
|
if (*pattern == '*') { |
if (*pattern == '*') { |
/* Skip the asterisk. */ |
/* Skip this and any consecutive asterisks. */ |
pattern++; |
while (*pattern == '*') |
|
pattern++; |
|
|
/* If at end of pattern, accept immediately. */ |
/* If at end of pattern, accept immediately. */ |
if (!*pattern) |
if (!*pattern) |