blind-cat-cols.c - blind - suckless command-line video editing utility | |
git clone git://git.suckless.org/blind | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
blind-cat-cols.c (923B) | |
--- | |
1 /* See LICENSE file for copyright and license details. */ | |
2 #include "common.h" | |
3 | |
4 USAGE("stream ...") | |
5 | |
6 int | |
7 main(int argc, char *argv[]) | |
8 { | |
9 struct stream *streams; | |
10 size_t width = 0, *cols; | |
11 int i; | |
12 | |
13 UNOFLAGS(!argc); | |
14 | |
15 streams = emalloc2((size_t)argc, sizeof(*streams)); | |
16 cols = alloca((size_t)argc * sizeof(*cols)); | |
17 | |
18 for (i = 0; i < argc; i++) { | |
19 eopen_stream(streams + i, argv[i]); | |
20 if (streams[i].width > SIZE_MAX - width) | |
21 eprintf("output video is too tall\n"); | |
22 width += cols[i] = streams[i].width; | |
23 if (i) { | |
24 streams[i].width = streams->width; | |
25 echeck_compat(streams, streams + i); | |
26 } | |
27 } | |
28 | |
29 streams->width = width; | |
30 fprint_stream_head(stdout, streams); | |
31 efflush(stdout, "<stdout>"); | |
32 | |
33 for (i = 0; i < argc; i++, i = i == argc ? 0 : i) | |
34 if (esend_pixels(streams + i, STDOUT_FILENO, cols[i], "<… | |
35 break; | |
36 for (i = 0; i < argc; i++) | |
37 close(streams[i].fd); | |
38 | |
39 free(streams); | |
40 return 0; | |
41 } |