/* * Do shell-style pattern matching for '?', '\', '[..]', and '*' wildcards. * Returns 1 if match, 0 if not. */ #include "sysincludes.h" #include "mtools.h" static int casecmp(char a,char b) { return toupper(a) == toupper(b); } static int exactcmp(char a,char b) { return a == b; } static int parse_range(const char **p, const char *s, char *out, int (*compfn)(char a, char b)) { char table[256]; int reverse; int i; short first, last; if (**p == '^') { reverse = 1; (*p)++; } else reverse=0; for(i=0; i<256; i++) table[i]=0; while(**p != ']') { if(!**p) return 0; if((*p)[1] == '-') { first = **p; (*p)+=2; if(**p == ']') last = 256; else last = *((*p)++); for(i=first; i