135 |
|
|
136 |
|
|
137 |
|
void |
138 |
< |
quit(code) /* quit program */ |
139 |
< |
int code; |
138 |
> |
quit(int code) /* quit program */ |
139 |
|
{ |
140 |
|
if (code) /* report status */ |
141 |
|
report(0); |
287 |
|
break; |
288 |
|
pctdone = 0.0; |
289 |
|
if (pout != NULL) { |
290 |
+ |
int myfd; |
291 |
|
close(1); /* reassign stdout */ |
292 |
|
sprintf(fbuf, pout, seq); |
293 |
+ |
tryagain: |
294 |
|
errno = 0; /* exclusive open */ |
295 |
< |
if (open(fbuf, O_WRONLY|O_CREAT|O_EXCL, 0666) != 1) { |
295 |
> |
if ((myfd = open(fbuf, O_WRONLY|O_CREAT|O_EXCL, 0666)) < 0) { |
296 |
|
if ((errno != EEXIST) | (prvr != NULL) || |
297 |
|
!strcmp(fbuf, pout)) { |
298 |
|
sprintf(errmsg, |
303 |
|
setview(&ourview); |
304 |
|
continue; /* don't clobber */ |
305 |
|
} |
306 |
+ |
if (myfd != 1) { |
307 |
+ |
unlink(fbuf); |
308 |
+ |
goto tryagain; /* leave it open */ |
309 |
+ |
} |
310 |
|
SET_FD_BINARY(1); |
311 |
|
dupheader(); |
312 |
|
} |
340 |
|
if ((pa < .99) | (pa > 1.01)) |
341 |
|
fputaspect(pa, stdout); |
342 |
|
fputnow(stdout); |
343 |
+ |
fputprims(stdprims, stdout); |
344 |
|
fputformat(COLRFMT, stdout); |
345 |
|
putchar('\n'); |
346 |
|
if (zout != NULL) |
660 |
|
int y |
661 |
|
) |
662 |
|
{ |
657 |
– |
extern void SDsquare2disk(double ds[2], double seedx, double seedy); |
663 |
|
RAY thisray; |
664 |
|
FVECT lorg, ldir; |
665 |
|
double hpos, vpos, vdist, lmax; |