38 |
|
long nexpected = (long)ncp->res.xr * ncp->res.yr; |
39 |
|
|
40 |
|
if (ncp->inpfmt[0]) { |
41 |
< |
if (strstr(ncp->inpfmt, "ascii") != NULL) |
41 |
> |
if (!strcmp(ncp->inpfmt, "ascii")) |
42 |
|
ncp->format = 'a'; |
43 |
< |
else if (strstr(ncp->inpfmt, "float") != NULL) |
43 |
> |
else if (!strcmp(ncp->inpfmt, "float")) |
44 |
|
ncp->format = 'f'; |
45 |
< |
else if (strstr(ncp->inpfmt, "double") != NULL) |
45 |
> |
else if (!strcmp(ncp->inpfmt, "double")) |
46 |
|
ncp->format = 'd'; |
47 |
|
else { |
48 |
|
fputs(ncp->inpname, stderr); |
52 |
|
return 0; |
53 |
|
} |
54 |
|
} |
55 |
+ |
if (ncp->format == 'a') |
56 |
+ |
SET_FILE_TEXT(ncp->finp); |
57 |
|
|
58 |
|
do { |
59 |
|
int ok = 0; |
191 |
|
fputs(": can only handle standard pixel ordering\n", stderr); |
192 |
|
return 0; |
193 |
|
} |
194 |
+ |
|
195 |
|
while (scanf("%d %d", &x, &y) == 2) { |
196 |
|
|
197 |
|
y = ncp->res.yr-1 - y; |
342 |
|
fputs(": cannot open for writing\n", stderr); |
343 |
|
return 1; |
344 |
|
} |
345 |
< |
SET_FILE_BINARY(nc.finp); |
346 |
< |
if (reverse || nc.format != 'a') |
344 |
< |
SET_FILE_BINARY(stdout); |
345 |
> |
SET_FILE_BINARY(dc.finp); /* starting assumption */ |
346 |
> |
SET_FILE_BINARY(stdout); |
347 |
|
#ifdef getc_unlocked /* avoid stupid semaphores */ |
348 |
|
flockfile(nc.finp); |
349 |
|
flockfile(stdout); |
351 |
|
/* read/copy header */ |
352 |
|
if (!process_nc_header(&nc, a, argv)) |
353 |
|
return 1; |
354 |
+ |
|
355 |
+ |
if (reverse && nc.format == 'a') |
356 |
+ |
SET_FILE_TEXT(stdout); |
357 |
|
/* process data */ |
358 |
|
if (!reverse) { |
359 |
|
if (!encode_normals(&nc)) |