summaryrefslogtreecommitdiffstats
path: root/listen
diff options
context:
space:
mode:
authorroot <root@db0fhn.ampr.org>2016-07-04 12:28:34 +0200
committerroot <root@db0fhn.ampr.org>2016-07-04 12:28:34 +0200
commit415e155e3f014297aae8f19eddf623b9cb83eae9 (patch)
tree75d87516fc83e47ee22c8d9ff53bc79ceafe5b32 /listen
parent83ffd1fcf9aade0c91834fe3058a4d5644eeba3f (diff)
fixed segfault on -c option.
has_colors() was called before initscr(). also added error message if terminal does not support colors (and then exit). Signed-off-by: root <root@db0fhn.ampr.org>
Diffstat (limited to 'listen')
-rw-r--r--listen/utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/listen/utils.c b/listen/utils.c
index 667bab7..f5b3b08 100644
--- a/listen/utils.c
+++ b/listen/utils.c
@@ -81,9 +81,11 @@ void lprintf(int dtype, char *fmt, ...)
int initcolor(void)
{
- if (!has_colors())
- return 0;
initscr(); /* Start ncurses */
+ if (!has_colors()) { endwin();
+ fprintf(stderr, "Your terminal does not support color\n");
+ exit(1);
+ }
start_color(); /* Initialize color support */
refresh(); /* Clear screen */
noecho(); /* Don't echo */