Better terminal identification

This commit is contained in:
Markus Gans 2016-05-01 22:18:54 +02:00
parent f77c2b3ff1
commit d40b5f22a4
1 changed files with 6 additions and 4 deletions

View File

@ -280,18 +280,20 @@ void FTerm::identifyTermType()
if ( (fp = fopen("/etc/ttytype", "r")) != 0 if ( (fp = fopen("/etc/ttytype", "r")) != 0
|| (fp = fopen("/etc/ttys", "r")) != 0 ) || (fp = fopen("/etc/ttys", "r")) != 0 )
{ {
char str[BUFSIZ]; char* p;
char *p, *type, *name; char* type;
char* name;
char str[BUFSIZ];
// get term basename // get term basename
const char *term_basename = strrchr(term_name, '/'); const char* term_basename = strrchr(term_name, '/');
if ( term_basename == 0 ) if ( term_basename == 0 )
term_basename = term_name; term_basename = term_name;
else else
term_basename++; term_basename++;
// read and parse the file // read and parse the file
while ( fgets(str, sizeof(str) - 1, fp) != 0 ) while ( fgets(str, sizeof(str)-1, fp) != 0 )
{ {
type = name = 0; // 0 == not found type = name = 0; // 0 == not found
p = str; p = str;