X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fpatmatch.c;h=f03a2deb5d357e3752121221dbe2c4756d084665;hb=e89d1302e7a67e3c46753ec0dd93d13f2d2080de;hp=32e3df1dbcaf7be527f6efcea6b0295a4af68ec1;hpb=03846211ba84582b133a985200502a39462dfe66;p=libucw.git diff --git a/lib/patmatch.c b/lib/patmatch.c index 32e3df1d..f03a2deb 100644 --- a/lib/patmatch.c +++ b/lib/patmatch.c @@ -1,37 +1,15 @@ /* * Sherlock Library -- Shell-Like Pattern Matching (currently only '?' and '*') * - * (c) 1997 Martin Mares, + * (c) 1997 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. */ -#include -#include - -#include "lib.h" +#include "lib/lib.h" -int -match_pattern(byte *p, byte *s) -{ - while (*p) - { - if (*p == '?' && *s) - p++, s++; - else if (*p == '*') - { - int z = p[1]; +#define Convert(x) (x) +#define MATCH_FUNC_NAME match_pattern - if (!z) - return 1; - while (s = strchr(s, z)) - { - if (match_pattern(p+1, s)) - return 1; - s++; - } - return 0; - } - else if (*p++ != *s++) - return 0; - } - return !*s; -} +#include "lib/patmatch.h"