diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-01-10 07:36:48 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-01-10 07:36:48 +0100 |
| commit | 541acb83c081808dc2c19e2cb9a891792462999b (patch) | |
| tree | 95d30a16df29866e5c55b62ebe5e9eb941c01323 /src | |
| parent | Add vu-split (diff) | |
| download | blind-541acb83c081808dc2c19e2cb9a891792462999b.tar.gz blind-541acb83c081808dc2c19e2cb9a891792462999b.tar.bz2 blind-541acb83c081808dc2c19e2cb9a891792462999b.tar.xz | |
vu-single-colour: add support for infinity repeat
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src')
| -rw-r--r-- | src/vu-single-colour.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/vu-single-colour.c b/src/vu-single-colour.c index af66b77..7448218 100644 --- a/src/vu-single-colour.c +++ b/src/vu-single-colour.c @@ -3,6 +3,7 @@ #include "util.h" #include <inttypes.h> +#include <string.h> #include <unistd.h> typedef double pixel_t[4]; @@ -10,7 +11,7 @@ typedef double pixel_t[4]; static void usage(void) { - eprintf("usage: %s [-f frames] -w width -h height (X Y Z | Y) [alpha]\n", argv0); + eprintf("usage: %s [-f frames | -f 'inf'] -w width -h height (X Y Z | Y) [alpha]\n", argv0); } int @@ -21,11 +22,16 @@ main(int argc, char *argv[]) size_t x, y, n; pixel_t buf[1024]; ssize_t r; + int inf = 0; + char *arg; ARGBEGIN { case 'f': - if (tozu(EARGF(usage()), 1, SIZE_MAX, &frames)) - eprintf("argument of -f must be an integer in [1, %zu]\n", SIZE_MAX); + arg = EARGF(usage()); + if (!strcmp(arg, "inf")) + inf = 1, frames = 0; + else if (tozu(arg, 1, SIZE_MAX, &frames)) + eprintf("argument of -f must be an integer in [1, %zu] or 'inf'\n", SIZE_MAX); break; case 'w': if (tozu(EARGF(usage()), 1, SIZE_MAX, &width)) @@ -64,7 +70,7 @@ main(int argc, char *argv[]) buf[x][2] = Z; buf[x][3] = alpha; } - while (frames--) { + while (inf || frames--) { for (y = height; y--;) { for (x = width; x;) { x -= n = ELEMENTSOF(buf) < x ? ELEMENTSOF(buf) : x; |
