3 /* copied from IRCU 2.10.12 match.c */
5 * Compare if a given string (name) matches the given
6 * mask (which can contain wild cards: '*' - match any
7 * number of chars, '?' - match any single character.
12 * Originally by Douglas A Lewis (dalewis@acsu.buffalo.edu)
13 * Rewritten by Timothy Vogelsang (netski), net@astrolink.org
15 int match(const char *mask, const char *name)
17 const char *m = mask, *n = name;
18 const char *m_tmp = mask, *n_tmp = name;
21 for (;;) switch (*m) {
35 /* allow escaping to force capitalization */
40 for (star_p = 0; ; m++) {
51 else if (*m == '\\') {
55 for (n_tmp = n; *n && *n != *m; n++) ;
58 for (n_tmp = n; *n && tolower(*n) != tolower(*m); n++) ;
61 /* and fall through */
65 if (tolower(*m) != tolower(*n))