-
-/* 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"). */
-int wildmatch_array(const char *pattern, const char*const *texts, int where)
-{
- const uchar *p = (const uchar*)pattern;
- const uchar*const *a = (const uchar*const*)texts;
- const uchar *text;
- int matched;
-
-#ifdef WILD_TEST_ITERATIONS
- wildmatch_iteration_count = 0;
-#endif
-
- if (where > 0)
- text = trailing_N_elements(&a, where);
- else
- text = *a++;
- if (!text)
- return FALSE;
-
- if ((matched = dowild(p, text, a)) != TRUE && where < 0
- && matched != ABORT_ALL) {
- while (1) {
- if (*text == '\0') {
- if ((text = (uchar*)*a++) == NULL)
- return FALSE;
- continue;
- }
- if (*text++ == '/' && (matched = dowild(p, text, a)) != FALSE
- && matched != ABORT_TO_STARSTAR)
- break;
- }
- }
- return matched == TRUE;
-}
-
-/* Match literal string "s" 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), or > 0 (match
- * only the trailing N slash-separated filename components of "texts"). */
-int litmatch_array(const char *string, const char*const *texts, int where)
-{
- const uchar *s = (const uchar*)string;
- const uchar*const *a = (const uchar* const*)texts;
- const uchar *text;
-
- if (where > 0)
- text = trailing_N_elements(&a, where);
- else
- text = *a++;
- if (!text)
- return FALSE;
-
- return doliteral(s, text, a) == TRUE;
-}