--- ray/src/rt/rtmain.c 2003/02/25 02:47:23 2.2 +++ ray/src/rt/rtmain.c 2003/10/21 19:19:28 2.8 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rtmain.c,v 2.2 2003/02/25 02:47:23 greg Exp $"; +static const char RCSid[] = "$Id: rtmain.c,v 2.8 2003/10/21 19:19:28 schorsch Exp $"; #endif /* * rtmain.c - main for rtrace per-ray calculation program @@ -7,19 +7,17 @@ static const char RCSid[] = "$Id: rtmain.c,v 2.2 2003/ #include "copyright.h" -#include "ray.h" +#include +#include +#include "platform.h" +#include "rtprocess.h" /* getpid() */ +#include "ray.h" #include "source.h" - #include "ambient.h" - #include "random.h" - #include "paths.h" -#include - -#include /* persistent processes define */ #ifdef F_SETLKW #define PERSIST 1 /* normal persist */ @@ -51,9 +49,9 @@ extern int lim_dist; /* limit distance? */ extern char *tralist[]; /* list of modifers to trace (or no) */ extern int traincl; /* include == 1, exclude == 0 */ -void onsig(); -void sigdie(); -void printdefaults(); +void onsig(int); +void sigdie(int, char*); +void printdefaults(void); int @@ -176,7 +174,7 @@ char *argv[]; } if (argv[i][2] == 'I') { /* file */ rval = wordfile(tralp, - getpath(argv[++i],getlibpath(),R_OK)); + getpath(argv[++i],getrlibpath(),R_OK)); if (rval < 0) { sprintf(errmsg, "cannot open trace include file \"%s\"", @@ -198,7 +196,7 @@ char *argv[]; } if (argv[i][2] == 'E') { /* file */ rval = wordfile(tralp, - getpath(argv[++i],getlibpath(),R_OK)); + getpath(argv[++i],getrlibpath(),R_OK)); if (rval < 0) { sprintf(errmsg, "cannot open trace exclude file \"%s\"", @@ -237,10 +235,16 @@ char *argv[]; initurand(2048); /* set up signal handling */ sigdie(SIGINT, "Interrupt"); +#ifdef SIGHUP sigdie(SIGHUP, "Hangup"); +#endif sigdie(SIGTERM, "Terminate"); +#ifdef SIGPIPE sigdie(SIGPIPE, "Broken pipe"); +#endif +#ifdef SIGALRM sigdie(SIGALRM, "Alarm clock"); +#endif #ifdef SIGXCPU sigdie(SIGXCPU, "CPU limit exceeded"); sigdie(SIGXFSZ, "File size exceeded"); @@ -274,11 +278,11 @@ char *argv[]; openheader(); } #endif -#ifdef MSDOS +#ifdef _WIN32 if (outform != 'a') - setmode(fileno(stdout), O_BINARY); + SET_FILE_BINARY(stdout); if (octname == NULL) - setmode(fileno(stdin), O_BINARY); + SET_FILE_BINARY(stdin); #endif readoct(octname, loadflags, &thescene, NULL); nsceneobjs = nobjects; @@ -390,8 +394,10 @@ int signo; if (gotsig++) /* two signals and we're gone! */ _exit(signo); +#ifdef SIGALRM alarm(15); /* allow 15 seconds to clean up */ signal(SIGALRM, SIG_DFL); /* make certain we do die */ +#endif eputs("signal - "); eputs(sigerr[signo]); eputs("\n"); @@ -411,7 +417,7 @@ char *msg; void -printdefaults() /* print default values to stdout */ +printdefaults(void) /* print default values to stdout */ { register char *cp;