X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpatimatch.c;h=40a61756ad78b0034a2c54b836fd138f57ae91c5;hb=ca885e18959ced4df7084ccf262c7b5df5848bdb;hp=5458d323142b7bf1ba0ee2ca3df861dc1a21e6a7;hpb=0caabbdf529cf2dbcea4587ecae7f69fe01a4628;p=libucw.git diff --git a/lib/patimatch.c b/lib/patimatch.c index 5458d323..40a61756 100644 --- a/lib/patimatch.c +++ b/lib/patimatch.c @@ -1,38 +1,13 @@ /* * Sherlock Library -- Shell-Like Case-Insensitive Pattern Matching (currently only '?' and '*') * - * (c) 1997 Martin Mares, + * (c) 1997 Martin Mares */ -#include -#include +#include "lib/lib.h" +#include "lib/chartype.h" -#include "lib.h" -#include "string.h" +#define Convert(x) Cupcase(x) +#define MATCH_FUNC_NAME match_pattern_nocase -int -match_pattern_nocase(byte *p, byte *s) -{ - while (*p) - { - if (*p == '?' && *s) - p++, s++; - else if (*p == '*') - { - int z = p[1]; - - if (!z) - return 1; - while (s = strchr(s, z)) - { - if (match_pattern_nocase(p+1, s)) - return 1; - s++; - } - return 0; - } - else if (Cupcase(*p++) != Cupcase(*s++)) - return 0; - } - return !*s; -} +#include "lib/patmatch.h"