aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-05-01 23:55:12 +0200
committerMattias Andrée <maandree@kth.se>2020-05-01 23:55:22 +0200
commitb5d8900b6baa5b8b840589f4ede6724b3dfa6247 (patch)
tree78734ba3fe10b618f55338645988863e66b60d83
parentm (diff)
downloadlibskrift-b5d8900b6baa5b8b840589f4ede6724b3dfa6247.tar.gz
libskrift-b5d8900b6baa5b8b840589f4ede6724b3dfa6247.tar.bz2
libskrift-b5d8900b6baa5b8b840589f4ede6724b3dfa6247.tar.xz
demo: refuse to write image to terminal
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--demo.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/demo.c b/demo.c
index dbc20c7..063721c 100644
--- a/demo.c
+++ b/demo.c
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
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;