Lines Matching refs:nwords
226 x_print_expansions(int nwords, char * const *words, bool is_command) in x_print_expansions() argument
237 (prefix_len = x_longest_prefix(nwords, words)) > 0) { in x_print_expansions()
241 if (nwords == 1) in x_print_expansions()
244 for (i = 0; i < nwords; i++) in x_print_expansions()
249 if (i == nwords) { in x_print_expansions()
253 XPinit(l, nwords + 1); in x_print_expansions()
254 for (i = 0; i < nwords; i++) in x_print_expansions()
368 int nwords; in x_file_glob() local
393 nwords = DOGLOB | DOTILDE | DOMARKDIRS; in x_file_glob()
398 nwords = 0; in x_file_glob()
400 expand(yylval.cp, &w, nwords); in x_file_glob()
404 for (nwords = 0; words[nwords]; nwords++) in x_file_glob()
406 if (nwords == 1) { in x_file_glob()
423 x_free_words(nwords, words); in x_file_glob()
425 nwords = 0; in x_file_glob()
429 if ((*wordsp = nwords ? words : NULL) == NULL && words != NULL) in x_file_glob()
430 x_free_words(nwords, words); in x_file_glob()
432 return (nwords); in x_file_glob()
458 size_t nwords; in x_command_glob() local
477 nwords = XPsize(w); in x_command_glob()
479 if (!nwords) { in x_command_glob()
492 alloc2(nwords, sizeof(struct path_order_info), ATEMP); in x_command_glob()
493 for (i = 0; i < nwords; i++) { in x_command_glob()
503 qsort(info, nwords, sizeof(struct path_order_info), in x_command_glob()
505 for (i = 0; i < nwords; i++) in x_command_glob()
513 qsort(words, nwords, sizeof(void *), xstrcmp); in x_command_glob()
514 for (i = j = 0; i < nwords - 1; i++) { in x_command_glob()
521 w.len = nwords = j; in x_command_glob()
527 return (nwords); in x_command_glob()
591 int len, nwords = 0; in x_cf_glob() local
654 nwords = is_command ? in x_cf_glob()
659 if (nwords == 0) { in x_cf_glob()
668 return (nwords); in x_cf_glob()
675 x_longest_prefix(int nwords, char * const * words) in x_longest_prefix() argument
681 if (nwords <= 0) in x_longest_prefix()
685 for (i = 1; i < nwords; i++) in x_longest_prefix()
699 x_free_words(int nwords, char **words) in x_free_words() argument
701 while (nwords) in x_free_words()
702 afree(words[--nwords], ATEMP); in x_free_words()
2671 int start, end, nwords, i; in x_expand() local
2674 nwords = x_cf_glob(&i, xbuf, xep - xbuf, xcp - xbuf, in x_expand()
2677 if (nwords == 0) { in x_expand()
2685 while (i < nwords) { in x_expand()
2687 (++i < nwords && x_ins(" ") < 0)) { in x_expand()
2705 int start, end, nlen, olen, nwords; in do_complete() local
2708 nwords = x_cf_glob(&flags, xbuf, xep - xbuf, xcp - xbuf, in do_complete()
2711 if (nwords == 0) { in do_complete()
2716 x_print_expansions(nwords, words, in do_complete()
2719 x_free_words(nwords, words); in do_complete()
2723 nlen = x_longest_prefix(nwords, words); in do_complete()
2724 if (nwords == 1) { in do_complete()
2749 if (type == CT_COMPLIST && nwords > 1) { in do_complete()
2754 x_print_expansions(nwords, words, in do_complete()
2770 if (nwords == 1 && words[0][nlen - 1] != '/' && in do_complete()
2775 x_free_words(nwords, words); in do_complete()
5234 int rval = 0, nwords, start, end, i; in expand_word() local
5250 nwords = x_cf_glob(&i, es->cbuf, es->linelen, es->cursor, in expand_word()
5252 if (nwords == 0) { in expand_word()
5262 while (i < nwords) { in expand_word()
5267 if (++i < nwords && putbuf(" ", 1, false) != 0) { in expand_word()
5287 int rval, nwords, start, end, flags; in complete_word() local
5317 nwords = x_cf_glob(&flags, es->cbuf, es->linelen, es->cursor, in complete_word()
5319 if (nwords == 0) { in complete_word()
5327 if (count >= nwords) { in complete_word()
5329 x_print_expansions(nwords, words, in complete_word()
5331 x_free_words(nwords, words); in complete_word()
5342 for (i = 0; i < nwords; i++) in complete_word()
5356 match_len = x_longest_prefix(nwords, words); in complete_word()
5359 is_unique = nwords == 1; in complete_word()
5387 x_free_words(nwords, words); in complete_word()
5402 int start, end, nwords, i; in print_expansions() local
5406 nwords = x_cf_glob(&i, est->cbuf, est->linelen, est->cursor, in print_expansions()
5408 if (nwords == 0) { in print_expansions()
5412 x_print_expansions(nwords, words, tobool(i & XCF_IS_COMMAND)); in print_expansions()
5413 x_free_words(nwords, words); in print_expansions()