From 1f07892210515d5cf741727efc2532b8e50d4e71 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 10 Jan 2017 02:29:14 +0100 Subject: vu-image-to-frame: add -h: headless frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/vu-image-to-frame.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/vu-image-to-frame.c b/src/vu-image-to-frame.c index ffa5b7f..7e70999 100644 --- a/src/vu-image-to-frame.c +++ b/src/vu-image-to-frame.c @@ -26,7 +26,7 @@ get_value(void *buffer) static void usage(void) { - eprintf("usage: %s\n", argv0); + eprintf("usage: [-h] %s\n", argv0); } int @@ -43,8 +43,12 @@ main(int argc, char *argv[]) double red, green, blue, pixel[4]; char width[3 * sizeof(size_t) + 1] = {0}; char height[3 * sizeof(size_t) + 1] = {0}; + int headless = 0; ARGBEGIN { + case 'h': + headless = 1; + break; default: usage(); } ARGEND; @@ -120,10 +124,12 @@ header_done: if (!*width || !*height) eprintf("convertion failed\n"); - printf("%s %s xyza\n%cuivf", width, height, 0); - fflush(stdout); - if (ferror(stdout)) - eprintf(":"); + if (!headless) { + printf("%s %s xyza\n%cuivf", width, height, 0); + fflush(stdout); + if (ferror(stdout)) + eprintf(":"); + } for (;;) { for (ptr = 0; ptr + 15 < n; ptr += 16) { -- cgit v1.2.3-70-g09d2