Lines Matching defs:pattern

6974  * qualify each pattern's type:
6978 * PATTERN_EXACT The pattern is a complete FMRI. The list of
6981 * PATTERN_GLOB The pattern will be matched against all
6983 * Matches will be added to the pattern's list
6989 * added to the pattern's list as they are found.
6999 * When a match is found, we add the match to the pattern's list. We also enter
7004 * | pattern 'foo' |----->| match |---->| match |
7111 * Given an FMRI, insert it into the pattern's list appropriately.
7117 scf_pattern_t *pattern, int svc_explicit)
7132 for (prev = match = pattern->sp_matches; match != NULL;
7139 pattern->sp_matches = match->sm_next;
7142 pattern->sp_matchcount--;
7152 for (match = pattern->sp_matches; match != NULL;
7169 match->sm_next = pattern->sp_matches;
7170 pattern->sp_matches = match;
7171 pattern->sp_matchcount++;
7177 * Returns 1 if the fmri matches the given pattern, 0 otherwise.
7180 scf_cmp_pattern(char *fmri, scf_pattern_t *pattern)
7184 if (pattern->sp_type == PATTERN_GLOB) {
7185 if (fnmatch(pattern->sp_arg, fmri, 0) == 0)
7187 } else if (pattern->sp_type == PATTERN_PARTIAL &&
7188 (tmp = strstr(fmri, pattern->sp_arg)) != NULL) {
7197 tmp += strlen(pattern->sp_arg);
7203 * If the user has supplied a short pattern that matches
7221 int npattern, scf_pattern_t *pattern, int svc_explicit)
7227 if (scf_cmp_pattern(fmri, &pattern[i]) &&
7229 legacy, &pattern[i], svc_explicit)) != 0)
7247 scf_pattern_t *pattern = NULL;
7289 pattern = NULL;
7290 } else if ((pattern = calloc(argc, sizeof (scf_pattern_t)))
7318 * not match a full fmri is identified as a globbed pattern or a partial
7362 &pattern[i], flags & SCF_WALK_EXPLICIT)) != 0)
7365 if ((pattern[i].sp_arg = strdup(argv[i])) == NULL) {
7369 pattern[i].sp_type = PATTERN_EXACT;
7395 &pattern[i], flags & SCF_WALK_EXPLICIT)) != 0)
7398 if ((pattern[i].sp_arg = strdup(argv[i])) == NULL) {
7402 pattern[i].sp_type = PATTERN_EXACT;
7424 &pattern[i], flags & SCF_WALK_EXPLICIT)) != 0)
7427 if ((pattern[i].sp_arg = strdup(argv[i]))
7432 pattern[i].sp_type = PATTERN_EXACT;
7462 &pattern[i], flags & SCF_WALK_EXPLICIT)) != 0)
7466 if ((pattern[i].sp_arg = strdup(argv[i])) == NULL) {
7470 pattern[i].sp_type = PATTERN_EXACT;
7495 pattern[i].sp_type = PATTERN_GLOB;
7498 pattern[i].sp_arg = strdup(argv[i]);
7500 pattern[i].sp_arg = malloc(strlen(argv[i]) + 6);
7501 if (pattern[i].sp_arg != NULL)
7502 (void) snprintf(pattern[i].sp_arg,
7507 pattern[i].sp_type = PATTERN_PARTIAL;
7508 pattern[i].sp_arg = strdup(argv[i]);
7511 if (pattern[i].sp_arg == NULL) {
7563 fmri, NULL, argc, pattern,
7615 fmri, NULL, argc, pattern,
7700 fmri, pgname, argc, pattern,
7722 if (pattern[i].sp_type == PATTERN_INVALID)
7724 if (pattern[i].sp_matchcount == 0) {
7738 strncmp(pattern[i].sp_arg, "lrc:/", 5) == 0)
7749 errfunc(scf_get_msg(msgid), pattern[i].sp_arg);
7753 pattern[i].sp_matchcount > 1) {
7766 strlen(pattern[i].sp_arg);
7767 for (match = pattern[i].sp_matches; match != NULL;
7779 pattern[i].sp_arg);
7781 for (match = pattern[i].sp_matches; match != NULL;
7793 for (match = pattern[i].sp_matches; match != NULL;
7823 if (pattern[i].sp_matchcount == 0 ||
7825 pattern[i].sp_matchcount > 1))
7828 for (match = pattern[i].sp_matches; match != NULL;
7922 if (pattern != NULL) {
7926 if (pattern[i].sp_arg != NULL)
7927 free(pattern[i].sp_arg);
7929 for (match = pattern[i].sp_matches; match != NULL;
7937 free(pattern);