libeinfo: check for "color" in the terminal name

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
This commit is contained in:
Andrew Gregory 2012-10-31 11:49:20 -04:00 committed by William Hubbs
parent 630d23283a
commit 3896b9d55c

View File

@ -150,11 +150,11 @@ static bool term_is_cons25 = false;
static char termcapbuf[2048]; static char termcapbuf[2048];
static char tcapbuf[512]; static char tcapbuf[512];
#else #else
/* No curses support, so we hardcode a list of colour capable terms */ /* No curses support, so we hardcode a list of colour capable terms
* Only terminals without "color" in the name need to be explicitly listed */
static const char *const color_terms[] = { static const char *const color_terms[] = {
"Eterm", "Eterm",
"ansi", "ansi",
"color-xterm",
"con132x25", "con132x25",
"con132x30", "con132x30",
"con132x43", "con132x43",
@ -174,7 +174,6 @@ static const char *const color_terms[] = {
"kterm", "kterm",
"linux", "linux",
"linux-c", "linux-c",
"mach-color",
"mlterm", "mlterm",
"putty", "putty",
"rxvt", "rxvt",
@ -189,8 +188,6 @@ static const char *const color_terms[] = {
"vt220", "vt220",
"wsvt25", "wsvt25",
"xterm", "xterm",
"xterm-256color",
"xterm-color",
"xterm-debian", "xterm-debian",
NULL NULL
}; };
@ -402,7 +399,10 @@ colour_terminal(FILE * EINFO_RESTRICT f)
* which is not available to us when we boot */ * which is not available to us when we boot */
if (term_is_cons25 || strcmp(term, "wsvt25") == 0) { if (term_is_cons25 || strcmp(term, "wsvt25") == 0) {
#else #else
while (color_terms[i]) { if (strstr(term, "color"))
in_colour = 1;
while (color_terms[i] && in_colour != 1) {
if (strcmp(color_terms[i], term) == 0) { if (strcmp(color_terms[i], term) == 0) {
in_colour = 1; in_colour = 1;
} }