--- ray/src/cal/ev.c 2003/07/27 22:12:01 1.3 +++ ray/src/cal/ev.c 2008/09/11 05:34:47 1.7 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: ev.c,v 1.3 2003/07/27 22:12:01 schorsch Exp $"; +static const char RCSid[] = "$Id: ev.c,v 1.7 2008/09/11 05:34:47 greg Exp $"; #endif /* * ev.c - program to evaluate expression arguments @@ -9,16 +9,17 @@ static const char RCSid[] = "$Id: ev.c,v 1.3 2003/07/2 #include #include +#include #include "calcomp.h" #include "rterror.h" +int main(argc, argv) int argc; char *argv[]; { - extern int errno; int i; esupport |= E_FUNCTION; @@ -32,7 +33,11 @@ char *argv[]; for (i = 1; i < argc; i++) printf("%.9g\n", eval(argv[i])); + if (errno != EDOM && errno != ERANGE) + errno = 0; + quit(errno ? 2 : 0); + return (errno ? 2 : 0); /* pro forma return */ }