diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-06-02 22:31:08 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-06-02 22:31:08 +0200 |
| commit | c295bcecda2cdf04b28c1b4767e05e815b41a04e (patch) | |
| tree | 2e4c8c4b6f9e1b5f06cb643992ef955156f5c72d /src/blind-cat-rows.c | |
| parent | Add blind-interleave, blind-cat-rows, and blind-cat-cols (diff) | |
| download | blind-c295bcecda2cdf04b28c1b4767e05e815b41a04e.tar.gz blind-c295bcecda2cdf04b28c1b4767e05e815b41a04e.tar.bz2 blind-c295bcecda2cdf04b28c1b4767e05e815b41a04e.tar.xz | |
Fix blind-cat-cols and blind-cat-rows cmdline and document blind-disperse, blind-interleave, blind-split-cols, and blind-split-rows
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
| -rw-r--r-- | src/blind-cat-rows.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/blind-cat-rows.c b/src/blind-cat-rows.c index 32113e5..a41655c 100644 --- a/src/blind-cat-rows.c +++ b/src/blind-cat-rows.c @@ -1,26 +1,25 @@ /* See LICENSE file for copyright and license details. */ #include "common.h" -USAGE("(file rows) ...") +USAGE("file ...") int main(int argc, char *argv[]) { struct stream *streams; - size_t parts, height = 0, *rows, i; + size_t height = 0, *rows; + int i; - UNOFLAGS(argc % 2 || !argc); + UNOFLAGS(!argc); - parts = (size_t)argc / 2; - streams = emalloc2(parts, sizeof(*streams)); - rows = alloca(parts * sizeof(*rows)); + streams = emalloc2((size_t)argc, sizeof(*streams)); + rows = alloca((size_t)argc * sizeof(*rows)); - for (i = 0; i < parts; i++) { - eopen_stream(streams + i, argv[i * 2]); - rows[i] = etozu_arg("rows", argv[i * 2 + 1], 1, SIZE_MAX); + for (i = 0; i < argc; i++) { + eopen_stream(streams + i, argv[i]); if (streams[i].height > SIZE_MAX - height) eprintf("output video is too wide\n"); - height += streams[i].height; + height += rows[i] = streams[i].height; if (i) { streams[i].height = streams->height; echeck_compat(streams, streams + i); @@ -31,10 +30,10 @@ main(int argc, char *argv[]) fprint_stream_head(stdout, streams); efflush(stdout, "<stdout>"); - for (i = 0; i < parts; i++, i = i == parts ? 0 : i) + for (i = 0; i < argc; i++, i = i == argc ? 0 : i) if (esend_rows(streams + i, STDOUT_FILENO, rows[i], "<stdout>") != rows[i]) break; - for (i = 0; i < parts; i++) + for (i = 0; i < argc; i++) close(streams[i].fd); free(streams); |
