7 |
|
|
8 |
|
#include "copyright.h" |
9 |
|
|
10 |
< |
#include "ray.h" |
10 |
> |
#include <sys/types.h> |
11 |
> |
#include <signal.h> |
12 |
|
|
13 |
+ |
#include "platform.h" |
14 |
+ |
#include "rtprocess.h" /* getpid() */ |
15 |
+ |
#include "ray.h" |
16 |
|
#include "source.h" |
13 |
– |
|
17 |
|
#include "ambient.h" |
15 |
– |
|
18 |
|
#include "random.h" |
17 |
– |
|
19 |
|
#include "paths.h" |
19 |
– |
|
20 |
– |
#include <sys/types.h> |
21 |
– |
|
22 |
– |
#include <signal.h> |
23 |
– |
|
20 |
|
#include "view.h" |
21 |
|
|
26 |
– |
#include "paths.h" |
22 |
|
/* persistent processes define */ |
23 |
|
#ifdef F_SETLKW |
24 |
|
#define PERSIST 1 /* normal persist */ |
229 |
|
initurand(2048); |
230 |
|
/* set up signal handling */ |
231 |
|
sigdie(SIGINT, "Interrupt"); |
232 |
+ |
#ifdef SIGHUP |
233 |
|
sigdie(SIGHUP, "Hangup"); |
234 |
+ |
#endif |
235 |
|
sigdie(SIGTERM, "Terminate"); |
236 |
+ |
#ifdef SIGPIPE |
237 |
|
sigdie(SIGPIPE, "Broken pipe"); |
238 |
+ |
#endif |
239 |
+ |
#ifdef SIGALRM |
240 |
|
sigdie(SIGALRM, "Alarm clock"); |
241 |
+ |
#endif |
242 |
|
#ifdef SIGXCPU |
243 |
|
sigdie(SIGXCPU, "CPU limit exceeded"); |
244 |
|
sigdie(SIGXFSZ, "File size exceeded"); |
279 |
|
#endif |
280 |
|
if (outfile != NULL) |
281 |
|
openheader(); |
282 |
< |
#ifdef MSDOS |
283 |
< |
setmode(fileno(stdout), O_BINARY); |
282 |
> |
#ifdef _WIN32 |
283 |
> |
SET_FILE_BINARY(stdout); |
284 |
|
if (octname == NULL) |
285 |
< |
setmode(fileno(stdin), O_BINARY); |
285 |
> |
SET_FILE_BINARY(stdin); |
286 |
|
#endif |
287 |
|
readoct(octname, loadflags, &thescene, NULL); |
288 |
|
nsceneobjs = nobjects; |
290 |
|
if (loadflags & IO_INFO) { /* print header */ |
291 |
|
printargs(i, argv, stdout); |
292 |
|
printf("SOFTWARE= %s\n", VersionID); |
292 |
– |
fputnow(stdout); |
293 |
|
} |
294 |
|
|
295 |
|
marksources(); /* find and mark sources */ |
398 |
|
if (gotsig++) /* two signals and we're gone! */ |
399 |
|
_exit(signo); |
400 |
|
|
401 |
+ |
#ifdef SIGALRM /* XXX how critical is this? */ |
402 |
|
alarm(15); /* allow 15 seconds to clean up */ |
403 |
|
signal(SIGALRM, SIG_DFL); /* make certain we do die */ |
404 |
+ |
#endif |
405 |
|
eputs("signal - "); |
406 |
|
eputs(sigerr[signo]); |
407 |
|
eputs("\n"); |
423 |
|
void |
424 |
|
printdefaults() /* print default values to stdout */ |
425 |
|
{ |
424 |
– |
register char *cp; |
425 |
– |
|
426 |
|
printf("-vt%c\t\t\t\t# view type %s\n", ourview.type, |
427 |
|
ourview.type==VT_PER ? "perspective" : |
428 |
|
ourview.type==VT_PAR ? "parallel" : |