| 334 |
|
|
| 335 |
|
advance() /* read in data for next scanline */ |
| 336 |
|
{ |
| 337 |
+ |
extern double fabs(); |
| 338 |
|
int ytarget; |
| 339 |
|
register COLOR *st; |
| 340 |
|
register int i, j; |
| 347 |
|
input[i].scan[0] = st; |
| 348 |
|
if (yscan <= MIDSCN) /* hit bottom? */ |
| 349 |
|
continue; |
| 350 |
< |
if (freadscan(st, xmax, input[i].fp) < 0) { /* read */ |
| 350 |
> |
if (freadscan(st, xmax, input[i].fp) < 0) { /* read */ |
| 351 |
|
eputs(input[i].name); |
| 352 |
|
eputs(": read error\n"); |
| 353 |
|
quit(1); |
| 354 |
|
} |
| 355 |
< |
for (j = 0; j < xmax; j++) /* adjust color */ |
| 356 |
< |
multcolor(st[j], input[i].coef); |
| 355 |
> |
if (fabs(colval(input[i].coef,RED)-1.0) > 1e-3 || |
| 356 |
> |
fabs(colval(input[i].coef,GRN)-1.0) > 1e-3 || |
| 357 |
> |
fabs(colval(input[i].coef,BLU)-1.0) > 1e-3) |
| 358 |
> |
for (j = 0; j < xmax; j++) /* adjust color */ |
| 359 |
> |
multcolor(st[j], input[i].coef); |
| 360 |
|
} |
| 361 |
|
} |
| 362 |
|
|
| 453 |
|
} |
| 454 |
|
|
| 455 |
|
|
| 456 |
+ |
#ifdef NIX |
| 457 |
+ |
|
| 458 |
|
quit(code) |
| 459 |
< |
int code; |
| 459 |
> |
int code; |
| 460 |
|
{ |
| 461 |
|
exit(code); |
| 462 |
|
} |
| 463 |
+ |
|
| 464 |
+ |
#else |
| 465 |
+ |
|
| 466 |
+ |
#include <signal.h> |
| 467 |
+ |
|
| 468 |
+ |
quit(code) /* exit gracefully */ |
| 469 |
+ |
int code; |
| 470 |
+ |
{ |
| 471 |
+ |
int status; |
| 472 |
+ |
|
| 473 |
+ |
if (code) { /* abnormal exit -- kill children */ |
| 474 |
+ |
signal(SIGPIPE, SIG_IGN); |
| 475 |
+ |
kill(0, SIGPIPE); |
| 476 |
+ |
} |
| 477 |
+ |
/* reap any children */ |
| 478 |
+ |
while (wait(&status) != -1) |
| 479 |
+ |
if (code == 0) |
| 480 |
+ |
code = status>>8 & 0xff; |
| 481 |
+ |
exit(code); |
| 482 |
+ |
} |
| 483 |
+ |
|
| 484 |
+ |
#endif |