diff options
author | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 01:50:44 +0100 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 01:50:44 +0100 |
commit | ec53566f5ccb4fb88f2f42c3099ab630c0f2375d (patch) | |
tree | 70dd3fa285a20f0c21497d25c1fcfb91137206bd /tsalis/src | |
parent | 2d036d562f9ebdd4f1f6bfc34d7fac86d5d414dc (diff) |
TSalis checks color availability.
Diffstat (limited to 'tsalis/src')
-rw-r--r-- | tsalis/src/printer.c | 14 | ||||
-rw-r--r-- | tsalis/src/tsalis.c | 5 |
2 files changed, 18 insertions, 1 deletions
diff --git a/tsalis/src/printer.c b/tsalis/src/printer.c index 9d82fc8..88da4a8 100644 --- a/tsalis/src/printer.c +++ b/tsalis/src/printer.c @@ -90,10 +90,22 @@ adjustWorld(void) } } +sbool +tsp_check(void) +{ + initscr(); + + if (!has_colors()) { + endwin(); + return SFALSE; + } + + return STRUE; +} + void tsp_init(void) { - initscr(); cbreak(); noecho(); curs_set(0); diff --git a/tsalis/src/tsalis.c b/tsalis/src/tsalis.c index f578e8f..7722ca9 100644 --- a/tsalis/src/tsalis.c +++ b/tsalis/src/tsalis.c @@ -52,6 +52,11 @@ onLoad(const char *fileName) static void init(int argc, char **argv) { + if (!tsp_check()) { + fputs("ERROR: Terminal not supported\n", stderr); + exit(1); + } + if (argc == 1) { onDefault(); } else if (argc == 2) { |