Lines Matching full:matches

473 			*p = '\0';	/* so no more matches */  in fc_replace()
592 **add_match(char **matches, size_t i, size_t *size, char *match_copy) in add_match() argument
596 matches[i] = match_copy; in add_match()
599 matches = reallocarray(matches, *size, sizeof(matches[0])); in add_match()
602 return (matches); in add_match()
616 char **matches = NULL, **rmatches; in sh_matches() local
627 if ((matches = malloc(size * sizeof(matches[0]))) == NULL) in sh_matches()
653 rmatches = add_match(matches, ++i, &size, in sh_matches()
659 matches = rmatches; in sh_matches()
666 rmatches = add_match(matches, ++i, &size, strndup(bp + 2, bp[0])); in sh_matches()
669 matches = rmatches; in sh_matches()
674 rmatches = add_match(matches, ++i, &size, strdup(ap->name)); in sh_matches()
677 matches = rmatches; in sh_matches()
684 rmatches = add_match(matches, ++i, &size, strdup(e.cmdname)); in sh_matches()
687 matches = rmatches; in sh_matches()
692 free(matches); in sh_matches()
697 qsort_s(matches + 1, i, sizeof(matches[0]), comparator, in sh_matches()
700 const char *l = matches[uniq] + curpos; in sh_matches()
701 const char *r = matches[k] + curpos; in sh_matches()
709 free(matches[k]); in sh_matches()
711 matches[++uniq] = matches[k]; in sh_matches()
714 matches[uniq + 1] = NULL; in sh_matches()
716 * matches[0] is special: it's not a real matching file name but in sh_matches()
718 * any other element of the array. When strings matches[0] and in sh_matches()
719 * matches[1] compare equal and matches[2] is null that means to in sh_matches()
721 * user input with possibly escaped string in matches[0] which is the in sh_matches()
725 matches[0] = strdup(matches[1]); in sh_matches()
727 matches[0] = strndup(matches[1], curpos + lcstring); in sh_matches()
729 matches[0] = strdup(text); in sh_matches()
730 if (matches[0] == NULL) { in sh_matches()
732 free(matches[k]); in sh_matches()
733 free(matches); in sh_matches()
736 return (matches); in sh_matches()