diff options
Diffstat (limited to 'coreutils/expr.c')
| -rw-r--r-- | coreutils/expr.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/coreutils/expr.c b/coreutils/expr.c index 2f9c5c1e3..d659b670b 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
| @@ -481,24 +481,21 @@ static VALUE *eval(void) | |||
| 481 | } | 481 | } |
| 482 | 482 | ||
| 483 | int expr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 483 | int expr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
| 484 | int expr_main(int argc, char **argv) | 484 | int expr_main(int argc UNUSED_PARAM, char **argv) |
| 485 | { | 485 | { |
| 486 | VALUE *v; | 486 | VALUE *v; |
| 487 | 487 | ||
| 488 | if (argc == 1) { | 488 | xfunc_error_retval = 2; /* coreutils compat */ |
| 489 | G.args = argv + 1; | ||
| 490 | if (*G.args == NULL) { | ||
| 489 | bb_error_msg_and_die("too few arguments"); | 491 | bb_error_msg_and_die("too few arguments"); |
| 490 | } | 492 | } |
| 491 | |||
| 492 | G.args = argv + 1; | ||
| 493 | |||
| 494 | v = eval(); | 493 | v = eval(); |
| 495 | if (*G.args) | 494 | if (*G.args) |
| 496 | bb_error_msg_and_die("syntax error"); | 495 | bb_error_msg_and_die("syntax error"); |
| 497 | |||
| 498 | if (v->type == INTEGER) | 496 | if (v->type == INTEGER) |
| 499 | printf("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i); | 497 | printf("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i); |
| 500 | else | 498 | else |
| 501 | puts(v->u.s); | 499 | puts(v->u.s); |
| 502 | |||
| 503 | fflush_stdout_and_exit(null(v)); | 500 | fflush_stdout_and_exit(null(v)); |
| 504 | } | 501 | } |
