39 |
|
ncp->swapped = (nativebigendian() != rv); |
40 |
|
return 0; |
41 |
|
} |
42 |
+ |
if (!strncmp(s, "NCOMP=", 6)) { |
43 |
+ |
if (atoi(s+6) != 3) { |
44 |
+ |
if (ncp->hdrflags & HF_STDERR) { |
45 |
+ |
fputs(ncp->inpname, stderr); |
46 |
+ |
fputs(": NCOMP must equal 3\n", stderr); |
47 |
+ |
} |
48 |
+ |
return -1; |
49 |
+ |
} |
50 |
+ |
return 0; |
51 |
+ |
} |
52 |
+ |
if (!strncmp(s, "NROWS=", 6)) { |
53 |
+ |
ncp->res.yr = atoi(s+6); |
54 |
+ |
return 0; |
55 |
+ |
} |
56 |
+ |
if (!strncmp(s, "NCOLS=", 6)) { |
57 |
+ |
ncp->res.xr = atoi(s+6); |
58 |
+ |
return 0; |
59 |
+ |
} |
60 |
|
if (ncp->hdrflags & HF_HEADOUT) |
61 |
|
fputs(s, stdout); /* copy to standard output */ |
62 |
|
return 1; |
76 |
|
return 0; |
77 |
|
} |
78 |
|
/* get resolution string? */ |
79 |
< |
if (ncp->hdrflags & HF_RESIN && !fgetsresolu(&ncp->res, ncp->finp)) { |
79 |
> |
if (ncp->hdrflags & HF_RESIN && |
80 |
> |
(ncp->res.xr <= 0) | (ncp->res.yr <= 0) && |
81 |
> |
!fgetsresolu(&ncp->res, ncp->finp)) { |
82 |
|
if (ncp->hdrflags & HF_STDERR) { |
83 |
|
fputs(ncp->inpname, stderr); |
84 |
|
fputs(": bad resolution string\n", stderr); |