Match pattern "p" against the a virtually-joined string consisting * of all the pointers in array "texts" (which has a NULL pointer at the * end). The int "where" can be 0 (normal matching), > 0 (match only * the trailing N slash-separated filename components of "texts"), or < 0 * (match the "pattern" at the start or after any slash in "texts"). */
| 314 | * the trailing N slash-separated filename components of "texts"), or < 0 |
| 315 | * (match the "pattern" at the start or after any slash in "texts"). */ |
| 316 | int wildmatch_array(const char *pattern, const char*const *texts, int where) |
| 317 | { |
| 318 | const uchar *p = (const uchar*)pattern; |
| 319 | const uchar*const *a = (const uchar*const*)texts; |
| 320 | const uchar *text; |
| 321 | int matched; |
| 322 | |
| 323 | #ifdef WILD_TEST_ITERATIONS |
| 324 | wildmatch_iteration_count = 0; |
| 325 | #endif |
| 326 | |
| 327 | if (where > 0) |
| 328 | text = trailing_N_elements(&a, where); |
| 329 | else |
| 330 | text = *a++; |
| 331 | if (!text) |
| 332 | return FALSE; |
| 333 | |
| 334 | if ((matched = dowild(p, text, a)) != TRUE && where < 0 |
| 335 | && matched != ABORT_ALL) { |
| 336 | while (1) { |
| 337 | if (*text == '\0') { |
| 338 | if ((text = (uchar*)*a++) == NULL) |
| 339 | return FALSE; |
| 340 | continue; |
| 341 | } |
| 342 | if (*text++ == '/' && (matched = dowild(p, text, a)) != FALSE |
| 343 | && matched != ABORT_TO_STARSTAR) |
| 344 | break; |
| 345 | } |
| 346 | } |
| 347 | return matched == TRUE; |
| 348 | } |
| 349 | |
| 350 | /* Match literal string "s" against the a virtually-joined string consisting |
| 351 | * of all the pointers in array "texts" (which has a NULL pointer at the |