diff options
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 95 |
1 files changed, 46 insertions, 49 deletions
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 | ||
2147 | static void | 2150 | static void |
2148 | reinit_unicode_for_ash(void) | 2151 | reinit_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 |
5551 | static arith_t | 5557 | static arith_t |
5552 | ash_arith(const char *s) | 5558 | ash_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) */ |
5640 | typedef long arith_t; | 5646 | typedef 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 |
9266 | static int historycmd(int, char **) FAST_FUNC; | 9272 | static int historycmd(int, char **) FAST_FUNC; |
9267 | #endif | 9273 | #endif |
9268 | #if ENABLE_SH_MATH_SUPPORT | 9274 | #if ENABLE_FEATURE_SH_MATH |
9269 | static int letcmd(int, char **) FAST_FUNC; | 9275 | static int letcmd(int, char **) FAST_FUNC; |
9270 | #endif | 9276 | #endif |
9271 | static int readcmd(int, char **) FAST_FUNC; | 9277 | static 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 | */ |