diff options
Diffstat (limited to 'coreutils/expr.c')
-rw-r--r-- | coreutils/expr.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/coreutils/expr.c b/coreutils/expr.c index 55ae3a969..ecba825d5 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
@@ -78,14 +78,14 @@ int expr_main (int argc, char **argv) | |||
78 | VALUE *v; | 78 | VALUE *v; |
79 | 79 | ||
80 | if (argc == 1) { | 80 | if (argc == 1) { |
81 | error_msg_and_die("too few arguments"); | 81 | bb_error_msg_and_die("too few arguments"); |
82 | } | 82 | } |
83 | 83 | ||
84 | args = argv + 1; | 84 | args = argv + 1; |
85 | 85 | ||
86 | v = eval (); | 86 | v = eval (); |
87 | if (*args) | 87 | if (*args) |
88 | error_msg_and_die ("syntax error"); | 88 | bb_error_msg_and_die ("syntax error"); |
89 | 89 | ||
90 | if (v->type == integer) | 90 | if (v->type == integer) |
91 | printf ("%d\n", v->u.i); | 91 | printf ("%d\n", v->u.i); |
@@ -147,7 +147,7 @@ static int null (VALUE *v) | |||
147 | static void tostring (VALUE *v) | 147 | static void tostring (VALUE *v) |
148 | { | 148 | { |
149 | if (v->type == integer) { | 149 | if (v->type == integer) { |
150 | bb_asprintf (&(v->u.s), "%d", v->u.i); | 150 | bb_xasprintf (&(v->u.s), "%d", v->u.i); |
151 | v->type = string; | 151 | v->type = string; |
152 | } | 152 | } |
153 | } | 153 | } |
@@ -216,7 +216,7 @@ static \ | |||
216 | int name (VALUE *l, VALUE *r) \ | 216 | int name (VALUE *l, VALUE *r) \ |
217 | { \ | 217 | { \ |
218 | if (!toarith (l) || !toarith (r)) \ | 218 | if (!toarith (l) || !toarith (r)) \ |
219 | error_msg_and_die ("non-numeric argument"); \ | 219 | bb_error_msg_and_die ("non-numeric argument"); \ |
220 | return l->u.i op r->u.i; \ | 220 | return l->u.i op r->u.i; \ |
221 | } | 221 | } |
222 | 222 | ||
@@ -224,9 +224,9 @@ int name (VALUE *l, VALUE *r) \ | |||
224 | static int name (VALUE *l, VALUE *r) \ | 224 | static int name (VALUE *l, VALUE *r) \ |
225 | { \ | 225 | { \ |
226 | if (!toarith (l) || !toarith (r)) \ | 226 | if (!toarith (l) || !toarith (r)) \ |
227 | error_msg_and_die ( "non-numeric argument"); \ | 227 | bb_error_msg_and_die ( "non-numeric argument"); \ |
228 | if (r->u.i == 0) \ | 228 | if (r->u.i == 0) \ |
229 | error_msg_and_die ( "division by zero"); \ | 229 | bb_error_msg_and_die ( "division by zero"); \ |
230 | return l->u.i op r->u.i; \ | 230 | return l->u.i op r->u.i; \ |
231 | } | 231 | } |
232 | 232 | ||
@@ -270,7 +270,7 @@ of a basic regular expression is not portable; it is being ignored", | |||
270 | re_syntax_options = RE_SYNTAX_POSIX_BASIC; | 270 | re_syntax_options = RE_SYNTAX_POSIX_BASIC; |
271 | errmsg = re_compile_pattern (pv->u.s, len, &re_buffer); | 271 | errmsg = re_compile_pattern (pv->u.s, len, &re_buffer); |
272 | if (errmsg) { | 272 | if (errmsg) { |
273 | error_msg_and_die("%s", errmsg); | 273 | bb_error_msg_and_die("%s", errmsg); |
274 | } | 274 | } |
275 | 275 | ||
276 | len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs); | 276 | len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs); |
@@ -301,19 +301,19 @@ static VALUE *eval7 (void) | |||
301 | VALUE *v; | 301 | VALUE *v; |
302 | 302 | ||
303 | if (!*args) | 303 | if (!*args) |
304 | error_msg_and_die ( "syntax error"); | 304 | bb_error_msg_and_die ( "syntax error"); |
305 | 305 | ||
306 | if (nextarg ("(")) { | 306 | if (nextarg ("(")) { |
307 | args++; | 307 | args++; |
308 | v = eval (); | 308 | v = eval (); |
309 | if (!nextarg (")")) | 309 | if (!nextarg (")")) |
310 | error_msg_and_die ( "syntax error"); | 310 | bb_error_msg_and_die ( "syntax error"); |
311 | args++; | 311 | args++; |
312 | return v; | 312 | return v; |
313 | } | 313 | } |
314 | 314 | ||
315 | if (nextarg (")")) | 315 | if (nextarg (")")) |
316 | error_msg_and_die ( "syntax error"); | 316 | bb_error_msg_and_die ( "syntax error"); |
317 | 317 | ||
318 | return str_value (*args++); | 318 | return str_value (*args++); |
319 | } | 319 | } |
@@ -327,7 +327,7 @@ static VALUE *eval6 (void) | |||
327 | if (nextarg ("quote")) { | 327 | if (nextarg ("quote")) { |
328 | args++; | 328 | args++; |
329 | if (!*args) | 329 | if (!*args) |
330 | error_msg_and_die ( "syntax error"); | 330 | bb_error_msg_and_die ( "syntax error"); |
331 | return str_value (*args++); | 331 | return str_value (*args++); |
332 | } | 332 | } |
333 | else if (nextarg ("length")) { | 333 | else if (nextarg ("length")) { |
@@ -373,7 +373,7 @@ static VALUE *eval6 (void) | |||
373 | else { | 373 | else { |
374 | v = xmalloc (sizeof(VALUE)); | 374 | v = xmalloc (sizeof(VALUE)); |
375 | v->type = string; | 375 | v->type = string; |
376 | v->u.s = xstrndup(l->u.s + i1->u.i - 1, i2->u.i); | 376 | v->u.s = bb_xstrndup(l->u.s + i1->u.i - 1, i2->u.i); |
377 | } | 377 | } |
378 | freev (l); | 378 | freev (l); |
379 | freev (i1); | 379 | freev (i1); |