diff options
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/shell/hush.c b/shell/hush.c index ef0c454ec..4ca5403de 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -4463,15 +4463,16 @@ static char *encode_then_expand_string(const char *str, int process_bkslash, int | |||
4463 | #if ENABLE_SH_MATH_SUPPORT | 4463 | #if ENABLE_SH_MATH_SUPPORT |
4464 | static arith_t expand_and_evaluate_arith(const char *arg, int *errcode_p) | 4464 | static arith_t expand_and_evaluate_arith(const char *arg, int *errcode_p) |
4465 | { | 4465 | { |
4466 | arith_eval_hooks_t hooks; | 4466 | arith_state_t math_state; |
4467 | arith_t res; | 4467 | arith_t res; |
4468 | char *exp_str; | 4468 | char *exp_str; |
4469 | 4469 | ||
4470 | hooks.lookupvar = get_local_var_value; | 4470 | math_state.lookupvar = get_local_var_value; |
4471 | hooks.setvar = set_local_var_from_halves; | 4471 | math_state.setvar = set_local_var_from_halves; |
4472 | //hooks.endofname = endofname; | 4472 | //math_state.endofname = endofname; |
4473 | exp_str = encode_then_expand_string(arg, /*process_bkslash:*/ 1, /*unbackslash:*/ 1); | 4473 | exp_str = encode_then_expand_string(arg, /*process_bkslash:*/ 1, /*unbackslash:*/ 1); |
4474 | res = arith(exp_str ? exp_str : arg, errcode_p, &hooks); | 4474 | res = arith(&math_state, exp_str ? exp_str : arg); |
4475 | *errcode_p = math_state.errcode; | ||
4475 | free(exp_str); | 4476 | free(exp_str); |
4476 | return res; | 4477 | return res; |
4477 | } | 4478 | } |