From 36964ca72d1965c67870ea1a1ca4cfd0d7d35be6 Mon Sep 17 00:00:00 2001 From: dean Date: Wed, 10 Apr 2002 22:30:15 +0000 Subject: [PATCH] When using TTY_GRAPHICS, correctly handle an unset TERM environment variable. --- src/options.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/options.c b/src/options.c index ed1eee1f1..a6e3aa752 100644 --- a/src/options.c +++ b/src/options.c @@ -513,7 +513,7 @@ initoptions() * config file/environment variable below. */ /* this detects the IBM-compatible console on most 386 boxes */ - if (!strncmp(nh_getenv("TERM"), "AT", 2)) { + if ((opts = nh_getenv("TERM")) && !strncmp(opts, "AT", 2)) { switch_graphics(IBM_GRAPHICS); # ifdef TEXTCOLOR iflags.use_color = TRUE; @@ -523,7 +523,8 @@ initoptions() #if defined(UNIX) || defined(VMS) # ifdef TTY_GRAPHICS /* detect whether a "vt" terminal can handle alternate charsets */ - if (!strncmpi(nh_getenv("TERM"), "vt", 2) && (AS && AE) && + if ((opts = nh_getenv("TERM")) && + !strncmpi(opts, "vt", 2) && AS && AE && index(AS, '\016') && index(AE, '\017')) { switch_graphics(DEC_GRAPHICS); }