From b5d8900b6baa5b8b840589f4ede6724b3dfa6247 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 1 May 2020 23:55:12 +0200 Subject: demo: refuse to write image to terminal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- demo.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/demo.c b/demo.c index dbc20c7..063721c 100644 --- a/demo.c +++ b/demo.c @@ -3,6 +3,7 @@ #include #include +#include int main(void) @@ -15,6 +16,11 @@ main(void) double height; size_t size, i; + if (isatty(STDOUT_FILENO)) { + fprintf(stderr, "Output file is a binary PAM image file, I am not writing that to a terminal.\n"); + return 1; + } + rendering.smoothing = LIBSKRIFT_SUBPIXEL; rendering.subpixel_order = LIBSKRIFT_NONE; rendering.flags = LIBSKRIFT_MIRROR_CHARS | LIBSKRIFT_MIRROR_TEXT; -- cgit v1.2.3-70-g09d2