commit 8f6321c741743ae9c2ec046cd8f0fe49e79aafa2
parent cfcd8b79822fb4a5cc63218d727f5fefe018f6b8
Author: sin <sin@2f30.org>
Date: Mon, 18 Nov 2013 15:54:21 +0000
Inform the user if the terminal does not support colors
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/spectrum.c b/spectrum.c
@@ -241,8 +241,11 @@ main(int argc, char *argv[])
timeout(msec);
if (colors) {
- if (has_colors() == FALSE)
- goto out;
+ if (has_colors() == FALSE) {
+ endwin();
+ done(&fr);
+ errx(1, "terminal does not support colors");
+ }
start_color();
for (i = 0; i < LEN(color_ranges); i++) {
cr = &color_ranges[i];
@@ -258,7 +261,6 @@ main(int argc, char *argv[])
draw(&fr);
}
-out:
endwin(); /* restore terminal */
done(&fr); /* destroy context */