7 |
|
|
8 |
|
#include "copyright.h" |
9 |
|
|
10 |
< |
#include "ray.h" |
10 |
> |
#include <sys/types.h> |
11 |
> |
#include <signal.h> |
12 |
> |
#ifdef _WIN32 |
13 |
> |
#include <process.h> /* getpid */ |
14 |
> |
#endif |
15 |
|
|
16 |
+ |
#include "platform.h" |
17 |
+ |
#include "ray.h" |
18 |
|
#include "source.h" |
13 |
– |
|
19 |
|
#include "ambient.h" |
15 |
– |
|
20 |
|
#include "random.h" |
17 |
– |
|
21 |
|
#include "paths.h" |
19 |
– |
|
20 |
– |
#include <sys/types.h> |
21 |
– |
|
22 |
– |
#include <signal.h> |
23 |
– |
|
22 |
|
#include "view.h" |
23 |
|
|
26 |
– |
#include "paths.h" |
24 |
|
/* persistent processes define */ |
25 |
|
#ifdef F_SETLKW |
26 |
|
#define PERSIST 1 /* normal persist */ |
231 |
|
initurand(2048); |
232 |
|
/* set up signal handling */ |
233 |
|
sigdie(SIGINT, "Interrupt"); |
234 |
+ |
#ifdef SIGHUP |
235 |
|
sigdie(SIGHUP, "Hangup"); |
236 |
+ |
#endif |
237 |
|
sigdie(SIGTERM, "Terminate"); |
238 |
+ |
#ifdef SIGPIPE |
239 |
|
sigdie(SIGPIPE, "Broken pipe"); |
240 |
+ |
#endif |
241 |
+ |
#ifdef SIGALRM |
242 |
|
sigdie(SIGALRM, "Alarm clock"); |
243 |
+ |
#endif |
244 |
|
#ifdef SIGXCPU |
245 |
|
sigdie(SIGXCPU, "CPU limit exceeded"); |
246 |
|
sigdie(SIGXFSZ, "File size exceeded"); |
281 |
|
#endif |
282 |
|
if (outfile != NULL) |
283 |
|
openheader(); |
284 |
< |
#ifdef MSDOS |
285 |
< |
setmode(fileno(stdout), O_BINARY); |
284 |
> |
#ifdef _WIN32 |
285 |
> |
SET_FILE_BINARY(stdout); |
286 |
|
if (octname == NULL) |
287 |
< |
setmode(fileno(stdin), O_BINARY); |
287 |
> |
SET_FILE_BINARY(stdin); |
288 |
|
#endif |
289 |
|
readoct(octname, loadflags, &thescene, NULL); |
290 |
|
nsceneobjs = nobjects; |
401 |
|
if (gotsig++) /* two signals and we're gone! */ |
402 |
|
_exit(signo); |
403 |
|
|
404 |
+ |
#ifdef SIGALRM /* XXX how critical is this? */ |
405 |
|
alarm(15); /* allow 15 seconds to clean up */ |
406 |
|
signal(SIGALRM, SIG_DFL); /* make certain we do die */ |
407 |
+ |
#endif |
408 |
|
eputs("signal - "); |
409 |
|
eputs(sigerr[signo]); |
410 |
|
eputs("\n"); |