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