diff options
Diffstat (limited to 'expr.c')
-rw-r--r-- | expr.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -74,14 +74,14 @@ int expr_main (int argc, char **argv) | |||
74 | VALUE *v; | 74 | VALUE *v; |
75 | 75 | ||
76 | if (argc == 1) { | 76 | if (argc == 1) { |
77 | fatalError("too few arguments\n"); | 77 | error_msg_and_die("too few arguments\n"); |
78 | } | 78 | } |
79 | 79 | ||
80 | args = argv + 1; | 80 | args = argv + 1; |
81 | 81 | ||
82 | v = eval (); | 82 | v = eval (); |
83 | if (*args) | 83 | if (*args) |
84 | fatalError ("syntax error\n"); | 84 | error_msg_and_die ("syntax error\n"); |
85 | 85 | ||
86 | if (v->type == integer) | 86 | if (v->type == integer) |
87 | printf ("%d\n", v->u.i); | 87 | printf ("%d\n", v->u.i); |
@@ -216,7 +216,7 @@ static \ | |||
216 | int name (l, r) VALUE *l; VALUE *r; \ | 216 | int name (l, r) VALUE *l; VALUE *r; \ |
217 | { \ | 217 | { \ |
218 | if (!toarith (l) || !toarith (r)) \ | 218 | if (!toarith (l) || !toarith (r)) \ |
219 | fatalError ("non-numeric argument\n"); \ | 219 | error_msg_and_die ("non-numeric argument\n"); \ |
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 (l, r) VALUE *l; VALUE *r; \ | |||
224 | int name (l, r) VALUE *l; VALUE *r; \ | 224 | int name (l, r) VALUE *l; VALUE *r; \ |
225 | { \ | 225 | { \ |
226 | if (!toarith (l) || !toarith (r)) \ | 226 | if (!toarith (l) || !toarith (r)) \ |
227 | fatalError ( "non-numeric argument\n"); \ | 227 | error_msg_and_die ( "non-numeric argument\n"); \ |
228 | if (r->u.i == 0) \ | 228 | if (r->u.i == 0) \ |
229 | fatalError ( "division by zero\n"); \ | 229 | error_msg_and_die ( "division by zero\n"); \ |
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 | fatalError("%s\n", errmsg); | 273 | error_msg_and_die("%s\n", 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 | fatalError ( "syntax error\n"); | 304 | error_msg_and_die ( "syntax error\n"); |
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 | fatalError ( "syntax error\n"); | 310 | error_msg_and_die ( "syntax error\n"); |
311 | args++; | 311 | args++; |
312 | return v; | 312 | return v; |
313 | } | 313 | } |
314 | 314 | ||
315 | if (nextarg (")")) | 315 | if (nextarg (")")) |
316 | fatalError ( "syntax error\n"); | 316 | error_msg_and_die ( "syntax error\n"); |
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 | fatalError ( "syntax error\n"); | 330 | error_msg_and_die ( "syntax error\n"); |
331 | return str_value (*args++); | 331 | return str_value (*args++); |
332 | } | 332 | } |
333 | else if (nextarg ("length")) { | 333 | else if (nextarg ("length")) { |