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