From 66c9b8f39acbba587eda0cababa3de37e89b8dff Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Mon, 10 Apr 2023 10:20:15 +0100 Subject: ash,hush: tab completion of functions and aliases Rework the 'get_exe_name' functions in ash and hush so functions and aliases are considered when tab-completing a command. function old new delta ash_command_name - 188 +188 hush_command_name - 118 +118 complete_cmd_dir_file 876 880 +4 ash_builtin_name 17 - -17 hush_builtin_name 38 - -38 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 1/0 up/down: 310/-55) Total: 255 bytes (GitHub issue #301) Signed-off-by: Ron Yorston --- include/libbb.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index 6191debb1..66781da4f 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1924,7 +1924,14 @@ unsigned size_from_HISTFILESIZE(const char *hp) FAST_FUNC; # else # define MAX_HISTORY 0 # endif -typedef const char *get_exe_name_t(int i) FAST_FUNC; +typedef struct exe_state { + int e_type; /* type of tab completion: builtin, alias, function */ + int e_index; /* index of current table entry or hash bucket */ +# if ENABLE_SHELL_ASH || (ENABLE_SHELL_HUSH && ENABLE_HUSH_FUNCTIONS) + void *e_ptr; /* current position in linked list */ +# endif +} exe_state; +typedef const char *get_exe_name_t(exe_state *e) FAST_FUNC; typedef const char *sh_get_var_t(const char *name) FAST_FUNC; typedef struct line_input_t { int flags; -- cgit v1.2.3-55-g6feb