X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fpatimatch.c;h=a0e29af90aed6761c305c291c41dc020b4057218;hb=f39ec2e7c8ccdbe0a48037ae5fe5f6f90b374db4;hp=8a0c8851f80b8798750092d31e8bff4c92cbbd7a;hpb=b0ccc07f3011959ac4a11e76e1b50c84ba31efe9;p=libucw.git diff --git a/lib/patimatch.c b/lib/patimatch.c index 8a0c8851..a0e29af9 100644 --- a/lib/patimatch.c +++ b/lib/patimatch.c @@ -1,43 +1,16 @@ /* - * Sherlock Library -- Shell-Like Case-Insensitive Pattern Matching (currently only '?' and '*') + * UCW Library -- Shell-Like Case-Insensitive 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 "string.h" +#include "lib/lib.h" +#include "lib/chartype.h" -int -match_pattern_nocase(byte *p, byte *s) -{ - while (*p) - { - if (*p == '?' && *s) - p++, s++; - else if (*p == '*') - { - int z = p[1]; +#define Convert(x) Cupcase(x) +#define MATCH_FUNC_NAME match_pattern_nocase - if (!z) - return 1; - while (s = strchr(s, z)) - { - if (match_pattern_nocase(p+1, s)) - return 1; - s++; - } - return 0; - } - else - { - if (*p == '\\' && p[1]) - p++; - if (Cupcase(*p++) != Cupcase(*s++)) - return 0; - } - } - return !*s; -} +#include "lib/patmatch.h"