--- ray/src/rt/rpmain.c 2003/02/25 02:47:23 2.2 +++ ray/src/rt/rpmain.c 2003/07/14 20:02:30 2.6 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rpmain.c,v 2.2 2003/02/25 02:47:23 greg Exp $"; +static const char RCSid[] = "$Id: rpmain.c,v 2.6 2003/07/14 20:02:30 schorsch Exp $"; #endif /* * rpmain.c - main for rpict batch rendering program @@ -7,23 +7,18 @@ static const char RCSid[] = "$Id: rpmain.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 - #include "view.h" -#include "paths.h" /* persistent processes define */ #ifdef F_SETLKW #define PERSIST 1 /* normal persist */ @@ -234,10 +229,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"); @@ -278,10 +279,10 @@ char *argv[]; #endif if (outfile != NULL) openheader(); -#ifdef MSDOS - setmode(fileno(stdout), O_BINARY); +#ifdef _WIN32 + SET_FILE_BINARY(stdout); if (octname == NULL) - setmode(fileno(stdin), O_BINARY); + SET_FILE_BINARY(stdin); #endif readoct(octname, loadflags, &thescene, NULL); nsceneobjs = nobjects; @@ -289,7 +290,6 @@ char *argv[]; if (loadflags & IO_INFO) { /* print header */ printargs(i, argv, stdout); printf("SOFTWARE= %s\n", VersionID); - fputnow(stdout); } marksources(); /* find and mark sources */ @@ -398,8 +398,10 @@ int signo; if (gotsig++) /* two signals and we're gone! */ _exit(signo); +#ifdef SIGALRM /* XXX how critical is this? */ 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"); @@ -421,8 +423,6 @@ char *msg; void printdefaults() /* print default values to stdout */ { - register char *cp; - printf("-vt%c\t\t\t\t# view type %s\n", ourview.type, ourview.type==VT_PER ? "perspective" : ourview.type==VT_PAR ? "parallel" :