diff options
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/shell/ash.c b/shell/ash.c index f631e3d25..c27ab7de2 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -5442,22 +5442,21 @@ redirectsafe(union node *redir, int flags) | |||
5442 | static arith_t | 5442 | static arith_t |
5443 | ash_arith(const char *s) | 5443 | ash_arith(const char *s) |
5444 | { | 5444 | { |
5445 | arith_eval_hooks_t math_hooks; | 5445 | arith_state_t math_state; |
5446 | arith_t result; | 5446 | arith_t result; |
5447 | int errcode = 0; | ||
5448 | 5447 | ||
5449 | math_hooks.lookupvar = lookupvar; | 5448 | math_state.lookupvar = lookupvar; |
5450 | math_hooks.setvar = setvar2; | 5449 | math_state.setvar = setvar2; |
5451 | //math_hooks.endofname = endofname; | 5450 | //math_state.endofname = endofname; |
5452 | 5451 | ||
5453 | INT_OFF; | 5452 | INT_OFF; |
5454 | result = arith(s, &errcode, &math_hooks); | 5453 | result = arith(&math_state, s); |
5455 | if (errcode < 0) { | 5454 | if (math_state.errcode < 0) { |
5456 | if (errcode == -3) | 5455 | if (math_state.errcode == -3) |
5457 | ash_msg_and_raise_error("exponent less than 0"); | 5456 | ash_msg_and_raise_error("exponent less than 0"); |
5458 | if (errcode == -2) | 5457 | if (math_state.errcode == -2) |
5459 | ash_msg_and_raise_error("divide by zero"); | 5458 | ash_msg_and_raise_error("divide by zero"); |
5460 | if (errcode == -5) | 5459 | if (math_state.errcode == -5) |
5461 | ash_msg_and_raise_error("expression recursion loop detected"); | 5460 | ash_msg_and_raise_error("expression recursion loop detected"); |
5462 | raise_error_syntax(s); | 5461 | raise_error_syntax(s); |
5463 | } | 5462 | } |