#define CC_EQ(class, len, litmatch) ((len) == sizeof (litmatch)-1 \
&& *(class) == *(litmatch) \
- && strncmp(class, litmatch, len) == 0)
+ && strncmp((char*)class, litmatch, len) == 0)
#if defined STDC_HEADERS || !defined isascii
# define ISASCII(c) 1
if (*p == '\0') {
/* Trailing "**" matches everything. Trailing "*" matches
* only if there are no more slash characters. */
- return special? TRUE : strchr(text, '/') == NULL;
+ return special? TRUE : strchr((char*)text, '/') == NULL;
}
for ( ; *text; text++) {
if ((matched = domatch(p, text)) != FALSE) {
ch = 0; /* This makes "prev" get set to 0. */
}
else if (ch == '[' && p[1] == ':') {
- unsigned const char *s = p += 2;
+ const unsigned char *s = p += 2;
int i;
- while ((ch = *p) && (ch != ':' || p[1] != ']')) p++;
+ while ((ch = *p) && ch != ']') p++;
if (!ch)
return ABORT_ALL;
- i = p - s;
+ i = p - s - 1;
+ if (i < 0 || p[-1] != ':') {
+ /* Didn't find ":]", so treat like a normal set. */
+ p = s - 2;
+ ch = '[';
+ if (*text == ch)
+ matched = TRUE;
+ continue;
+ }
if (CC_EQ(s,i, "alnum")) {
if (ISALNUM(*text))
matched = TRUE;
}
else /* malformed [:class:] string */
return ABORT_ALL;
- p++;
ch = 0; /* This makes "prev" get set to 0. */
}
else if (*text == ch)
matched = TRUE;
} while (prev = ch, (ch = *++p) != ']');
- if (matched == special)
+ if (matched == special || *text == '/')
return FALSE;
continue;
}