ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/ev.c
Revision: 1.7
Committed: Thu Sep 11 05:34:47 2008 UTC (15 years, 5 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R2, rad4R2P2, rad5R0, rad5R1, rad4R2, rad4R1, rad4R0, rad4R2P1, rad5R3
Changes since 1.6: +4 -1 lines
Log Message:
Avoid returning error on spurious errno settings

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id: ev.c,v 1.6 2003/11/14 17:31:24 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 int
19 main(argc, argv)
20 int argc;
21 char *argv[];
22 {
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 if (errno != EDOM && errno != ERANGE)
37 errno = 0;
38
39 quit(errno ? 2 : 0);
40 return (errno ? 2 : 0); /* pro forma return */
41 }
42
43
44 void
45 eputs(msg)
46 char *msg;
47 {
48 fputs(msg, stderr);
49 }
50
51
52 void
53 wputs(msg)
54 char *msg;
55 {
56 eputs(msg);
57 }
58
59
60 void
61 quit(code)
62 int code;
63 {
64 exit(code);
65 }