Match = 0, NoMatch = 1, Abort = -1 * Based loosely on sections of wildmat.c by Rich Salz * Hmmm... shouldn't this really go component by component? */
| 173 | * Hmmm... shouldn't this really go component by component? |
| 174 | */ |
| 175 | AP_DECLARE(int) ap_strcmp_match(const char *str, const char *expected) |
| 176 | { |
| 177 | apr_size_t x, y; |
| 178 | |
| 179 | for (x = 0, y = 0; expected[y]; ++y, ++x) { |
| 180 | if (expected[y] == '*') { |
| 181 | while (expected[++y] == '*'); |
| 182 | if (!expected[y]) |
| 183 | return 0; |
| 184 | while (str[x]) { |
| 185 | int ret; |
| 186 | if ((ret = ap_strcmp_match(&str[x++], &expected[y])) != 1) |
| 187 | return ret; |
| 188 | } |
| 189 | return -1; |
| 190 | } |
| 191 | else if (!str[x]) |
| 192 | return -1; |
| 193 | else if ((expected[y] != '?') && (str[x] != expected[y])) |
| 194 | return 1; |
| 195 | } |
| 196 | return (str[x] != '\0'); |
| 197 | } |
| 198 | |
| 199 | AP_DECLARE(int) ap_strcasecmp_match(const char *str, const char *expected) |
| 200 | { |
no outgoing calls
no test coverage detected