aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-01-05 08:56:27 +0000
committerRon Yorston <rmy@pobox.com>2023-01-05 08:56:27 +0000
commite5e4a2fec5435192d1672e6db2f335cb5e89f877 (patch)
tree08cb827a40817ea4824bc9336d57eda669c4d4b2 /shell
parent4343f3926355f55fc023203c992527fc34bf609e (diff)
parentb1884deb514c35289d37e7bfbf23f770b0bd09b3 (diff)
downloadbusybox-w32-e5e4a2fec5435192d1672e6db2f335cb5e89f877.tar.gz
busybox-w32-e5e4a2fec5435192d1672e6db2f335cb5e89f877.tar.bz2
busybox-w32-e5e4a2fec5435192d1672e6db2f335cb5e89f877.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c10
-rw-r--r--shell/hush.c19
2 files changed, 21 insertions, 8 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 13200da0c..6a4b8e273 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -10606,7 +10606,7 @@ evalpipe(union node *n, int flags)
10606} 10606}
10607 10607
10608/* setinteractive needs this forward reference */ 10608/* setinteractive needs this forward reference */
10609#if ENABLE_FEATURE_EDITING 10609#if ENABLE_FEATURE_TAB_COMPLETION
10610static const char *get_builtin_name(int i) FAST_FUNC; 10610static const char *get_builtin_name(int i) FAST_FUNC;
10611#endif 10611#endif
10612 10612
@@ -10643,8 +10643,12 @@ setinteractive(int on)
10643#if ENABLE_FEATURE_EDITING 10643#if ENABLE_FEATURE_EDITING
10644 if (!line_input_state) { 10644 if (!line_input_state) {
10645 line_input_state = new_line_input_t(FOR_SHELL | WITH_PATH_LOOKUP); 10645 line_input_state = new_line_input_t(FOR_SHELL | WITH_PATH_LOOKUP);
10646# if ENABLE_FEATURE_TAB_COMPLETION
10646 line_input_state->get_exe_name = get_builtin_name; 10647 line_input_state->get_exe_name = get_builtin_name;
10648# endif
10649# if EDITING_HAS_sh_get_var
10647 line_input_state->sh_get_var = lookupvar; 10650 line_input_state->sh_get_var = lookupvar;
10651# endif
10648 } 10652 }
10649#endif 10653#endif
10650 } 10654 }
@@ -10888,7 +10892,7 @@ mklocal(char *name, int flags)
10888 setvareq(name, flags); 10892 setvareq(name, flags);
10889 else 10893 else
10890 /* "local VAR" unsets VAR: */ 10894 /* "local VAR" unsets VAR: */
10891 setvar0(name, NULL); 10895 unsetvar(name);
10892 } 10896 }
10893 } 10897 }
10894 lvp->vp = vp; 10898 lvp->vp = vp;
@@ -11157,7 +11161,7 @@ find_builtin(const char *name)
11157 return bp; 11161 return bp;
11158} 11162}
11159 11163
11160#if ENABLE_FEATURE_EDITING 11164#if ENABLE_FEATURE_TAB_COMPLETION
11161static const char * FAST_FUNC 11165static const char * FAST_FUNC
11162get_builtin_name(int i) 11166get_builtin_name(int i)
11163{ 11167{
diff --git a/shell/hush.c b/shell/hush.c
index 051b123e7..d111f0cc5 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -2460,10 +2460,15 @@ static int set_local_var(char *str, unsigned flags)
2460 return retval; 2460 return retval;
2461} 2461}
2462 2462
2463static int set_local_var0(char *str)
2464{
2465 return set_local_var(str, 0);
2466}
2467
2463static void FAST_FUNC set_local_var_from_halves(const char *name, const char *val) 2468static void FAST_FUNC set_local_var_from_halves(const char *name, const char *val)
2464{ 2469{
2465 char *var = xasprintf("%s=%s", name, val); 2470 char *var = xasprintf("%s=%s", name, val);
2466 set_local_var(var, /*flag:*/ 0); 2471 set_local_var0(var);
2467} 2472}
2468 2473
2469/* Used at startup and after each cd */ 2474/* Used at startup and after each cd */
@@ -6964,7 +6969,7 @@ static NOINLINE int expand_one_var(o_string *output, int n,
6964 val = NULL; 6969 val = NULL;
6965 } else { 6970 } else {
6966 char *new_var = xasprintf("%s=%s", var, val); 6971 char *new_var = xasprintf("%s=%s", var, val);
6967 set_local_var(new_var, /*flag:*/ 0); 6972 set_local_var0(new_var);
6968 } 6973 }
6969 } 6974 }
6970 } 6975 }
@@ -8188,7 +8193,7 @@ static const struct built_in_command *find_builtin(const char *name)
8188 return find_builtin_helper(name, bltins2, &bltins2[ARRAY_SIZE(bltins2)]); 8193 return find_builtin_helper(name, bltins2, &bltins2[ARRAY_SIZE(bltins2)]);
8189} 8194}
8190 8195
8191#if ENABLE_HUSH_JOB && ENABLE_FEATURE_EDITING 8196#if ENABLE_HUSH_JOB && ENABLE_FEATURE_TAB_COMPLETION
8192static const char * FAST_FUNC get_builtin_name(int i) 8197static const char * FAST_FUNC get_builtin_name(int i)
8193{ 8198{
8194 if (/*i >= 0 && */ i < ARRAY_SIZE(bltins1)) { 8199 if (/*i >= 0 && */ i < ARRAY_SIZE(bltins1)) {
@@ -9373,7 +9378,7 @@ static NOINLINE int run_pipe(struct pipe *pi)
9373 } 9378 }
9374#endif 9379#endif
9375 debug_printf_env("set shell var:'%s'->'%s'\n", *argv, p); 9380 debug_printf_env("set shell var:'%s'->'%s'\n", *argv, p);
9376 if (set_local_var(p, /*flag:*/ 0)) { 9381 if (set_local_var0(p)) {
9377 /* assignment to readonly var / putenv error? */ 9382 /* assignment to readonly var / putenv error? */
9378 rcode = 1; 9383 rcode = 1;
9379 } 9384 }
@@ -9856,7 +9861,7 @@ static int run_list(struct pipe *pi)
9856 } 9861 }
9857 /* Insert next value from for_lcur */ 9862 /* Insert next value from for_lcur */
9858 /* note: *for_lcur already has quotes removed, $var expanded, etc */ 9863 /* note: *for_lcur already has quotes removed, $var expanded, etc */
9859 set_local_var(xasprintf("%s=%s", pi->cmds[0].argv[0], *for_lcur++), /*flag:*/ 0); 9864 set_local_var_from_halves(pi->cmds[0].argv[0], *for_lcur++);
9860 continue; 9865 continue;
9861 } 9866 }
9862 if (rword == RES_IN) { 9867 if (rword == RES_IN) {
@@ -10668,8 +10673,12 @@ int hush_main(int argc, char **argv)
10668 10673
10669# if ENABLE_FEATURE_EDITING 10674# if ENABLE_FEATURE_EDITING
10670 G.line_input_state = new_line_input_t(FOR_SHELL); 10675 G.line_input_state = new_line_input_t(FOR_SHELL);
10676# if ENABLE_FEATURE_TAB_COMPLETION
10671 G.line_input_state->get_exe_name = get_builtin_name; 10677 G.line_input_state->get_exe_name = get_builtin_name;
10678# endif
10679# if EDITING_HAS_sh_get_var
10672 G.line_input_state->sh_get_var = get_local_var_value; 10680 G.line_input_state->sh_get_var = get_local_var_value;
10681# endif
10673# endif 10682# endif
10674# if ENABLE_HUSH_SAVEHISTORY && MAX_HISTORY > 0 10683# if ENABLE_HUSH_SAVEHISTORY && MAX_HISTORY > 0
10675 { 10684 {