diff options
author | Ron Yorston <rmy@pobox.com> | 2023-04-17 07:32:52 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-04-17 07:32:52 +0100 |
commit | 8cdeb571cfbf3bb6edc44779e46537b072b8cd08 (patch) | |
tree | 9f3ad1d205418197bc53348b61f702602229a90d /shell/ash.c | |
parent | 41827dd448c001b52b4f0e591ea605cb5de1d230 (diff) | |
parent | d2b81b3dc2b31d32e1060d3ea8bd998d30a37d8a (diff) | |
download | busybox-w32-8cdeb571cfbf3bb6edc44779e46537b072b8cd08.tar.gz busybox-w32-8cdeb571cfbf3bb6edc44779e46537b072b8cd08.tar.bz2 busybox-w32-8cdeb571cfbf3bb6edc44779e46537b072b8cd08.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c index 3eb9d5852..28f4ec47d 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -10696,7 +10696,7 @@ evalpipe(union node *n, int flags) | |||
10696 | 10696 | ||
10697 | /* setinteractive needs this forward reference */ | 10697 | /* setinteractive needs this forward reference */ |
10698 | #if ENABLE_FEATURE_TAB_COMPLETION | 10698 | #if ENABLE_FEATURE_TAB_COMPLETION |
10699 | static const char *get_builtin_name(int i) FAST_FUNC; | 10699 | static const char *ash_command_name(int i) FAST_FUNC; |
10700 | #endif | 10700 | #endif |
10701 | 10701 | ||
10702 | /* | 10702 | /* |
@@ -10733,7 +10733,7 @@ setinteractive(int on) | |||
10733 | if (!line_input_state) { | 10733 | if (!line_input_state) { |
10734 | line_input_state = new_line_input_t(FOR_SHELL | WITH_PATH_LOOKUP); | 10734 | line_input_state = new_line_input_t(FOR_SHELL | WITH_PATH_LOOKUP); |
10735 | # if ENABLE_FEATURE_TAB_COMPLETION | 10735 | # if ENABLE_FEATURE_TAB_COMPLETION |
10736 | line_input_state->get_exe_name = get_builtin_name; | 10736 | line_input_state->get_exe_name = ash_command_name; |
10737 | # endif | 10737 | # endif |
10738 | # if EDITING_HAS_sh_get_var | 10738 | # if EDITING_HAS_sh_get_var |
10739 | line_input_state->sh_get_var = lookupvar; | 10739 | line_input_state->sh_get_var = lookupvar; |
@@ -11252,9 +11252,33 @@ find_builtin(const char *name) | |||
11252 | 11252 | ||
11253 | #if ENABLE_FEATURE_TAB_COMPLETION | 11253 | #if ENABLE_FEATURE_TAB_COMPLETION |
11254 | static const char * FAST_FUNC | 11254 | static const char * FAST_FUNC |
11255 | get_builtin_name(int i) | 11255 | ash_command_name(int i) |
11256 | { | 11256 | { |
11257 | return /*i >= 0 &&*/ i < ARRAY_SIZE(builtintab) ? builtintab[i].name + 1 : NULL; | 11257 | int n; |
11258 | |||
11259 | if (/*i >= 0 &&*/ i < ARRAY_SIZE(builtintab)) | ||
11260 | return builtintab[i].name + 1; | ||
11261 | i -= ARRAY_SIZE(builtintab); | ||
11262 | |||
11263 | for (n = 0; n < CMDTABLESIZE; n++) { | ||
11264 | struct tblentry *cmdp; | ||
11265 | for (cmdp = cmdtable[n]; cmdp; cmdp = cmdp->next) { | ||
11266 | if (cmdp->cmdtype == CMDFUNCTION && --i < 0) | ||
11267 | return cmdp->cmdname; | ||
11268 | } | ||
11269 | } | ||
11270 | |||
11271 | # if ENABLE_ASH_ALIAS | ||
11272 | for (n = 0; n < ATABSIZE; n++) { | ||
11273 | struct alias *ap; | ||
11274 | for (ap = atab[n]; ap; ap = ap->next) { | ||
11275 | if (--i < 0) | ||
11276 | return ap->name; | ||
11277 | } | ||
11278 | } | ||
11279 | #endif | ||
11280 | |||
11281 | return NULL; | ||
11258 | } | 11282 | } |
11259 | #endif | 11283 | #endif |
11260 | 11284 | ||