80 |
|
dcp->swapped = (nativebigendian() != rv); |
81 |
|
return 0; |
82 |
|
} |
83 |
< |
/* check for reference depth */ |
83 |
> |
if (!strncmp(s, "NCOMP=", 6)) { |
84 |
> |
if (atoi(s+6) != 1) { |
85 |
> |
if (dcp->hdrflags & HF_STDERR) { |
86 |
> |
fputs(dcp->inpname, stderr); |
87 |
> |
fputs(": NCOMP must equal 1\n", stderr); |
88 |
> |
} |
89 |
> |
return -1; |
90 |
> |
} |
91 |
> |
return 0; |
92 |
> |
} |
93 |
> |
if (!strncmp(s, "NROWS=", 6)) { |
94 |
> |
dcp->res.yr = atoi(s+6); |
95 |
> |
return 0; |
96 |
> |
} |
97 |
> |
if (!strncmp(s, "NCOLS=", 6)) { |
98 |
> |
dcp->res.xr = atoi(s+6); |
99 |
> |
return 0; |
100 |
> |
} |
101 |
> |
/* check for reference depth */ |
102 |
|
if (!strncmp(s, DEPTHSTR, LDEPTHSTR)) { |
103 |
|
char *cp; |
104 |
|
strlcpy(dcp->depth_unit, s+LDEPTHSTR, sizeof(dcp->depth_unit)); |
141 |
|
} |
142 |
|
dcp->gotview *= (dcp->gotview > 0); |
143 |
|
/* get resolution string? */ |
144 |
< |
if (dcp->hdrflags & HF_RESIN && !fgetsresolu(&dcp->res, dcp->finp)) { |
144 |
> |
if (dcp->hdrflags & HF_RESIN && |
145 |
> |
(dcp->res.xr <= 0) | (dcp->res.yr <= 0) && |
146 |
> |
!fgetsresolu(&dcp->res, dcp->finp)) { |
147 |
|
if (dcp->hdrflags & HF_STDERR) { |
148 |
|
fputs(dcp->inpname, stderr); |
149 |
|
fputs(": bad resolution string\n", stderr); |