diff options
author | Ron Yorston <rmy@pobox.com> | 2020-01-21 16:01:58 +0000 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-01-29 15:23:17 +0100 |
commit | 9e2a5668fd38db169d9d91b13089a99df4c9bd37 (patch) | |
tree | 3d823cd22bf7627fbb5ef90fdcfae794c1f94ab2 /libbb | |
parent | 1ff7002b1d229c678fdffebec602fb4c54439a31 (diff) | |
download | busybox-9e2a5668fd38db169d9d91b13089a99df4c9bd37.tar.gz |
ash,hush: allow builtins to be tab-completed, closes 7532
function old new delta
complete_cmd_dir_file 678 830 +152
get_builtin_name - 35 +35
optschanged 125 132 +7
hush_main 1069 1076 +7
save_command_ps_at_cur_history 76 78 +2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 203/0) Total: 203 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/lineedit.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index b1ec52b88..de236dea0 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -813,18 +813,29 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type) } pf_len = strlen(pfind); -# if ENABLE_FEATURE_SH_STANDALONE && NUM_APPLETS != 1 if (type == FIND_EXE_ONLY && !dirbuf) { +# if ENABLE_FEATURE_SH_STANDALONE && NUM_APPLETS != 1 const char *p = applet_names; - while (*p) { if (strncmp(pfind, p, pf_len) == 0) add_match(xstrdup(p)); while (*p++ != '\0') continue; } - } # endif +# if EDITING_HAS_get_exe_name + if (state->get_exe_name) { + i = 0; + for (;;) { + const char *b = state->get_exe_name(i++); + if (!b) + break; + if (strncmp(pfind, b, pf_len) == 0) + add_match(xstrdup(b)); + } + } +# endif + } for (i = 0; i < npaths; i++) { DIR *dir; |