Lines Matching refs:pattern
53 alternate_match(const char *pattern, const char *pkg) in alternate_match() argument
63 if ((sep = strchr(pattern, '{')) == (char *) NULL) { in alternate_match()
64 errx(EXIT_FAILURE, "alternate_match(): '{' expected in `%s'", pattern); in alternate_match()
66 (void) strncpy(buf, pattern, (size_t) (sep - pattern)); in alternate_match()
67 alt = &buf[sep - pattern]; in alternate_match()
77 errx(EXIT_FAILURE, "Malformed alternate `%s'", pattern); in alternate_match()
100 glob_match(const char *pattern, const char *pkg) in glob_match() argument
102 return fnmatch(pattern, pkg, FNM_PERIOD) == 0; in glob_match()
110 simple_match(const char *pattern, const char *pkg) in simple_match() argument
112 return strcmp(pattern, pkg) == 0; in simple_match()
120 quick_pkg_match(const char *pattern, const char *pkg) in quick_pkg_match() argument
123 if (!simple(pattern[0])) in quick_pkg_match()
125 if (pattern[0] != pkg[0]) in quick_pkg_match()
128 if (!simple(pattern[1])) in quick_pkg_match()
130 if (pattern[1] != pkg[1]) in quick_pkg_match()
140 pkg_match(const char *pattern, const char *pkg) in pkg_match() argument
142 if (!quick_pkg_match(pattern, pkg)) in pkg_match()
145 if (strchr(pattern, '{') != (char *) NULL) { in pkg_match()
147 return alternate_match(pattern, pkg); in pkg_match()
149 if (strpbrk(pattern, "<>") != (char *) NULL) { in pkg_match()
153 ret = dewey_match(pattern, pkg); in pkg_match()
158 if (strpbrk(pattern, "*?[]") != (char *) NULL) { in pkg_match()
160 if (glob_match(pattern, pkg)) in pkg_match()
165 if (simple_match(pattern, pkg)) in pkg_match()
175 pattern_ver = xasprintf("%s-[0-9]*", pattern); in pkg_match()
183 pkg_order(const char *pattern, const char *first_pkg, const char *second_pkg) in pkg_order() argument
192 return pkg_match(pattern, second_pkg) ? 2 : 0; in pkg_order()
194 return pkg_match(pattern, first_pkg) ? 1 : 0; in pkg_order()
199 if (first_version == NULL || !pkg_match(pattern, first_pkg)) in pkg_order()
200 return pkg_match(pattern, second_pkg) ? 2 : 0; in pkg_order()
202 if (second_version == NULL || !pkg_match(pattern, second_pkg)) in pkg_order()
203 return pkg_match(pattern, first_pkg) ? 1 : 0; in pkg_order()