aboutsummaryrefslogtreecommitdiff
path: root/tsalis
diff options
context:
space:
mode:
Diffstat (limited to 'tsalis')
-rw-r--r--tsalis/include/printer.h39
-rw-r--r--tsalis/src/printer.c14
-rw-r--r--tsalis/src/tsalis.c5
3 files changed, 38 insertions, 20 deletions
diff --git a/tsalis/include/printer.h b/tsalis/include/printer.h
index 5356594..f5d8c3c 100644
--- a/tsalis/include/printer.h
+++ b/tsalis/include/printer.h
@@ -12,24 +12,25 @@ extern sword g_processGeneScroll;
extern sword g_worldPos;
extern sword g_worldZoom;
-void tsp_init (void);
-void tsp_quit (void);
-void tsp_onResize (void);
-void tsp_prevPage (void);
-void tsp_nextPage (void);
-void tsp_scrollUp (void);
-void tsp_scrollDown (void);
-void tsp_scrollLeft (void);
-void tsp_scrollRight (void);
-void tsp_scrollToTop (void);
-void tsp_scrollToLeft (void);
-void tsp_zoomIn (void);
-void tsp_zoomOut (void);
-void tsp_prevOrganism (void);
-void tsp_nextOrganism (void);
-void tsp_gotoSelectedProc (void);
-void tsp_selectProcess (sword proc);
-void tsp_moveTo (sword loc);
-void tsp_printData (void);
+sbool tsp_check (void);
+void tsp_init (void);
+void tsp_quit (void);
+void tsp_onResize (void);
+void tsp_prevPage (void);
+void tsp_nextPage (void);
+void tsp_scrollUp (void);
+void tsp_scrollDown (void);
+void tsp_scrollLeft (void);
+void tsp_scrollRight (void);
+void tsp_scrollToTop (void);
+void tsp_scrollToLeft (void);
+void tsp_zoomIn (void);
+void tsp_zoomOut (void);
+void tsp_prevOrganism (void);
+void tsp_nextOrganism (void);
+void tsp_gotoSelectedProc (void);
+void tsp_selectProcess (sword proc);
+void tsp_moveTo (sword loc);
+void tsp_printData (void);
#endif
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) {