aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-12-23 16:49:07 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2017-01-01 13:01:04 +0100
commit28251dfa64a999c69605471863a2bb8692bfc7b3 (patch)
tree6bb83c0d295060a1591562f80a6a1dd992786926
parent9982d88a61684743f24143d97a634b8e12f56bcb (diff)
downloadbusybox-w32-28251dfa64a999c69605471863a2bb8692bfc7b3.tar.gz
busybox-w32-28251dfa64a999c69605471863a2bb8692bfc7b3.tar.bz2
busybox-w32-28251dfa64a999c69605471863a2bb8692bfc7b3.zip
Make it possible to select "sh" and "bash" aliases without selecting ash or hush
The same can be done for msh, but we are probably better off just deleting it in a next versio or two. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/Kbuild.src20
-rw-r--r--coreutils/test.c2
-rwxr-xr-xmake_single_applets.sh11
-rw-r--r--procps/Kbuild.src2
-rw-r--r--shell/Config.src45
-rw-r--r--shell/Kbuild.src2
-rw-r--r--shell/ash.c95
-rw-r--r--shell/hush.c59
-rw-r--r--shell/math.h2
9 files changed, 120 insertions, 118 deletions
diff --git a/coreutils/Kbuild.src b/coreutils/Kbuild.src
index 8e2c097a3..d9a448781 100644
--- a/coreutils/Kbuild.src
+++ b/coreutils/Kbuild.src
@@ -10,12 +10,16 @@ lib-y:=
10 10
11INSERT 11INSERT
12 12
13lib-$(CONFIG_MORE) += cat.o # more uses it if stdout isn't a tty 13lib-$(CONFIG_MORE) += cat.o # more uses it if stdout isn't a tty
14lib-$(CONFIG_LESS) += cat.o # less too 14lib-$(CONFIG_LESS) += cat.o # less too
15lib-$(CONFIG_CRONTAB) += cat.o # crontab -l 15lib-$(CONFIG_CRONTAB) += cat.o # crontab -l
16lib-$(CONFIG_ADDUSER) += chown.o # used by adduser 16lib-$(CONFIG_ADDUSER) += chown.o # used by adduser
17lib-$(CONFIG_ADDGROUP) += chown.o # used by adduser 17lib-$(CONFIG_ADDGROUP) += chown.o # used by adduser
18lib-$(CONFIG_ASH) += echo.o # used by ash 18lib-$(CONFIG_ASH) += echo.o # used by ash
19lib-$(CONFIG_HUSH) += echo.o # used by hush 19lib-$(CONFIG_SH_IS_ASH) += echo.o # used by ash
20lib-$(CONFIG_FTPD) += ls.o # used by ftpd 20lib-$(CONFIG_BASH_IS_ASH) += echo.o # used by ash
21lib-$(CONFIG_HUSH) += echo.o # used by hush
22lib-$(CONFIG_SH_IS_HUSH) += echo.o # used by hush
23lib-$(CONFIG_BASH_IS_HUSH) += echo.o # used by hush
24lib-$(CONFIG_FTPD) += ls.o # used by ftpd
21lib-$(CONFIG_ASH_BUILTIN_PRINTF) += printf.o 25lib-$(CONFIG_ASH_BUILTIN_PRINTF) += printf.o
diff --git a/coreutils/test.c b/coreutils/test.c
index 9e18ee986..288f66508 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -55,6 +55,8 @@
55//kbuild:lib-$(CONFIG_TEST2) += test.o test_ptr_hack.o 55//kbuild:lib-$(CONFIG_TEST2) += test.o test_ptr_hack.o
56//kbuild:lib-$(CONFIG_ASH_BUILTIN_TEST) += test.o test_ptr_hack.o 56//kbuild:lib-$(CONFIG_ASH_BUILTIN_TEST) += test.o test_ptr_hack.o
57//kbuild:lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o 57//kbuild:lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o
58//kbuild:lib-$(CONFIG_SH_IS_HUSH) += test.o test_ptr_hack.o
59//kbuild:lib-$(CONFIG_BASH_IS_HUSH) += test.o test_ptr_hack.o
58 60
59/* "test --help" is special-cased to ignore --help */ 61/* "test --help" is special-cased to ignore --help */
60//usage:#define test_trivial_usage NOUSAGE_STR 62//usage:#define test_trivial_usage NOUSAGE_STR
diff --git a/make_single_applets.sh b/make_single_applets.sh
index 6473e4ddd..705f9821c 100755
--- a/make_single_applets.sh
+++ b/make_single_applets.sh
@@ -26,6 +26,7 @@ allno="$cfg"
26for app in $apps; do 26for app in $apps; do
27 allno="`echo "$allno" | sed "s/^CONFIG_${app}=y\$/# CONFIG_${app} is not set/"`" 27 allno="`echo "$allno" | sed "s/^CONFIG_${app}=y\$/# CONFIG_${app} is not set/"`"
28done 28done
29#echo "$allno" >.config_allno
29 30
30# Turn on each applet individually and build single-applet executable 31# Turn on each applet individually and build single-applet executable
31fail=0 32fail=0
@@ -37,6 +38,16 @@ for app in $apps; do
37 mv .config .config.SV 38 mv .config .config.SV
38 echo "CONFIG_${app}=y" >.config 39 echo "CONFIG_${app}=y" >.config
39 echo "$allno" | sed "/^# CONFIG_${app} is not set\$/d" >>.config 40 echo "$allno" | sed "/^# CONFIG_${app} is not set\$/d" >>.config
41
42 if test x"${app}" != x"SH_IS_ASH"; then
43 # $allno has all choices for "sh" aliasing at off.
44 # "sh" aliasing defaults to "ash", not none.
45 # without this fix, "make oldconfig" sets it wrong,
46 # resulting in NUM_APPLETS = 2
47 sed '/CONFIG_SH_IS_NONE/d' -i .config
48 echo "CONFIG_SH_IS_NONE=y" >>.config
49 fi
50
40 if ! yes '' | make oldconfig >busybox_make_${app}.log 2>&1; then 51 if ! yes '' | make oldconfig >busybox_make_${app}.log 2>&1; then
41 : $((fail++)) 52 : $((fail++))
42 echo "Config error for ${app}" 53 echo "Config error for ${app}"
diff --git a/procps/Kbuild.src b/procps/Kbuild.src
index 83af05a05..e7adc7340 100644
--- a/procps/Kbuild.src
+++ b/procps/Kbuild.src
@@ -9,3 +9,5 @@ lib-y:=
9INSERT 9INSERT
10 10
11lib-$(CONFIG_ASH) += kill.o # used for built-in kill by ash 11lib-$(CONFIG_ASH) += kill.o # used for built-in kill by ash
12lib-$(CONFIG_SH_IS_ASH) += kill.o # used for built-in kill by ash
13lib-$(CONFIG_BASH_IS_ASH) += kill.o # used for built-in kill by ash
diff --git a/shell/Config.src b/shell/Config.src
index e4df35973..7f5f67050 100644
--- a/shell/Config.src
+++ b/shell/Config.src
@@ -5,34 +5,30 @@
5 5
6menu "Shells" 6menu "Shells"
7 7
8INSERT
9
10 8
11choice 9choice
12 prompt "Choose which shell is aliased to 'sh' name" 10 prompt "Choose which shell is aliased to 'sh' name"
13 default FEATURE_SH_IS_ASH 11 default SH_IS_ASH
14 help 12 help
15 Choose which shell you want to be executed by 'sh' alias. 13 Choose which shell you want to be executed by 'sh' alias.
16 The ash shell is the most bash compatible and full featured one. 14 The ash shell is the most bash compatible and full featured one.
17 15
18# note: cannot use "select ASH" here, it breaks "make allnoconfig" 16# note: cannot use "select ASH" here, it breaks "make allnoconfig"
19config FEATURE_SH_IS_ASH 17config SH_IS_ASH
20 depends on ASH
21 bool "ash"
22 depends on !NOMMU 18 depends on !NOMMU
19 bool "ash"
23 20
24config FEATURE_SH_IS_HUSH 21config SH_IS_HUSH
25 depends on HUSH
26 bool "hush" 22 bool "hush"
27 23
28config FEATURE_SH_IS_NONE 24config SH_IS_NONE
29 bool "none" 25 bool "none"
30 26
31endchoice 27endchoice
32 28
33choice 29choice
34 prompt "Choose which shell is aliased to 'bash' name" 30 prompt "Choose which shell is aliased to 'bash' name"
35 default FEATURE_BASH_IS_NONE 31 default BASH_IS_NONE
36 help 32 help
37 Choose which shell you want to be executed by 'bash' alias. 33 Choose which shell you want to be executed by 'bash' alias.
38 The ash shell is the most bash compatible and full featured one. 34 The ash shell is the most bash compatible and full featured one.
@@ -47,32 +43,33 @@ choice
47 can't be used for running them because it won't recongnize 43 can't be used for running them because it won't recongnize
48 "bash" as a supported applet name. 44 "bash" as a supported applet name.
49 45
50config FEATURE_BASH_IS_ASH 46config BASH_IS_ASH
51 depends on ASH
52 bool "ash"
53 depends on !NOMMU 47 depends on !NOMMU
48 bool "ash"
54 49
55config FEATURE_BASH_IS_HUSH 50config BASH_IS_HUSH
56 depends on HUSH
57 bool "hush" 51 bool "hush"
58 52
59config FEATURE_BASH_IS_NONE 53config BASH_IS_NONE
60 bool "none" 54 bool "none"
61 55
62endchoice 56endchoice
63 57
64 58
65config SH_MATH_SUPPORT 59INSERT
60
61
62config FEATURE_SH_MATH
66 bool "POSIX math support" 63 bool "POSIX math support"
67 default y 64 default y
68 depends on ASH || HUSH 65 depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH
69 help 66 help
70 Enable math support in the shell via $((...)) syntax. 67 Enable math support in the shell via $((...)) syntax.
71 68
72config SH_MATH_SUPPORT_64 69config FEATURE_SH_MATH_64
73 bool "Extend POSIX math support to 64 bit" 70 bool "Extend POSIX math support to 64 bit"
74 default y 71 default y
75 depends on SH_MATH_SUPPORT 72 depends on FEATURE_SH_MATH
76 help 73 help
77 Enable 64-bit math support in the shell. This will make the shell 74 Enable 64-bit math support in the shell. This will make the shell
78 slightly larger, but will allow computation with very large numbers. 75 slightly larger, but will allow computation with very large numbers.
@@ -81,14 +78,14 @@ config SH_MATH_SUPPORT_64
81config FEATURE_SH_EXTRA_QUIET 78config FEATURE_SH_EXTRA_QUIET
82 bool "Hide message on interactive shell startup" 79 bool "Hide message on interactive shell startup"
83 default y 80 default y
84 depends on HUSH || ASH 81 depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH
85 help 82 help
86 Remove the busybox introduction when starting a shell. 83 Remove the busybox introduction when starting a shell.
87 84
88config FEATURE_SH_STANDALONE 85config FEATURE_SH_STANDALONE
89 bool "Standalone shell" 86 bool "Standalone shell"
90 default n 87 default n
91 depends on (HUSH || ASH) 88 depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH
92 help 89 help
93 This option causes busybox shells to use busybox applets 90 This option causes busybox shells to use busybox applets
94 in preference to executables in the PATH whenever possible. For 91 in preference to executables in the PATH whenever possible. For
@@ -121,7 +118,7 @@ config FEATURE_SH_STANDALONE
121config FEATURE_SH_NOFORK 118config FEATURE_SH_NOFORK
122 bool "Run 'nofork' applets directly" 119 bool "Run 'nofork' applets directly"
123 default n 120 default n
124 depends on (HUSH || ASH) 121 depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH
125 help 122 help
126 This option causes busybox shells to not execute typical 123 This option causes busybox shells to not execute typical
127 fork/exec/wait sequence, but call <applet>_main directly, 124 fork/exec/wait sequence, but call <applet>_main directly,
@@ -139,7 +136,7 @@ config FEATURE_SH_NOFORK
139config FEATURE_SH_HISTFILESIZE 136config FEATURE_SH_HISTFILESIZE
140 bool "Use $HISTFILESIZE" 137 bool "Use $HISTFILESIZE"
141 default y 138 default y
142 depends on HUSH || ASH 139 depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH
143 help 140 help
144 This option makes busybox shells to use $HISTFILESIZE variable 141 This option makes busybox shells to use $HISTFILESIZE variable
145 to set shell history size. Note that its max value is capped 142 to set shell history size. Note that its max value is capped
diff --git a/shell/Kbuild.src b/shell/Kbuild.src
index c00aec92a..6bba4989f 100644
--- a/shell/Kbuild.src
+++ b/shell/Kbuild.src
@@ -8,4 +8,4 @@ lib-y:=
8 8
9INSERT 9INSERT
10 10
11lib-$(CONFIG_SH_MATH_SUPPORT) += math.o 11lib-$(CONFIG_FEATURE_SH_MATH) += math.o
diff --git a/shell/ash.c b/shell/ash.c
index b11f36589..430e42a7b 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -29,14 +29,14 @@
29//config:config ASH_OPTIMIZE_FOR_SIZE 29//config:config ASH_OPTIMIZE_FOR_SIZE
30//config: bool "Optimize for size instead of speed" 30//config: bool "Optimize for size instead of speed"
31//config: default y 31//config: default y
32//config: depends on ASH 32//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
33//config: help 33//config: help
34//config: Compile ash for reduced size at the price of speed. 34//config: Compile ash for reduced size at the price of speed.
35//config: 35//config:
36//config:config ASH_INTERNAL_GLOB 36//config:config ASH_INTERNAL_GLOB
37//config: bool "Use internal glob() implementation" 37//config: bool "Use internal glob() implementation"
38//config: default y # Y is bigger, but because of uclibc glob() bug, let Y be default for now 38//config: default y # Y is bigger, but because of uclibc glob() bug, let Y be default for now
39//config: depends on ASH 39//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
40//config: help 40//config: help
41//config: Do not use glob() function from libc, use internal implementation. 41//config: Do not use glob() function from libc, use internal implementation.
42//config: Use this if you are getting "glob.h: No such file or directory" 42//config: Use this if you are getting "glob.h: No such file or directory"
@@ -45,7 +45,7 @@
45//config:config ASH_RANDOM_SUPPORT 45//config:config ASH_RANDOM_SUPPORT
46//config: bool "Pseudorandom generator and $RANDOM variable" 46//config: bool "Pseudorandom generator and $RANDOM variable"
47//config: default y 47//config: default y
48//config: depends on ASH 48//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
49//config: help 49//config: help
50//config: Enable pseudorandom generator and dynamic variable "$RANDOM". 50//config: Enable pseudorandom generator and dynamic variable "$RANDOM".
51//config: Each read of "$RANDOM" will generate a new pseudorandom value. 51//config: Each read of "$RANDOM" will generate a new pseudorandom value.
@@ -56,7 +56,7 @@
56//config:config ASH_EXPAND_PRMT 56//config:config ASH_EXPAND_PRMT
57//config: bool "Expand prompt string" 57//config: bool "Expand prompt string"
58//config: default y 58//config: default y
59//config: depends on ASH 59//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
60//config: help 60//config: help
61//config: "PS#" may contain volatile content, such as backquote commands. 61//config: "PS#" may contain volatile content, such as backquote commands.
62//config: This option recreates the prompt string from the environment 62//config: This option recreates the prompt string from the environment
@@ -65,70 +65,70 @@
65//config:config ASH_BASH_COMPAT 65//config:config ASH_BASH_COMPAT
66//config: bool "bash-compatible extensions" 66//config: bool "bash-compatible extensions"
67//config: default y 67//config: default y
68//config: depends on ASH 68//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
69//config: help 69//config: help
70//config: Enable bash-compatible extensions. 70//config: Enable bash-compatible extensions.
71//config: 71//config:
72//config:config ASH_IDLE_TIMEOUT 72//config:config ASH_IDLE_TIMEOUT
73//config: bool "Idle timeout variable" 73//config: bool "Idle timeout variable"
74//config: default n 74//config: default n
75//config: depends on ASH 75//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
76//config: help 76//config: help
77//config: Enables bash-like auto-logout after $TMOUT seconds of idle time. 77//config: Enables bash-like auto-logout after $TMOUT seconds of idle time.
78//config: 78//config:
79//config:config ASH_JOB_CONTROL 79//config:config ASH_JOB_CONTROL
80//config: bool "Job control" 80//config: bool "Job control"
81//config: default y 81//config: default y
82//config: depends on ASH 82//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
83//config: help 83//config: help
84//config: Enable job control in the ash shell. 84//config: Enable job control in the ash shell.
85//config: 85//config:
86//config:config ASH_ALIAS 86//config:config ASH_ALIAS
87//config: bool "Alias support" 87//config: bool "Alias support"
88//config: default y 88//config: default y
89//config: depends on ASH 89//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
90//config: help 90//config: help
91//config: Enable alias support in the ash shell. 91//config: Enable alias support in the ash shell.
92//config: 92//config:
93//config:config ASH_GETOPTS 93//config:config ASH_GETOPTS
94//config: bool "Builtin getopt to parse positional parameters" 94//config: bool "Builtin getopt to parse positional parameters"
95//config: default y 95//config: default y
96//config: depends on ASH 96//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
97//config: help 97//config: help
98//config: Enable support for getopts builtin in ash. 98//config: Enable support for getopts builtin in ash.
99//config: 99//config:
100//config:config ASH_BUILTIN_ECHO 100//config:config ASH_BUILTIN_ECHO
101//config: bool "Builtin version of 'echo'" 101//config: bool "Builtin version of 'echo'"
102//config: default y 102//config: default y
103//config: depends on ASH 103//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
104//config: help 104//config: help
105//config: Enable support for echo builtin in ash. 105//config: Enable support for echo builtin in ash.
106//config: 106//config:
107//config:config ASH_BUILTIN_PRINTF 107//config:config ASH_BUILTIN_PRINTF
108//config: bool "Builtin version of 'printf'" 108//config: bool "Builtin version of 'printf'"
109//config: default y 109//config: default y
110//config: depends on ASH 110//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
111//config: help 111//config: help
112//config: Enable support for printf builtin in ash. 112//config: Enable support for printf builtin in ash.
113//config: 113//config:
114//config:config ASH_BUILTIN_TEST 114//config:config ASH_BUILTIN_TEST
115//config: bool "Builtin version of 'test'" 115//config: bool "Builtin version of 'test'"
116//config: default y 116//config: default y
117//config: depends on ASH 117//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
118//config: help 118//config: help
119//config: Enable support for test builtin in ash. 119//config: Enable support for test builtin in ash.
120//config: 120//config:
121//config:config ASH_HELP 121//config:config ASH_HELP
122//config: bool "help builtin" 122//config: bool "help builtin"
123//config: default y 123//config: default y
124//config: depends on ASH 124//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
125//config: help 125//config: help
126//config: Enable help builtin in ash. 126//config: Enable help builtin in ash.
127//config: 127//config:
128//config:config ASH_CMDCMD 128//config:config ASH_CMDCMD
129//config: bool "'command' command to override shell builtins" 129//config: bool "'command' command to override shell builtins"
130//config: default y 130//config: default y
131//config: depends on ASH 131//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
132//config: help 132//config: help
133//config: Enable support for the ash 'command' builtin, which allows 133//config: Enable support for the ash 'command' builtin, which allows
134//config: you to run the specified command with the specified arguments, 134//config: you to run the specified command with the specified arguments,
@@ -137,15 +137,17 @@
137//config:config ASH_MAIL 137//config:config ASH_MAIL
138//config: bool "Check for new mail on interactive shells" 138//config: bool "Check for new mail on interactive shells"
139//config: default y 139//config: default y
140//config: depends on ASH 140//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
141//config: help 141//config: help
142//config: Enable "check for new mail" function in the ash shell. 142//config: Enable "check for new mail" function in the ash shell.
143 143
144//applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP)) 144//applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
145//applet:IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, sh)) 145//applet:IF_SH_IS_ASH(APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
146//applet:IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, bash)) 146//applet:IF_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
147 147
148//kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o 148//kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o
149//kbuild:lib-$(CONFIG_SH_IS_ASH) += ash.o ash_ptr_hack.o shell_common.o
150//kbuild:lib-$(CONFIG_BASH_IS_ASH) += ash.o ash_ptr_hack.o shell_common.o
149//kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o 151//kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
150 152
151/* 153/*
@@ -200,7 +202,7 @@
200 202
201#include "unicode.h" 203#include "unicode.h"
202#include "shell_common.h" 204#include "shell_common.h"
203#if ENABLE_SH_MATH_SUPPORT 205#if ENABLE_FEATURE_SH_MATH
204# include "math.h" 206# include "math.h"
205#endif 207#endif
206#if ENABLE_ASH_RANDOM_SUPPORT 208#if ENABLE_ASH_RANDOM_SUPPORT
@@ -2144,6 +2146,7 @@ lookupvar(const char *name)
2144 return NULL; 2146 return NULL;
2145} 2147}
2146 2148
2149#if ENABLE_UNICODE_SUPPORT
2147static void 2150static void
2148reinit_unicode_for_ash(void) 2151reinit_unicode_for_ash(void)
2149{ 2152{
@@ -2160,6 +2163,9 @@ reinit_unicode_for_ash(void)
2160 reinit_unicode(s); 2163 reinit_unicode(s);
2161 } 2164 }
2162} 2165}
2166#else
2167# define reinit_unicode_for_ash() ((void)0)
2168#endif
2163 2169
2164/* 2170/*
2165 * Search the environment of a builtin command. 2171 * Search the environment of a builtin command.
@@ -2741,7 +2747,7 @@ pwdcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
2741 2747
2742#define USE_SIT_FUNCTION ENABLE_ASH_OPTIMIZE_FOR_SIZE 2748#define USE_SIT_FUNCTION ENABLE_ASH_OPTIMIZE_FOR_SIZE
2743 2749
2744#if ENABLE_SH_MATH_SUPPORT 2750#if ENABLE_FEATURE_SH_MATH
2745# define SIT_ITEM(a,b,c,d) (a | (b << 4) | (c << 8) | (d << 12)) 2751# define SIT_ITEM(a,b,c,d) (a | (b << 4) | (c << 8) | (d << 12))
2746#else 2752#else
2747# define SIT_ITEM(a,b,c,d) (a | (b << 4) | (c << 8)) 2753# define SIT_ITEM(a,b,c,d) (a | (b << 4) | (c << 8))
@@ -3129,7 +3135,7 @@ static const uint8_t syntax_index_table[] ALIGN1 = {
3129 ({ \ 3135 ({ \
3130 if ((c) < 0 || (c) > (PEOF + ENABLE_ASH_ALIAS)) \ 3136 if ((c) < 0 || (c) > (PEOF + ENABLE_ASH_ALIAS)) \
3131 bb_error_msg_and_die("line:%d c:%d", __LINE__, (c)); \ 3137 bb_error_msg_and_die("line:%d c:%d", __LINE__, (c)); \
3132 if ((syntax) < 0 || (syntax) > (2 + ENABLE_SH_MATH_SUPPORT)) \ 3138 if ((syntax) < 0 || (syntax) > (2 + ENABLE_FEATURE_SH_MATH)) \
3133 bb_error_msg_and_die("line:%d c:%d", __LINE__, (c)); \ 3139 bb_error_msg_and_die("line:%d c:%d", __LINE__, (c)); \
3134 ((S_I_T[syntax_index_table[c]] >> ((syntax)*4)) & 0xf); \ 3140 ((S_I_T[syntax_index_table[c]] >> ((syntax)*4)) & 0xf); \
3135 }) 3141 })
@@ -4487,7 +4493,7 @@ cmdputs(const char *s)
4487 case CTLBACKQ: 4493 case CTLBACKQ:
4488 str = "$(...)"; 4494 str = "$(...)";
4489 goto dostr; 4495 goto dostr;
4490#if ENABLE_SH_MATH_SUPPORT 4496#if ENABLE_FEATURE_SH_MATH
4491 case CTLARI: 4497 case CTLARI:
4492 str = "$(("; 4498 str = "$((";
4493 goto dostr; 4499 goto dostr;
@@ -5547,7 +5553,7 @@ redirectsafe(union node *redir, int flags)
5547 * We have to deal with backquotes, shell variables, and file metacharacters. 5553 * We have to deal with backquotes, shell variables, and file metacharacters.
5548 */ 5554 */
5549 5555
5550#if ENABLE_SH_MATH_SUPPORT 5556#if ENABLE_FEATURE_SH_MATH
5551static arith_t 5557static arith_t
5552ash_arith(const char *s) 5558ash_arith(const char *s)
5553{ 5559{
@@ -5635,7 +5641,7 @@ static struct arglist exparg;
5635/* 5641/*
5636 * Our own itoa(). 5642 * Our own itoa().
5637 */ 5643 */
5638#if !ENABLE_SH_MATH_SUPPORT 5644#if !ENABLE_FEATURE_SH_MATH
5639/* cvtnum() is used even if math support is off (to prepare $? values and such) */ 5645/* cvtnum() is used even if math support is off (to prepare $? values and such) */
5640typedef long arith_t; 5646typedef long arith_t;
5641# define ARITH_FMT "%ld" 5647# define ARITH_FMT "%ld"
@@ -6148,7 +6154,7 @@ expbackq(union node *cmd, int flag)
6148 stackblock() + startloc)); 6154 stackblock() + startloc));
6149} 6155}
6150 6156
6151#if ENABLE_SH_MATH_SUPPORT 6157#if ENABLE_FEATURE_SH_MATH
6152/* 6158/*
6153 * Expand arithmetic expression. Backup to start of expression, 6159 * Expand arithmetic expression. Backup to start of expression,
6154 * evaluate, place result in (backed up) result, adjust string position. 6160 * evaluate, place result in (backed up) result, adjust string position.
@@ -6230,7 +6236,7 @@ argstr(char *p, int flags, struct strlist *var_str_list)
6230 CTLESC, 6236 CTLESC,
6231 CTLVAR, 6237 CTLVAR,
6232 CTLBACKQ, 6238 CTLBACKQ,
6233#if ENABLE_SH_MATH_SUPPORT 6239#if ENABLE_FEATURE_SH_MATH
6234 CTLENDARI, 6240 CTLENDARI,
6235#endif 6241#endif
6236 '\0' 6242 '\0'
@@ -6266,7 +6272,7 @@ argstr(char *p, int flags, struct strlist *var_str_list)
6266 c = p[length]; 6272 c = p[length];
6267 if (c) { 6273 if (c) {
6268 if (!(c & 0x80) 6274 if (!(c & 0x80)
6269 IF_SH_MATH_SUPPORT(|| c == CTLENDARI) 6275 IF_FEATURE_SH_MATH(|| c == CTLENDARI)
6270 ) { 6276 ) {
6271 /* c == '=' || c == ':' || c == CTLENDARI */ 6277 /* c == '=' || c == ':' || c == CTLENDARI */
6272 length++; 6278 length++;
@@ -6346,7 +6352,7 @@ argstr(char *p, int flags, struct strlist *var_str_list)
6346 expbackq(argbackq->n, flags | inquotes); 6352 expbackq(argbackq->n, flags | inquotes);
6347 argbackq = argbackq->next; 6353 argbackq = argbackq->next;
6348 goto start; 6354 goto start;
6349#if ENABLE_SH_MATH_SUPPORT 6355#if ENABLE_FEATURE_SH_MATH
6350 case CTLENDARI: 6356 case CTLENDARI:
6351 p--; 6357 p--;
6352 expari(flags | inquotes); 6358 expari(flags | inquotes);
@@ -9265,7 +9271,7 @@ static int helpcmd(int, char **) FAST_FUNC;
9265#if MAX_HISTORY 9271#if MAX_HISTORY
9266static int historycmd(int, char **) FAST_FUNC; 9272static int historycmd(int, char **) FAST_FUNC;
9267#endif 9273#endif
9268#if ENABLE_SH_MATH_SUPPORT 9274#if ENABLE_FEATURE_SH_MATH
9269static int letcmd(int, char **) FAST_FUNC; 9275static int letcmd(int, char **) FAST_FUNC;
9270#endif 9276#endif
9271static int readcmd(int, char **) FAST_FUNC; 9277static int readcmd(int, char **) FAST_FUNC;
@@ -9345,7 +9351,7 @@ static const struct builtincmd builtintab[] = {
9345 { BUILTIN_REGULAR "jobs" , jobscmd }, 9351 { BUILTIN_REGULAR "jobs" , jobscmd },
9346 { BUILTIN_REGULAR "kill" , killcmd }, 9352 { BUILTIN_REGULAR "kill" , killcmd },
9347#endif 9353#endif
9348#if ENABLE_SH_MATH_SUPPORT 9354#if ENABLE_FEATURE_SH_MATH
9349 { BUILTIN_NOSPEC "let" , letcmd }, 9355 { BUILTIN_NOSPEC "let" , letcmd },
9350#endif 9356#endif
9351 { BUILTIN_ASSIGN "local" , localcmd }, 9357 { BUILTIN_ASSIGN "local" , localcmd },
@@ -11394,13 +11400,13 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11394 smallint quotef; 11400 smallint quotef;
11395 smallint dblquote; 11401 smallint dblquote;
11396 smallint oldstyle; 11402 smallint oldstyle;
11397 IF_SH_MATH_SUPPORT(smallint prevsyntax;) /* syntax before arithmetic */ 11403 IF_FEATURE_SH_MATH(smallint prevsyntax;) /* syntax before arithmetic */
11398#if ENABLE_ASH_EXPAND_PRMT 11404#if ENABLE_ASH_EXPAND_PRMT
11399 smallint pssyntax; /* we are expanding a prompt string */ 11405 smallint pssyntax; /* we are expanding a prompt string */
11400#endif 11406#endif
11401 int varnest; /* levels of variables expansion */ 11407 int varnest; /* levels of variables expansion */
11402 IF_SH_MATH_SUPPORT(int arinest;) /* levels of arithmetic expansion */ 11408 IF_FEATURE_SH_MATH(int arinest;) /* levels of arithmetic expansion */
11403 IF_SH_MATH_SUPPORT(int parenlevel;) /* levels of parens in arithmetic */ 11409 IF_FEATURE_SH_MATH(int parenlevel;) /* levels of parens in arithmetic */
11404 int dqvarnest; /* levels of variables expansion within double quotes */ 11410 int dqvarnest; /* levels of variables expansion within double quotes */
11405 11411
11406 IF_ASH_BASH_COMPAT(smallint bash_dollar_squote = 0;) 11412 IF_ASH_BASH_COMPAT(smallint bash_dollar_squote = 0;)
@@ -11408,7 +11414,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11408 startlinno = g_parsefile->linno; 11414 startlinno = g_parsefile->linno;
11409 bqlist = NULL; 11415 bqlist = NULL;
11410 quotef = 0; 11416 quotef = 0;
11411 IF_SH_MATH_SUPPORT(prevsyntax = 0;) 11417 IF_FEATURE_SH_MATH(prevsyntax = 0;)
11412#if ENABLE_ASH_EXPAND_PRMT 11418#if ENABLE_ASH_EXPAND_PRMT
11413 pssyntax = (syntax == PSSYNTAX); 11419 pssyntax = (syntax == PSSYNTAX);
11414 if (pssyntax) 11420 if (pssyntax)
@@ -11416,8 +11422,8 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11416#endif 11422#endif
11417 dblquote = (syntax == DQSYNTAX); 11423 dblquote = (syntax == DQSYNTAX);
11418 varnest = 0; 11424 varnest = 0;
11419 IF_SH_MATH_SUPPORT(arinest = 0;) 11425 IF_FEATURE_SH_MATH(arinest = 0;)
11420 IF_SH_MATH_SUPPORT(parenlevel = 0;) 11426 IF_FEATURE_SH_MATH(parenlevel = 0;)
11421 dqvarnest = 0; 11427 dqvarnest = 0;
11422 11428
11423 STARTSTACKSTR(out); 11429 STARTSTACKSTR(out);
@@ -11524,7 +11530,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11524 } 11530 }
11525 USTPUTC(c, out); 11531 USTPUTC(c, out);
11526 break; 11532 break;
11527#if ENABLE_SH_MATH_SUPPORT 11533#if ENABLE_FEATURE_SH_MATH
11528 case CLP: /* '(' in arithmetic */ 11534 case CLP: /* '(' in arithmetic */
11529 parenlevel++; 11535 parenlevel++;
11530 USTPUTC(c, out); 11536 USTPUTC(c, out);
@@ -11575,7 +11581,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11575 } /* for (;;) */ 11581 } /* for (;;) */
11576 endword: 11582 endword:
11577 11583
11578#if ENABLE_SH_MATH_SUPPORT 11584#if ENABLE_FEATURE_SH_MATH
11579 if (syntax == ARISYNTAX) 11585 if (syntax == ARISYNTAX)
11580 raise_error_syntax("missing '))'"); 11586 raise_error_syntax("missing '))'");
11581#endif 11587#endif
@@ -11754,7 +11760,7 @@ parsesub: {
11754 } else if (c == '(') { 11760 } else if (c == '(') {
11755 /* $(command) or $((arith)) */ 11761 /* $(command) or $((arith)) */
11756 if (pgetc_eatbnl() == '(') { 11762 if (pgetc_eatbnl() == '(') {
11757#if ENABLE_SH_MATH_SUPPORT 11763#if ENABLE_FEATURE_SH_MATH
11758 PARSEARITH(); 11764 PARSEARITH();
11759#else 11765#else
11760 raise_error_syntax("you disabled math support for $((arith)) syntax"); 11766 raise_error_syntax("you disabled math support for $((arith)) syntax");
@@ -12009,7 +12015,7 @@ parsebackq: {
12009 goto parsebackq_newreturn; 12015 goto parsebackq_newreturn;
12010} 12016}
12011 12017
12012#if ENABLE_SH_MATH_SUPPORT 12018#if ENABLE_FEATURE_SH_MATH
12013/* 12019/*
12014 * Parse an arithmetic expansion (indicate start of one and set state) 12020 * Parse an arithmetic expansion (indicate start of one and set state)
12015 */ 12021 */
@@ -13046,7 +13052,7 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
13046 return 0; 13052 return 0;
13047} 13053}
13048 13054
13049#if ENABLE_SH_MATH_SUPPORT 13055#if ENABLE_FEATURE_SH_MATH
13050/* 13056/*
13051 * The let builtin. Partially stolen from GNU Bash, the Bourne Again SHell. 13057 * The let builtin. Partially stolen from GNU Bash, the Bourne Again SHell.
13052 * Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc. 13058 * Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
@@ -13301,15 +13307,6 @@ init(void)
13301//usage:#define ash_full_usage "\n\n" 13307//usage:#define ash_full_usage "\n\n"
13302//usage: "Unix shell interpreter" 13308//usage: "Unix shell interpreter"
13303 13309
13304//usage:#if ENABLE_FEATURE_SH_IS_ASH
13305//usage:# define sh_trivial_usage ash_trivial_usage
13306//usage:# define sh_full_usage ash_full_usage
13307//usage:#endif
13308//usage:#if ENABLE_FEATURE_BASH_IS_ASH
13309//usage:# define bash_trivial_usage ash_trivial_usage
13310//usage:# define bash_full_usage ash_full_usage
13311//usage:#endif
13312
13313/* 13310/*
13314 * Process the shell command line arguments. 13311 * Process the shell command line arguments.
13315 */ 13312 */
diff --git a/shell/hush.c b/shell/hush.c
index c5821259a..fecc89294 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -99,7 +99,7 @@
99//config:config HUSH_BASH_COMPAT 99//config:config HUSH_BASH_COMPAT
100//config: bool "bash-compatible extensions" 100//config: bool "bash-compatible extensions"
101//config: default y 101//config: default y
102//config: depends on HUSH 102//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
103//config: help 103//config: help
104//config: Enable bash-compatible extensions. 104//config: Enable bash-compatible extensions.
105//config: 105//config:
@@ -113,14 +113,14 @@
113//config:config HUSH_HELP 113//config:config HUSH_HELP
114//config: bool "help builtin" 114//config: bool "help builtin"
115//config: default y 115//config: default y
116//config: depends on HUSH 116//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
117//config: help 117//config: help
118//config: Enable help builtin in hush. Code size + ~1 kbyte. 118//config: Enable help builtin in hush. Code size + ~1 kbyte.
119//config: 119//config:
120//config:config HUSH_INTERACTIVE 120//config:config HUSH_INTERACTIVE
121//config: bool "Interactive mode" 121//config: bool "Interactive mode"
122//config: default y 122//config: default y
123//config: depends on HUSH 123//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
124//config: help 124//config: help
125//config: Enable interactive mode (prompt and command editing). 125//config: Enable interactive mode (prompt and command editing).
126//config: Without this, hush simply reads and executes commands 126//config: Without this, hush simply reads and executes commands
@@ -148,35 +148,35 @@
148//config:config HUSH_TICK 148//config:config HUSH_TICK
149//config: bool "Process substitution" 149//config: bool "Process substitution"
150//config: default y 150//config: default y
151//config: depends on HUSH 151//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
152//config: help 152//config: help
153//config: Enable process substitution `command` and $(command) in hush. 153//config: Enable process substitution `command` and $(command) in hush.
154//config: 154//config:
155//config:config HUSH_IF 155//config:config HUSH_IF
156//config: bool "Support if/then/elif/else/fi" 156//config: bool "Support if/then/elif/else/fi"
157//config: default y 157//config: default y
158//config: depends on HUSH 158//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
159//config: help 159//config: help
160//config: Enable if/then/elif/else/fi in hush. 160//config: Enable if/then/elif/else/fi in hush.
161//config: 161//config:
162//config:config HUSH_LOOPS 162//config:config HUSH_LOOPS
163//config: bool "Support for, while and until loops" 163//config: bool "Support for, while and until loops"
164//config: default y 164//config: default y
165//config: depends on HUSH 165//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
166//config: help 166//config: help
167//config: Enable for, while and until loops in hush. 167//config: Enable for, while and until loops in hush.
168//config: 168//config:
169//config:config HUSH_CASE 169//config:config HUSH_CASE
170//config: bool "Support case ... esac statement" 170//config: bool "Support case ... esac statement"
171//config: default y 171//config: default y
172//config: depends on HUSH 172//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
173//config: help 173//config: help
174//config: Enable case ... esac statement in hush. +400 bytes. 174//config: Enable case ... esac statement in hush. +400 bytes.
175//config: 175//config:
176//config:config HUSH_FUNCTIONS 176//config:config HUSH_FUNCTIONS
177//config: bool "Support funcname() { commands; } syntax" 177//config: bool "Support funcname() { commands; } syntax"
178//config: default y 178//config: default y
179//config: depends on HUSH 179//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
180//config: help 180//config: help
181//config: Enable support for shell functions in hush. +800 bytes. 181//config: Enable support for shell functions in hush. +800 bytes.
182//config: 182//config:
@@ -190,7 +190,7 @@
190//config:config HUSH_RANDOM_SUPPORT 190//config:config HUSH_RANDOM_SUPPORT
191//config: bool "Pseudorandom generator and $RANDOM variable" 191//config: bool "Pseudorandom generator and $RANDOM variable"
192//config: default y 192//config: default y
193//config: depends on HUSH 193//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
194//config: help 194//config: help
195//config: Enable pseudorandom generator and dynamic variable "$RANDOM". 195//config: Enable pseudorandom generator and dynamic variable "$RANDOM".
196//config: Each read of "$RANDOM" will generate a new pseudorandom value. 196//config: Each read of "$RANDOM" will generate a new pseudorandom value.
@@ -198,14 +198,14 @@
198//config:config HUSH_EXPORT_N 198//config:config HUSH_EXPORT_N
199//config: bool "Support 'export -n' option" 199//config: bool "Support 'export -n' option"
200//config: default y 200//config: default y
201//config: depends on HUSH 201//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
202//config: help 202//config: help
203//config: export -n unexports variables. It is a bash extension. 203//config: export -n unexports variables. It is a bash extension.
204//config: 204//config:
205//config:config HUSH_MODE_X 205//config:config HUSH_MODE_X
206//config: bool "Support 'hush -x' option and 'set -x' command" 206//config: bool "Support 'hush -x' option and 'set -x' command"
207//config: default y 207//config: default y
208//config: depends on HUSH 208//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
209//config: help 209//config: help
210//config: This instructs hush to print commands before execution. 210//config: This instructs hush to print commands before execution.
211//config: Adds ~300 bytes. 211//config: Adds ~300 bytes.
@@ -216,14 +216,15 @@
216//config: select HUSH 216//config: select HUSH
217//config: help 217//config: help
218//config: msh is deprecated and will be removed, please migrate to hush. 218//config: msh is deprecated and will be removed, please migrate to hush.
219//config:
220 219
221//applet:IF_HUSH(APPLET(hush, BB_DIR_BIN, BB_SUID_DROP)) 220//applet:IF_HUSH(APPLET(hush, BB_DIR_BIN, BB_SUID_DROP))
222//applet:IF_MSH(APPLET(msh, BB_DIR_BIN, BB_SUID_DROP)) 221//applet:IF_MSH(APPLET_ODDNAME(msh, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
223//applet:IF_FEATURE_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, BB_DIR_BIN, BB_SUID_DROP, sh)) 222//applet:IF_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
224//applet:IF_FEATURE_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, BB_DIR_BIN, BB_SUID_DROP, bash)) 223//applet:IF_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
225 224
226//kbuild:lib-$(CONFIG_HUSH) += hush.o match.o shell_common.o 225//kbuild:lib-$(CONFIG_HUSH) += hush.o match.o shell_common.o
226//kbuild:lib-$(CONFIG_SH_IS_HUSH) += hush.o match.o shell_common.o
227//kbuild:lib-$(CONFIG_BASH_IS_HUSH) += hush.o match.o shell_common.o
227//kbuild:lib-$(CONFIG_HUSH_RANDOM_SUPPORT) += random.o 228//kbuild:lib-$(CONFIG_HUSH_RANDOM_SUPPORT) += random.o
228 229
229/* -i (interactive) and -s (read stdin) are also accepted, 230/* -i (interactive) and -s (read stdin) are also accepted,
@@ -236,18 +237,6 @@
236//usage:#define hush_full_usage "\n\n" 237//usage:#define hush_full_usage "\n\n"
237//usage: "Unix shell interpreter" 238//usage: "Unix shell interpreter"
238 239
239//usage:#define msh_trivial_usage hush_trivial_usage
240//usage:#define msh_full_usage hush_full_usage
241
242//usage:#if ENABLE_FEATURE_SH_IS_HUSH
243//usage:# define sh_trivial_usage hush_trivial_usage
244//usage:# define sh_full_usage hush_full_usage
245//usage:#endif
246//usage:#if ENABLE_FEATURE_BASH_IS_HUSH
247//usage:# define bash_trivial_usage hush_trivial_usage
248//usage:# define bash_full_usage hush_full_usage
249//usage:#endif
250
251#if !(defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \ 240#if !(defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
252 || defined(__APPLE__) \ 241 || defined(__APPLE__) \
253 ) 242 )
@@ -4011,7 +4000,7 @@ static int i_peek_and_eat_bkslash_nl(struct in_str *input)
4011 } 4000 }
4012} 4001}
4013 4002
4014#if ENABLE_HUSH_TICK || ENABLE_SH_MATH_SUPPORT || ENABLE_HUSH_DOLLAR_OPS 4003#if ENABLE_HUSH_TICK || ENABLE_FEATURE_SH_MATH || ENABLE_HUSH_DOLLAR_OPS
4015/* Subroutines for copying $(...) and `...` things */ 4004/* Subroutines for copying $(...) and `...` things */
4016static int add_till_backquote(o_string *dest, struct in_str *input, int in_dquote); 4005static int add_till_backquote(o_string *dest, struct in_str *input, int in_dquote);
4017/* '...' */ 4006/* '...' */
@@ -4179,7 +4168,7 @@ static int add_till_closing_bracket(o_string *dest, struct in_str *input, unsign
4179 } 4168 }
4180 return ch; 4169 return ch;
4181} 4170}
4182#endif /* ENABLE_HUSH_TICK || ENABLE_SH_MATH_SUPPORT || ENABLE_HUSH_DOLLAR_OPS */ 4171#endif /* ENABLE_HUSH_TICK || ENABLE_FEATURE_SH_MATH || ENABLE_HUSH_DOLLAR_OPS */
4183 4172
4184/* Return code: 0 for OK, 1 for syntax error */ 4173/* Return code: 0 for OK, 1 for syntax error */
4185#if BB_MMU 4174#if BB_MMU
@@ -4333,13 +4322,13 @@ static int parse_dollar(o_string *as_string,
4333 o_addchr(dest, SPECIAL_VAR_SYMBOL); 4322 o_addchr(dest, SPECIAL_VAR_SYMBOL);
4334 break; 4323 break;
4335 } 4324 }
4336#if ENABLE_SH_MATH_SUPPORT || ENABLE_HUSH_TICK 4325#if ENABLE_FEATURE_SH_MATH || ENABLE_HUSH_TICK
4337 case '(': { 4326 case '(': {
4338 unsigned pos; 4327 unsigned pos;
4339 4328
4340 ch = i_getch(input); 4329 ch = i_getch(input);
4341 nommu_addchr(as_string, ch); 4330 nommu_addchr(as_string, ch);
4342# if ENABLE_SH_MATH_SUPPORT 4331# if ENABLE_FEATURE_SH_MATH
4343 if (i_peek_and_eat_bkslash_nl(input) == '(') { 4332 if (i_peek_and_eat_bkslash_nl(input) == '(') {
4344 ch = i_getch(input); 4333 ch = i_getch(input);
4345 nommu_addchr(as_string, ch); 4334 nommu_addchr(as_string, ch);
@@ -5217,7 +5206,7 @@ static char *encode_then_expand_string(const char *str, int process_bkslash, int
5217 return exp_str; 5206 return exp_str;
5218} 5207}
5219 5208
5220#if ENABLE_SH_MATH_SUPPORT 5209#if ENABLE_FEATURE_SH_MATH
5221static arith_t expand_and_evaluate_arith(const char *arg, const char **errmsg_p) 5210static arith_t expand_and_evaluate_arith(const char *arg, const char **errmsg_p)
5222{ 5211{
5223 arith_state_t math_state; 5212 arith_state_t math_state;
@@ -5469,7 +5458,7 @@ static NOINLINE const char *expand_one_var(char **to_be_freed_pp, char *arg, cha
5469 } 5458 }
5470#endif 5459#endif
5471 else if (exp_op == ':') { 5460 else if (exp_op == ':') {
5472#if ENABLE_HUSH_BASH_COMPAT && ENABLE_SH_MATH_SUPPORT 5461#if ENABLE_HUSH_BASH_COMPAT && ENABLE_FEATURE_SH_MATH
5473 /* It's ${var:N[:M]} bashism. 5462 /* It's ${var:N[:M]} bashism.
5474 * Note that in encoded form it has TWO parts: 5463 * Note that in encoded form it has TWO parts:
5475 * var:N<SPECIAL_VAR_SYMBOL>M<SPECIAL_VAR_SYMBOL> 5464 * var:N<SPECIAL_VAR_SYMBOL>M<SPECIAL_VAR_SYMBOL>
@@ -5604,7 +5593,7 @@ static NOINLINE int expand_vars_to_list(o_string *output, int n, char *arg)
5604#if ENABLE_HUSH_TICK 5593#if ENABLE_HUSH_TICK
5605 o_string subst_result = NULL_O_STRING; 5594 o_string subst_result = NULL_O_STRING;
5606#endif 5595#endif
5607#if ENABLE_SH_MATH_SUPPORT 5596#if ENABLE_FEATURE_SH_MATH
5608 char arith_buf[sizeof(arith_t)*3 + 2]; 5597 char arith_buf[sizeof(arith_t)*3 + 2];
5609#endif 5598#endif
5610 5599
@@ -5698,7 +5687,7 @@ static NOINLINE int expand_vars_to_list(o_string *output, int n, char *arg)
5698 val = subst_result.data; 5687 val = subst_result.data;
5699 goto store_val; 5688 goto store_val;
5700#endif 5689#endif
5701#if ENABLE_SH_MATH_SUPPORT 5690#if ENABLE_FEATURE_SH_MATH
5702 case '+': { /* <SPECIAL_VAR_SYMBOL>+cmd<SPECIAL_VAR_SYMBOL> */ 5691 case '+': { /* <SPECIAL_VAR_SYMBOL>+cmd<SPECIAL_VAR_SYMBOL> */
5703 arith_t res; 5692 arith_t res;
5704 5693
diff --git a/shell/math.h b/shell/math.h
index 864bee691..32e1ffe35 100644
--- a/shell/math.h
+++ b/shell/math.h
@@ -63,7 +63,7 @@
63 63
64PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 64PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
65 65
66#if ENABLE_SH_MATH_SUPPORT_64 66#if ENABLE_FEATURE_SH_MATH_64
67typedef long long arith_t; 67typedef long long arith_t;
68#define ARITH_FMT "%lld" 68#define ARITH_FMT "%lld"
69#define strto_arith_t strtoull 69#define strto_arith_t strtoull