1 |
#ifndef lint |
2 |
static const char RCSid[] = "$Id: ev.c,v 1.3 2003/07/27 22:12:01 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 |
extern int errno; |
23 |
int i; |
24 |
|
25 |
esupport |= E_FUNCTION; |
26 |
esupport &= ~(E_VARIABLE|E_INCHAN|E_OUTCHAN|E_RCONST); |
27 |
|
28 |
#ifdef BIGGERLIB |
29 |
biggerlib(); |
30 |
#endif |
31 |
|
32 |
errno = 0; |
33 |
for (i = 1; i < argc; i++) |
34 |
printf("%.9g\n", eval(argv[i])); |
35 |
|
36 |
quit(errno ? 2 : 0); |
37 |
} |
38 |
|
39 |
|
40 |
void |
41 |
eputs(msg) |
42 |
char *msg; |
43 |
{ |
44 |
fputs(msg, stderr); |
45 |
} |
46 |
|
47 |
|
48 |
void |
49 |
wputs(msg) |
50 |
char *msg; |
51 |
{ |
52 |
eputs(msg); |
53 |
} |
54 |
|
55 |
|
56 |
void |
57 |
quit(code) |
58 |
int code; |
59 |
{ |
60 |
exit(code); |
61 |
} |