1 /* ------------------------------------------------------------------------ */
3 /* patmatch.c -- path check */
5 /* Modified Nobutaka Watazaki */
7 /* Ver. 1.14 Source All chagned 1995.01.14 N.Watazaki */
8 /* ------------------------------------------------------------------------ */
13 * Returns true if string s matches pattern p.
17 register char *p; /* pattern */
18 register char *s; /* string to match */
19 int f; /* flag for case force */
21 char pc; /* a single character from pattern */
23 while (pc = ((f && islower(*p)) ? toupper(*p++) : *p++)) {
25 do { /* look for match till s exhausted */
26 if (patmatch(p, s, f))
32 return (0); /* s exhausted, p not */
34 s++; /* matches all, just bump */
35 else if (pc != ((f && islower(*s)) ? toupper(*s++) : *s++))
38 return (!*s); /* p exhausted, ret true if s exhausted */