Lines Matching refs:nwords
241 x_print_expansions(int nwords, char * const *words, bool is_command) in x_print_expansions() argument
253 (prefix_len = x_longest_prefix(nwords, words)) > 0) { in x_print_expansions()
257 if (nwords == 1) in x_print_expansions()
260 for (i = 0; i < nwords; i++) in x_print_expansions()
265 if (i == nwords) { in x_print_expansions()
270 XPinit(l, nwords + 1); in x_print_expansions()
271 for (i = 0; i < nwords; i++) in x_print_expansions()
389 int nwords; in x_file_glob() local
414 nwords = DOGLOB | DOTILDE | DOMARKDIRS; in x_file_glob()
419 nwords = 0; in x_file_glob()
421 expand(yylval.cp, &w, nwords); in x_file_glob()
425 for (nwords = 0; words[nwords]; nwords++) in x_file_glob()
427 if (nwords == 1) { in x_file_glob()
444 x_free_words(nwords, words); in x_file_glob()
446 nwords = 0; in x_file_glob()
450 if ((*wordsp = nwords ? words : NULL) == NULL && words != NULL) in x_file_glob()
451 x_free_words(nwords, words); in x_file_glob()
453 return (nwords); in x_file_glob()
484 size_t nwords; in x_command_glob() local
503 nwords = XPsize(w); in x_command_glob()
505 if (!nwords) { in x_command_glob()
518 alloc2(nwords, sizeof(struct path_order_info), ATEMP); in x_command_glob()
519 for (i = 0; i < nwords; i++) { in x_command_glob()
529 qsort(info, nwords, sizeof(struct path_order_info), in x_command_glob()
531 for (i = 0; i < nwords; i++) in x_command_glob()
539 qsort(words, nwords, sizeof(void *), ascpstrcmp); in x_command_glob()
540 for (i = j = 0; i < nwords - 1; i++) { in x_command_glob()
547 w.len = nwords = j; in x_command_glob()
553 return (nwords); in x_command_glob()
616 int len, nwords = 0; in x_cf_glob() local
680 nwords = is_command ? in x_cf_glob()
685 if (nwords == 0) { in x_cf_glob()
694 return (nwords); in x_cf_glob()
701 x_longest_prefix(int nwords, char * const * words) in x_longest_prefix() argument
707 if (nwords <= 0) in x_longest_prefix()
711 for (i = 1; i < nwords; i++) in x_longest_prefix()
725 x_free_words(int nwords, char **words) in x_free_words() argument
727 while (nwords) in x_free_words()
728 afree(words[--nwords], ATEMP); in x_free_words()
2708 int start, end, nwords, i; in x_expand() local
2711 nwords = x_cf_glob(&i, xbuf, xep - xbuf, xcp - xbuf, in x_expand()
2714 if (nwords == 0) { in x_expand()
2722 while (i < nwords) { in x_expand()
2724 (++i < nwords && x_ins(T1space) < 0)) { in x_expand()
2742 int start, end, nlen, olen, nwords; in do_complete() local
2745 nwords = x_cf_glob(&flags, xbuf, xep - xbuf, xcp - xbuf, in do_complete()
2748 if (nwords == 0) { in do_complete()
2753 x_print_expansions(nwords, words, in do_complete()
2756 x_free_words(nwords, words); in do_complete()
2760 nlen = x_longest_prefix(nwords, words); in do_complete()
2761 if (nwords == 1) { in do_complete()
2786 if (type == CT_COMPLIST && nwords > 1) { in do_complete()
2791 x_print_expansions(nwords, words, in do_complete()
2807 if (nwords == 1 && !mksh_cdirsep(words[0][nlen - 1]) && in do_complete()
2812 x_free_words(nwords, words); in do_complete()
5299 int rval = 0, nwords, start, end, i; in expand_word() local
5315 nwords = x_cf_glob(&i, vs->cbuf, vs->linelen, vs->cursor, in expand_word()
5317 if (nwords == 0) { in expand_word()
5327 while (i < nwords) { in expand_word()
5332 if (++i < nwords && putbuf(T1space, 1, false) != 0) { in expand_word()
5352 int rval, nwords, start, end, flags; in complete_word() local
5382 nwords = x_cf_glob(&flags, vs->cbuf, vs->linelen, vs->cursor, in complete_word()
5384 if (nwords == 0) { in complete_word()
5392 if (count >= nwords) { in complete_word()
5394 x_print_expansions(nwords, words, in complete_word()
5396 x_free_words(nwords, words); in complete_word()
5407 for (i = 0; i < nwords; i++) in complete_word()
5421 match_len = x_longest_prefix(nwords, words); in complete_word()
5424 is_unique = nwords == 1; in complete_word()
5452 x_free_words(nwords, words); in complete_word()
5467 int start, end, nwords, i; in print_expansions() local
5471 nwords = x_cf_glob(&i, est->cbuf, est->linelen, est->cursor, in print_expansions()
5473 if (nwords == 0) { in print_expansions()
5477 x_print_expansions(nwords, words, tobool(i & XCF_IS_COMMAND)); in print_expansions()
5478 x_free_words(nwords, words); in print_expansions()