Lines Matching refs:pattern
6 * Simple pattern matching, with '*' and '?' as wildcards.
49 * Returns true if the given string matches the pattern (which may contain ?
54 match_pattern(const char *s, const char *pattern)
57 /* If at end of pattern, accept if also at end of string. */
58 if (!*pattern)
61 if (*pattern == '*') {
63 pattern++;
65 /* If at end of pattern, accept immediately. */
66 if (!*pattern)
69 /* If next character in pattern is known, optimize. */
70 if (*pattern != '?' && *pattern != '*') {
73 * pattern, and try to match starting from
77 if (*s == *pattern &&
78 match_pattern(s + 1, pattern + 1))
88 if (match_pattern(s, pattern))
101 if (*pattern != '?' && *pattern != *s)
104 /* Move to the next character, both in string and in pattern. */
106 pattern++;
119 match_pattern_list(const char *string, const char *pattern, u_int len,
130 if (pattern[i] == '!') {
141 i < len && subi < sizeof(sub) - 1 && pattern[i] != ',';
143 sub[subi] = dolower && isupper(pattern[i]) ?
144 (char)tolower(pattern[i]) : pattern[i];
150 if (i < len && pattern[i] == ',')
179 match_hostname(const char *host, const char *pattern, u_int len)
181 return match_pattern_list(host, pattern, len, 1);
211 * match user, user@host_or_ip, user@host_or_ip_list against pattern
215 const char *pattern)
220 if ((p = strchr(pattern,'@')) == NULL)
221 return match_pattern(user, pattern);
223 pat = xstrdup(pattern);