1 |
#ifndef lint |
2 |
static const char RCSid[] = "$Id: ev.c,v 1.4 2003/08/20 09:30:16 schorsch Exp $"; |
3 |
#endif |
4 |
/* |
5 |
* ev.c - program to evaluate expression arguments |
6 |
* |
7 |
* 1/29/87 |
8 |
*/ |
9 |
|
10 |
#include <stdlib.h> |
11 |
#include <stdio.h> |
12 |
#include <errno.h> |
13 |
|
14 |
#include "calcomp.h" |
15 |
#include "rterror.h" |
16 |
|
17 |
|
18 |
main(argc, argv) |
19 |
int argc; |
20 |
char *argv[]; |
21 |
{ |
22 |
int i; |
23 |
|
24 |
esupport |= E_FUNCTION; |
25 |
esupport &= ~(E_VARIABLE|E_INCHAN|E_OUTCHAN|E_RCONST); |
26 |
|
27 |
#ifdef BIGGERLIB |
28 |
biggerlib(); |
29 |
#endif |
30 |
|
31 |
errno = 0; |
32 |
for (i = 1; i < argc; i++) |
33 |
printf("%.9g\n", eval(argv[i])); |
34 |
|
35 |
quit(errno ? 2 : 0); |
36 |
} |
37 |
|
38 |
|
39 |
void |
40 |
eputs(msg) |
41 |
char *msg; |
42 |
{ |
43 |
fputs(msg, stderr); |
44 |
} |
45 |
|
46 |
|
47 |
void |
48 |
wputs(msg) |
49 |
char *msg; |
50 |
{ |
51 |
eputs(msg); |
52 |
} |
53 |
|
54 |
|
55 |
void |
56 |
quit(code) |
57 |
int code; |
58 |
{ |
59 |
exit(code); |
60 |
} |