| 25 |
|
FILE *input; |
| 26 |
|
int xres, yres; |
| 27 |
|
COLR scanline[NCOLS]; |
| 28 |
– |
char sbuf[256]; |
| 28 |
|
register int i, j; |
| 29 |
|
|
| 30 |
|
if (argc < 2) |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
/* discard header */ |
| 38 |
< |
while (fgets(sbuf, sizeof(sbuf), input) != NULL && sbuf[0] != '\n') |
| 40 |
< |
; |
| 38 |
> |
getheader(input, NULL); |
| 39 |
|
/* get picture dimensions */ |
| 40 |
|
if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) { |
| 41 |
|
fprintf(stderr, "%s: bad picture size\n", argv[0]); |
| 51 |
|
fprintf(stderr, "%s: read error\n", argv[0]); |
| 52 |
|
exit(1); |
| 53 |
|
} |
| 54 |
< |
normcolrs(scanline, xres); |
| 54 |
> |
normcolrs(scanline, xres, 0); |
| 55 |
|
for (j = 0; j < xres; j++) |
| 56 |
|
putchar(shade(scanline[j])); |
| 57 |
|
putchar('\n'); |