From 91eae00bfa6abfb4b50833768d54ac48678c88f6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 31 May 2017 21:06:25 +0200 Subject: blind-stack: add -s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/blind-stack.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/blind-stack.c') diff --git a/src/blind-stack.c b/src/blind-stack.c index b7dcc8e..bff2923 100644 --- a/src/blind-stack.c +++ b/src/blind-stack.c @@ -1,7 +1,7 @@ /* See LICENSE file for copyright and license details. */ #include "common.h" -USAGE("[-b] bottom-stream ... top-stream") +USAGE("[-bs] bottom-stream ... top-stream") #define PROCESS(TYPE, BLEND)\ do {\ @@ -42,13 +42,16 @@ main(int argc, char *argv[]) { struct stream *streams; size_t n_streams, i, frames = 0, tmp; - int blend = 0; + int blend = 0, shortest = 0; void (*process)(struct stream *streams, size_t n_streams, size_t n); ARGBEGIN { case 'b': blend = 1; break; + case 's': + shortest = 1; + break; default: usage(); } ARGEND; @@ -61,7 +64,7 @@ main(int argc, char *argv[]) for (i = 0; i < n_streams; i++) { eopen_stream(streams + i, argv[i]); - if (streams[i].frames > frames) + if (shortest ? (streams[i].frames && streams[i].frames) < frames : streams[i].frames > frames) frames = streams[i].frames; } @@ -76,7 +79,7 @@ main(int argc, char *argv[]) fprint_stream_head(stdout, streams); efflush(stdout, ""); streams->frames = tmp; - process_multiple_streams(streams, n_streams, STDOUT_FILENO, "", process); + process_multiple_streams(streams, n_streams, STDOUT_FILENO, "", shortest, process); free(streams); return 0; -- cgit v1.2.3-70-g09d2