381 |
|
int columns2go = no_columns; |
382 |
|
char word[256]; |
383 |
|
/* sanity checks */ |
384 |
< |
if (comp_size) |
385 |
< |
return(output_stream(fp)); /* binary data -- just copy */ |
384 |
> |
if (comp_size || (no_columns == ni_columns) & (no_rows == ni_rows)) |
385 |
> |
return(output_stream(fp)); /* no-op -- just copy */ |
386 |
|
if (no_columns <= 0) { |
387 |
|
fprintf(stderr, "Missing -oc specification\n"); |
388 |
|
return(0); |
572 |
|
SET_FILE_BINARY(stdout); |
573 |
|
} |
574 |
|
/* check for no-op */ |
575 |
< |
if (!transpose & !i_header & !o_header && (comp_size || |
576 |
< |
(no_columns == ni_columns) & (no_rows == ni_rows))) { |
575 |
> |
if (!transpose & (i_header == o_header) && |
576 |
> |
(no_columns == ni_columns) & (no_rows == ni_rows)) { |
577 |
|
if (warnings) |
578 |
|
fprintf(stderr, "%s: no-op -- copying input verbatim\n", |
579 |
|
argv[0]); |
603 |
|
fputc('\n', stdout); /* finish new header */ |
604 |
|
} |
605 |
|
if (transpose) { /* transposing rows & columns? */ |
606 |
< |
MEMLOAD myMem; /* need to load into memory */ |
606 |
> |
MEMLOAD myMem; /* need to map into memory */ |
607 |
|
if (a == argc-1) { |
608 |
|
if (load_file(&myMem, stdin) <= 0) { |
609 |
|
fprintf(stderr, "%s: error loading file into memory\n", |
618 |
|
if (!do_transpose(&myMem)) |
619 |
|
return(1); |
620 |
|
/* free_load(&myMem); about to exit, so don't bother */ |
621 |
– |
} else if (comp_size || (no_columns==ni_columns) & (no_rows==ni_rows)) { |
622 |
– |
if (!output_stream(stdin)) /* just changed header */ |
623 |
– |
return(1); |
621 |
|
} else if (!do_resize(stdin)) /* reshaping input */ |
622 |
|
return(1); |
623 |
|
return(0); |