Some code improvements

This commit is contained in:
Markus Gans 2015-10-03 21:58:41 +02:00
parent 4b2ff8ce75
commit 29f615141c
1 changed files with 5 additions and 6 deletions

View File

@ -88,7 +88,7 @@ bool FTerm::NewFont;
bool FTerm::VGAFont; bool FTerm::VGAFont;
uChar FTerm::x11_button_state; uChar FTerm::x11_button_state;
termios FTerm::term_init; termios FTerm::term_init;
char FTerm::termtype[30] = {}; char FTerm::termtype[30] = "";
char* FTerm::term_name = 0; char* FTerm::term_name = 0;
char* FTerm::locale_name = 0; char* FTerm::locale_name = 0;
char* FTerm::locale_xterm = 0; char* FTerm::locale_xterm = 0;
@ -938,7 +938,7 @@ void FTerm::signal_handler (int signum)
void FTerm::init() void FTerm::init()
{ {
char local256[80] = ""; char local256[80] = "";
char *s1, *s2, *s3, *s4, *s5, *s6, *term_env1, *term_env2; char *s1, *s2, *s3, *s4, *s5, *s6;
output_buffer = new std::queue<int>; output_buffer = new std::queue<int>;
vt100_alt_char = new std::map<uChar,uChar>; vt100_alt_char = new std::map<uChar,uChar>;
@ -1003,10 +1003,9 @@ void FTerm::init()
x11_button_state = 0x03; x11_button_state = 0x03;
// Import untrusted environment variable TERM // Import untrusted environment variable TERM
term_env1 = getenv("TERM"); const char* term_env = getenv("TERM");
term_env2 = term_env1; if ( term_env != 0 )
if ( term_env2 ) strncat (termtype, term_env, sizeof(termtype) - strlen(termtype) - 1);
snprintf (termtype, sizeof(termtype), "%s", term_env2);
else else
strncpy (termtype, const_cast<char*>("vt100"), 6); strncpy (termtype, const_cast<char*>("vt100"), 6);