static bool star_match(const char *string, const char *estring, const char *pattern, const char *epattern) { /* '*' matches any substring. We handle this by calling ourselves * recursively for each postfix of string, until either we match or * we reach the end of the string. */ pattern++; /* Skip over contiguous sequences of `?*', so that * recursive calls only occur on `real' characters. */ while (pattern != epattern && (*pattern == '?' || *pattern == '*')) { if (*pattern == '?') { if (string == estring) return false; else string++; } pattern++; } if (pattern == epattern) return true; for (; string != estring; string++) if (Str_Matchi(string, estring, pattern, epattern)) return true; return false; }
/*- *----------------------------------------------------------------------- * CondDoMake -- * Handle the 'make' function for conditionals. * * Results: * true if the given target is being made. *----------------------------------------------------------------------- */ static bool CondDoMake(struct Name *arg) { LstNode ln; for (ln = Lst_First(create); ln != NULL; ln = Lst_Adv(ln)) { char *s = (char *)Lst_Datum(ln); if (Str_Matchi(s, strchr(s, '\0'), arg->s, arg->e)) return true; } return false; }