| 237 |
|
|
| 238 |
|
if (fp == NULL) |
| 239 |
|
return(0); |
| 240 |
< |
fflush(stdout); /* assumes nothing in input buffer */ |
| 241 |
< |
while ((n = read(fileno(fp), buf, sizeof(buf))) > 0) |
| 240 |
> |
fflush(stdout); |
| 241 |
> |
while ((n = fread(buf, 1, sizeof(buf), fp)) > 0) |
| 242 |
|
if (write(fileno(stdout), buf, n) != n) |
| 243 |
|
return(0); |
| 244 |
< |
return(n >= 0); |
| 244 |
> |
return(!ferror(fp)); |
| 245 |
|
} |
| 246 |
|
|
| 247 |
|
/* get next word from stream, leaving stream on EOL or start of next word */ |
| 372 |
|
int columns2go = no_columns; |
| 373 |
|
char word[256]; |
| 374 |
|
/* sanity checks */ |
| 375 |
< |
if (comp_size) { |
| 376 |
< |
fputs("Bad call to do_resize (binary input)\n", stderr); |
| 377 |
< |
return(0); |
| 378 |
< |
} |
| 375 |
> |
if (comp_size) |
| 376 |
> |
return(output_stream(fp)); /* binary data -- just copy */ |
| 377 |
|
if (no_columns <= 0) { |
| 378 |
|
fprintf(stderr, "Missing -oc specification\n"); |
| 379 |
|
return(0); |
| 564 |
|
SET_FILE_BINARY(stdout); |
| 565 |
|
} |
| 566 |
|
/* check for no-op */ |
| 567 |
< |
if (!transpose && (comp_size || |
| 567 |
> |
if (!transpose & (i_header == o_header) && (comp_size || |
| 568 |
|
(no_columns == ni_columns) & (no_rows == ni_rows))) { |
| 569 |
|
if (warnings) |
| 570 |
|
fprintf(stderr, "%s: no-op -- copying input verbatim\n", |