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" |
22 |
|
|
20 |
– |
#include <sys/types.h> |
21 |
– |
|
22 |
– |
#include <signal.h> |
23 |
|
/* persistent processes define */ |
24 |
|
#ifdef F_SETLKW |
25 |
|
#define PERSIST 1 /* normal persist */ |
237 |
|
initurand(2048); |
238 |
|
/* set up signal handling */ |
239 |
|
sigdie(SIGINT, "Interrupt"); |
240 |
+ |
#ifdef SIGHUP |
241 |
|
sigdie(SIGHUP, "Hangup"); |
242 |
+ |
#endif |
243 |
|
sigdie(SIGTERM, "Terminate"); |
244 |
+ |
#ifdef SIGPIPE |
245 |
|
sigdie(SIGPIPE, "Broken pipe"); |
246 |
+ |
#endif |
247 |
+ |
#ifdef SIGALRM |
248 |
|
sigdie(SIGALRM, "Alarm clock"); |
249 |
+ |
#endif |
250 |
|
#ifdef SIGXCPU |
251 |
|
sigdie(SIGXCPU, "CPU limit exceeded"); |
252 |
|
sigdie(SIGXFSZ, "File size exceeded"); |
280 |
|
openheader(); |
281 |
|
} |
282 |
|
#endif |
283 |
< |
#ifdef MSDOS |
283 |
> |
#ifdef _WIN32 |
284 |
|
if (outform != 'a') |
285 |
< |
setmode(fileno(stdout), O_BINARY); |
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; |
396 |
|
if (gotsig++) /* two signals and we're gone! */ |
397 |
|
_exit(signo); |
398 |
|
|
399 |
+ |
#ifdef SIGALRM |
400 |
|
alarm(15); /* allow 15 seconds to clean up */ |
401 |
|
signal(SIGALRM, SIG_DFL); /* make certain we do die */ |
402 |
+ |
#endif |
403 |
|
eputs("signal - "); |
404 |
|
eputs(sigerr[signo]); |
405 |
|
eputs("\n"); |