97 |
|
extern long ftell(); |
98 |
|
long scanpos[NROWS]; |
99 |
|
|
100 |
– |
extern double atof(); |
100 |
|
double exposure = 1.0; |
101 |
+ |
int wrong_fmt = 0; |
102 |
|
|
103 |
|
|
104 |
|
main(argc, argv) |
140 |
|
quitmsg(errmsg); |
141 |
|
} |
142 |
|
/* get header */ |
143 |
< |
getheader(fin, checkhead); |
143 |
> |
getheader(fin, checkhead, NULL); |
144 |
> |
if (wrong_fmt) |
145 |
> |
quitmsg("input must be a Radiance picture"); |
146 |
|
/* get picture dimensions */ |
147 |
< |
if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR)) |
147 |
> |
if (fgetresolu(&xmax, &ymax, fin) < 0) |
148 |
|
quitmsg("bad picture size"); |
149 |
|
if (xmax > NCOLS || ymax > NROWS) |
150 |
|
quitmsg("resolution mismatch"); |
171 |
|
checkhead(line) /* deal with line from header */ |
172 |
|
char *line; |
173 |
|
{ |
174 |
+ |
char fmt[32]; |
175 |
+ |
|
176 |
|
if (isexpos(line)) |
177 |
|
exposure *= exposval(line); |
178 |
+ |
else if (isformat(line)) { |
179 |
+ |
formatval(fmt, line); |
180 |
+ |
wrong_fmt = strcmp(fmt, COLRFMT); |
181 |
+ |
} |
182 |
|
} |
183 |
|
|
184 |
|
|
323 |
|
break; |
324 |
|
case 'l': |
325 |
|
case 'L': |
326 |
< |
printf("%-3gL", bright(cval)*683.0/exposure); |
326 |
> |
printf("%-3gL", luminance(cval)/exposure); |
327 |
|
break; |
328 |
|
case 'c': |
329 |
|
case 'C': |