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