Introduction
Introduction Statistics Contact Development Disclaimer Help
blind-split-rows.c - blind - suckless command-line video editing utility
git clone git://git.suckless.org/blind
Log
Files
Refs
README
LICENSE
---
blind-split-rows.c (1161B)
---
1 /* See LICENSE file for copyright and license details. */
2 #include "common.h"
3
4 USAGE("(file rows) ...")
5
6 int
7 main(int argc, char *argv[])
8 {
9 struct stream stream;
10 size_t *rows, period = 0, parts, i;
11 int *fds;
12
13 UNOFLAGS(argc % 2 || !argc);
14
15 eopen_stream(&stream, NULL);
16
17 parts = (size_t)argc / 2;
18 rows = alloca(parts * sizeof(*rows));
19 fds = alloca(parts * sizeof(*fds));
20
21 for (i = 0; i < parts; i++) {
22 fds[i] = eopen(argv[i * 2], O_WRONLY | O_CREAT | O_TRUNC…
23 rows[i] = etozu_arg("rows", argv[i * 2 + 1], 1, SIZE_MAX…
24 }
25 for (i = 0; i < parts; i++) {
26 if (rows[i] > SIZE_MAX - period)
27 goto bad_row_count;
28 period += rows[i];
29 }
30 if (period != stream.height)
31 goto bad_row_count;
32
33 for (i = 0; i < parts; i++)
34 if (DPRINTF_HEAD(fds[i], stream.frames, stream.width, ro…
35 eprintf("dprintf %s:", argv[i * 2]);
36 for (i = 0; i < parts; i++, i = i == parts ? 0 : i)
37 if (esend_rows(&stream, fds[i], rows[i], argv[i * 2]) !=…
38 break;
39 for (i = 0; i < parts; i++)
40 close(fds[i]);
41
42 return 0;
43
44 bad_row_count:
45 eprintf("the sum of all rows must add up to the height of the in…
46 return 1;
47 }
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.