aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-01-21 16:01:58 +0000
committerDenys Vlasenko <vda.linux@googlemail.com>2020-01-29 15:23:17 +0100
commit9e2a5668fd38db169d9d91b13089a99df4c9bd37 (patch)
tree3d823cd22bf7627fbb5ef90fdcfae794c1f94ab2 /shell/ash.c
parent1ff7002b1d229c678fdffebec602fb4c54439a31 (diff)
downloadbusybox-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 'shell/ash.c')
-rw-r--r--shell/ash.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index d6040f47e..fb4028219 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9523,6 +9523,11 @@ evalpipe(union node *n, int flags)
return status;
}
+/* setinteractive needs this forward reference */
+#if EDITING_HAS_get_exe_name
+static const char *get_builtin_name(int i) FAST_FUNC;
+#endif
+
/*
* Controls whether the shell is interactive or not.
*/
@@ -9554,8 +9559,12 @@ setinteractive(int on)
}
#endif
#if ENABLE_FEATURE_EDITING
- if (!line_input_state)
+ if (!line_input_state) {
line_input_state = new_line_input_t(FOR_SHELL | WITH_PATH_LOOKUP);
+# if EDITING_HAS_get_exe_name
+ line_input_state->get_exe_name = get_builtin_name;
+# endif
+ }
#endif
}
}
@@ -10023,6 +10032,14 @@ find_builtin(const char *name)
return bp;
}
+#if EDITING_HAS_get_exe_name
+static const char * FAST_FUNC
+get_builtin_name(int i)
+{
+ return /*i >= 0 &&*/ i < ARRAY_SIZE(builtintab) ? builtintab[i].name + 1 : NULL;
+}
+#endif
+
/*
* Execute a simple command.
*/