diff options
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/shell/hush.c b/shell/hush.c index 443bdeccf..04633ab2d 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -8222,33 +8222,31 @@ static const struct built_in_command *find_builtin(const char *name) | |||
8222 | #if ENABLE_HUSH_JOB && ENABLE_FEATURE_TAB_COMPLETION | 8222 | #if ENABLE_HUSH_JOB && ENABLE_FEATURE_TAB_COMPLETION |
8223 | static const char * FAST_FUNC hush_command_name(exe_state *e) | 8223 | static const char * FAST_FUNC hush_command_name(exe_state *e) |
8224 | { | 8224 | { |
8225 | if (e->e_type == 0) { | 8225 | switch (e->e_type) { |
8226 | if (/*e->e_index >= 0 && */ e->e_index < ARRAY_SIZE(bltins1)) { | 8226 | case 0: |
8227 | if (e->e_index < ARRAY_SIZE(bltins1)) | ||
8227 | return bltins1[e->e_index++].b_cmd; | 8228 | return bltins1[e->e_index++].b_cmd; |
8228 | } | ||
8229 | e->e_type++; | 8229 | e->e_type++; |
8230 | e->e_index = 0; | 8230 | e->e_index = 0; |
8231 | /* e->e_ptr = NULL; */ | 8231 | /* e->e_ptr = NULL; */ |
8232 | } | 8232 | /* fall through */ |
8233 | if (e->e_type == 1) { | 8233 | case 1: |
8234 | if (e->e_index < ARRAY_SIZE(bltins2)) { | 8234 | if (e->e_index < ARRAY_SIZE(bltins2)) |
8235 | return bltins2[e->e_index++].b_cmd; | 8235 | return bltins2[e->e_index++].b_cmd; |
8236 | } | ||
8237 | # if ENABLE_HUSH_FUNCTIONS | 8236 | # if ENABLE_HUSH_FUNCTIONS |
8238 | e->e_type++; | 8237 | e->e_type++; |
8239 | /* e->e_index = 0; */ | 8238 | /* e->e_index = 0; */ |
8240 | e->e_ptr = G.top_func; | 8239 | e->e_ptr = G.top_func; |
8241 | # endif | 8240 | /* fall through */ |
8242 | } | 8241 | case 2: |
8243 | # if ENABLE_HUSH_FUNCTIONS | 8242 | if (e->e_ptr) { |
8244 | if (e->e_type == 2) { | 8243 | struct function *funcp = (struct function *)e->e_ptr; |
8245 | struct function *funcp = (struct function *)e->e_ptr; | ||
8246 | while (funcp) { | ||
8247 | e->e_ptr = funcp->next; | 8244 | e->e_ptr = funcp->next; |
8248 | return funcp->name; | 8245 | return funcp->name; |
8249 | } | 8246 | } |
8250 | } | ||
8251 | # endif | 8247 | # endif |
8248 | break; | ||
8249 | } | ||
8252 | return NULL; | 8250 | return NULL; |
8253 | } | 8251 | } |
8254 | #endif | 8252 | #endif |