aboutsummaryrefslogtreecommitdiff
path: root/tsalis/src
diff options
context:
space:
mode:
Diffstat (limited to 'tsalis/src')
-rw-r--r--tsalis/src/printer.c14
-rw-r--r--tsalis/src/tsalis.c5
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) {