11 |
|
#include <signal.h> |
12 |
|
|
13 |
|
#include "platform.h" |
14 |
+ |
#include "rtprocess.h" /* getpid() */ |
15 |
|
#include "ray.h" |
16 |
|
#include "source.h" |
17 |
|
#include "ambient.h" |
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"); |
290 |
|
if (loadflags & IO_INFO) { /* print header */ |
291 |
|
printargs(i, argv, stdout); |
292 |
|
printf("SOFTWARE= %s\n", VersionID); |
286 |
– |
fputnow(stdout); |
293 |
|
} |
294 |
|
|
295 |
|
marksources(); /* find and mark sources */ |
318 |
|
} |
319 |
|
} |
320 |
|
runagain: |
321 |
< |
if (persist) |
321 |
> |
if (persist) { |
322 |
|
if (outfile == NULL) /* if out to stdout */ |
323 |
|
dupheader(); /* send header */ |
324 |
|
else /* if out to file */ |
325 |
|
duped1 = dup(fileno(stdout)); /* hang onto pipe */ |
326 |
+ |
} |
327 |
|
#endif |
328 |
|
/* batch render picture(s) */ |
329 |
|
rpict(seqstart, outfile, zfile, recover); |
399 |
|
if (gotsig++) /* two signals and we're gone! */ |
400 |
|
_exit(signo); |
401 |
|
|
402 |
+ |
#ifdef SIGALRM /* XXX how critical is this? */ |
403 |
|
alarm(15); /* allow 15 seconds to clean up */ |
404 |
|
signal(SIGALRM, SIG_DFL); /* make certain we do die */ |
405 |
+ |
#endif |
406 |
|
eputs("signal - "); |
407 |
|
eputs(sigerr[signo]); |
408 |
|
eputs("\n"); |
424 |
|
void |
425 |
|
printdefaults() /* print default values to stdout */ |
426 |
|
{ |
418 |
– |
register char *cp; |
419 |
– |
|
427 |
|
printf("-vt%c\t\t\t\t# view type %s\n", ourview.type, |
428 |
|
ourview.type==VT_PER ? "perspective" : |
429 |
|
ourview.type==VT_PAR ? "parallel" : |