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 /shell/hush.c | |
parent | 1ff7002b1d229c678fdffebec602fb4c54439a31 (diff) | |
download | busybox-w32-9e2a5668fd38db169d9d91b13089a99df4c9bd37.tar.gz busybox-w32-9e2a5668fd38db169d9d91b13089a99df4c9bd37.tar.bz2 busybox-w32-9e2a5668fd38db169d9d91b13089a99df4c9bd37.zip |
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 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/shell/hush.c b/shell/hush.c index 97202b953..6e44d4e11 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -7889,6 +7889,20 @@ static const struct built_in_command *find_builtin(const char *name) | |||
7889 | return find_builtin_helper(name, bltins2, &bltins2[ARRAY_SIZE(bltins2)]); | 7889 | return find_builtin_helper(name, bltins2, &bltins2[ARRAY_SIZE(bltins2)]); |
7890 | } | 7890 | } |
7891 | 7891 | ||
7892 | #if EDITING_HAS_get_exe_name | ||
7893 | static const char * FAST_FUNC get_builtin_name(int i) | ||
7894 | { | ||
7895 | if (/*i >= 0 && */ i < ARRAY_SIZE(bltins1)) { | ||
7896 | return bltins1[i].b_cmd; | ||
7897 | } | ||
7898 | i -= ARRAY_SIZE(bltins1); | ||
7899 | if (i < ARRAY_SIZE(bltins2)) { | ||
7900 | return bltins2[i].b_cmd; | ||
7901 | } | ||
7902 | return NULL; | ||
7903 | } | ||
7904 | #endif | ||
7905 | |||
7892 | static void remove_nested_vars(void) | 7906 | static void remove_nested_vars(void) |
7893 | { | 7907 | { |
7894 | struct variable *cur; | 7908 | struct variable *cur; |
@@ -10268,6 +10282,9 @@ int hush_main(int argc, char **argv) | |||
10268 | 10282 | ||
10269 | # if ENABLE_FEATURE_EDITING | 10283 | # if ENABLE_FEATURE_EDITING |
10270 | G.line_input_state = new_line_input_t(FOR_SHELL); | 10284 | G.line_input_state = new_line_input_t(FOR_SHELL); |
10285 | # if EDITING_HAS_get_exe_name | ||
10286 | G.line_input_state->get_exe_name = get_builtin_name; | ||
10287 | # endif | ||
10271 | # endif | 10288 | # endif |
10272 | # if ENABLE_HUSH_SAVEHISTORY && MAX_HISTORY > 0 | 10289 | # if ENABLE_HUSH_SAVEHISTORY && MAX_HISTORY > 0 |
10273 | { | 10290 | { |