+ if (ex->match_flags & MATCHFLG_WILD) {
+ /* A non-anchored match with an infix slash and no "**"
+ * needs to match the last slash_cnt+1 name elements. */
+ if (!match_start && ex->slash_cnt &&
+ !(ex->match_flags & MATCHFLG_WILD2)) {
+ int cnt = ex->slash_cnt + 1;
+ for (p = name + strlen(name) - 1; p >= name; p--) {
+ if (*p == '/' && !--cnt)
+ break;
+ }
+ name = p+1;
+ }
+ if (wildmatch(pattern, name))
+ return 1;
+ if (ex->match_flags & MATCHFLG_WILD2_PREFIX) {
+ /* If the **-prefixed pattern has a '/' as the next
+ * character, then try to match the rest of the
+ * pattern at the root. */
+ if (pattern[2] == '/' && wildmatch(pattern+3, name))
+ return 1;
+ }
+ else if (!match_start && ex->match_flags & MATCHFLG_WILD2) {
+ /* A non-anchored match with an infix or trailing "**"
+ * (but not a prefixed "**") needs to try matching
+ * after every slash. */
+ while ((name = strchr(name, '/')) != NULL) {
+ name++;
+ if (wildmatch(pattern, name))
+ return 1;
+ }
+ }
+ } else if (match_start) {
+ if (strcmp(name,pattern) == 0)