diff options
Diffstat (limited to 'src/expr.c')
| -rw-r--r-- | src/expr.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/expr.c b/src/expr.c index 6ae0fae79..8a76cbf7c 100644 --- a/src/expr.c +++ b/src/expr.c @@ -35,8 +35,6 @@ #include <gmp.h> #include <regex.h> -#include "die.h" -#include "error.h" #include "long-options.h" #include "mbuiter.h" #include "strnumcmp.h" @@ -352,8 +350,8 @@ main (int argc, char **argv) v = eval (true); if (!nomoreargs ()) - die (EXPR_INVALID, 0, _("syntax error: unexpected argument %s"), - quotearg_n_style (0, locale_quoting_style, *args)); + error (EXPR_INVALID, 0, _("syntax error: unexpected argument %s"), + quotearg_n_style (0, locale_quoting_style, *args)); printv (v); @@ -499,7 +497,7 @@ toarith (VALUE *v) if (! looks_like_integer (s)) return false; if (mpz_init_set_str (v->u.i, s, 10) != 0) - die (EXPR_FAILURE, ERANGE, "%s", (s)); + error (EXPR_FAILURE, ERANGE, "%s", (s)); free (s); v->type = integer; return true; @@ -557,8 +555,8 @@ static void require_more_args (void) { if (nomoreargs ()) - die (EXPR_INVALID, 0, _("syntax error: missing argument after %s"), - quotearg_n_style (0, locale_quoting_style, *(args - 1))); + error (EXPR_INVALID, 0, _("syntax error: missing argument after %s"), + quotearg_n_style (0, locale_quoting_style, *(args - 1))); } @@ -607,7 +605,7 @@ docolon (VALUE *sv, VALUE *pv) RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES; errmsg = re_compile_pattern (pv->u.s, strlen (pv->u.s), &re_buffer); if (errmsg) - die (EXPR_INVALID, 0, "%s", (errmsg)); + error (EXPR_INVALID, 0, "%s", (errmsg)); re_buffer.newline_anchor = 0; matchlen = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs); @@ -643,9 +641,9 @@ docolon (VALUE *sv, VALUE *pv) v = int_value (0); } else - die (EXPR_FAILURE, - (matchlen == -2 ? errno : EOVERFLOW), - _("error in regular expression matcher")); + error (EXPR_FAILURE, + matchlen == -2 ? errno : EOVERFLOW, + _("error in regular expression matcher")); if (0 < re_regs.num_regs) { @@ -673,16 +671,16 @@ eval7 (bool evaluate) { v = eval (evaluate); if (nomoreargs ()) - die (EXPR_INVALID, 0, _("syntax error: expecting ')' after %s"), - quotearg_n_style (0, locale_quoting_style, *(args - 1))); + error (EXPR_INVALID, 0, _("syntax error: expecting ')' after %s"), + quotearg_n_style (0, locale_quoting_style, *(args - 1))); if (!nextarg (")")) - die (EXPR_INVALID, 0, _("syntax error: expecting ')' instead of %s"), - quotearg_n_style (0, locale_quoting_style, *args)); + error (EXPR_INVALID, 0, _("syntax error: expecting ')' instead of %s"), + quotearg_n_style (0, locale_quoting_style, *args)); return v; } if (nextarg (")")) - die (EXPR_INVALID, 0, _("syntax error: unexpected ')'")); + error (EXPR_INVALID, 0, _("syntax error: unexpected ')'")); return str_value (*args++); } @@ -828,9 +826,9 @@ eval4 (bool evaluate) if (evaluate) { if (!toarith (l) || !toarith (r)) - die (EXPR_INVALID, 0, _("non-integer argument")); + error (EXPR_INVALID, 0, _("non-integer argument")); if (fxn != multiply && mpz_sgn (r->u.i) == 0) - die (EXPR_INVALID, 0, _("division by zero")); + error (EXPR_INVALID, 0, _("division by zero")); ((fxn == multiply ? mpz_mul : fxn == divide ? mpz_tdiv_q : mpz_tdiv_r) @@ -865,7 +863,7 @@ eval3 (bool evaluate) if (evaluate) { if (!toarith (l) || !toarith (r)) - die (EXPR_INVALID, 0, _("non-integer argument")); + error (EXPR_INVALID, 0, _("non-integer argument")); (fxn == plus ? mpz_add : mpz_sub) (l->u.i, l->u.i, r->u.i); } freev (r); @@ -925,10 +923,10 @@ eval2 (bool evaluate) { error (0, errno, _("string comparison failed")); error (0, 0, _("set LC_ALL='C' to work around the problem")); - die (EXPR_INVALID, 0, - _("the strings compared were %s and %s"), - quotearg_n_style (0, locale_quoting_style, l->u.s), - quotearg_n_style (1, locale_quoting_style, r->u.s)); + error (EXPR_INVALID, 0, + _("the strings compared were %s and %s"), + quotearg_n_style (0, locale_quoting_style, l->u.s), + quotearg_n_style (1, locale_quoting_style, r->u.s)); } } |
