| 1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1991 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 13 |
|
#include <stdio.h> |
| 14 |
|
|
| 15 |
|
#include "color.h" |
| 16 |
+ |
#include "resolu.h" |
| 17 |
|
|
| 18 |
|
|
| 19 |
|
#define NCOLS 133 |
| 35 |
|
exit(1); |
| 36 |
|
} |
| 37 |
|
|
| 37 |
– |
/* discard header */ |
| 38 |
– |
getheader(input, NULL); |
| 38 |
|
/* get picture dimensions */ |
| 39 |
< |
if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) { |
| 40 |
< |
fprintf(stderr, "%s: bad picture size\n", argv[0]); |
| 39 |
> |
if (checkheader(input, COLRFMT, NULL) < 0 || |
| 40 |
> |
fgetresolu(&xres, &yres, input) < 0) { |
| 41 |
> |
fprintf(stderr, "%s: bad picture format\n", argv[0]); |
| 42 |
|
exit(1); |
| 43 |
|
} |
| 44 |
|
if (xres > NCOLS) { |
| 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'); |