2 // Copyright (c) 1997, 1998 Etienne BERNARD
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
33 Mask::matches(String s) const
35 return match((const char *)mask, (const char *)s);
39 Mask::matches(const Mask & m) const
41 return match((const char *)mask, (const char *)m.mask);
45 Mask::match(const char * m, const char * n) const
57 while (*m && (m[0] == '*' || m[0] == '?'))
64 while ((c = strchr(c, *m)) != 0) {
71 if ((std::tolower (m[0]) == std::tolower (n[0])) ||
73 ((m[0] == '\\') && ((m[1] == '?' && n[0] == '?') ||
74 (m[1] == '*' && n[0] == '*'))))
75 return match(++m, ++n);