+ if (explode_mod) {
+ static char *buf;
+ char *texts[MAXPATHLEN], *hold;
+ int pos = 0, cnt = 0, ndx = 0, len = strlen(text);
+
+ if (!buf) {
+ int j;
+ if (!(buf = calloc(MAXPATHLEN * 2, 1)))
+ exit(1);
+ for (j = (MAXPATHLEN-1) / explode_mod; j >= 0; j--)
+ texts[j] = buf + j * (explode_mod + 1);
+ }
+
+ if (empty_at_start)
+ texts[ndx++][0] = '\0';
+ /* An empty string must turn into at least one empty array item. */
+ while (1) {
+ strncpy(texts[ndx++], text + pos, explode_mod);
+ if (pos + explode_mod >= len) {
+ texts[ndx-1][len - pos] = '\0';
+ break;
+ }
+ pos += explode_mod;
+ if (!(++cnt % empties_mod))
+ texts[ndx++][0] = '\0';
+ }
+ if (empty_at_end)
+ texts[ndx++][0] = '\0';
+ hold = texts[ndx];
+ texts[ndx] = NULL;
+ matched = wildmatch_array(pattern, (const char**)texts, 0);
+ texts[ndx] = hold;
+ } else
+ matched = wildmatch(pattern, text);