termcap.c (17382) | termcap.c (18502) |
---|---|
1/* 2 * Copyright (c) 1994, Paul Richards. 3 * 4 * All rights reserved. 5 * 6 * This software may be used, modified, copied, distributed, and sold, in both 7 * source and binary form provided that the above copyright and these terms 8 * are retained, verbatim, as the first lines of this file. Under no --- 19 unchanged lines hidden (view full) --- 28 29int 30set_termcap(void) 31{ 32 char *term; 33 int stat; 34 struct ttysize ts; 35 | 1/* 2 * Copyright (c) 1994, Paul Richards. 3 * 4 * All rights reserved. 5 * 6 * This software may be used, modified, copied, distributed, and sold, in both 7 * source and binary form provided that the above copyright and these terms 8 * are retained, verbatim, as the first lines of this file. Under no --- 19 unchanged lines hidden (view full) --- 28 29int 30set_termcap(void) 31{ 32 char *term; 33 int stat; 34 struct ttysize ts; 35 |
36 OnVTY = FALSE; | |
37 term = getenv("TERM"); 38 stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); 39 40 if (getpid() != 1) { 41 DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); 42 if (DebugFD < 0) 43 DebugFD = open("/dev/null", O_RDWR, 0); 44 } 45 | 36 term = getenv("TERM"); 37 stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); 38 39 if (getpid() != 1) { 40 DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); 41 if (DebugFD < 0) 42 DebugFD = open("/dev/null", O_RDWR, 0); 43 } 44 |
46 if (stat < 0) { | 45 if (!OnVTY || (stat < 0)) { |
47 if (!term) { 48 if (setenv("TERM", "vt100", 1) < 0) 49 return -1; 50 if (setenv("TERMCAP", termcap_vt100, 1) < 0) 51 return -1; 52 } 53 if (DebugFD == -1) 54 DebugFD = dup(1); --- 18 unchanged lines hidden (view full) --- 73 else { 74 if (!term) { 75 if (setenv("TERM", "cons25-m", 1) < 0) 76 return -1; 77 if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) 78 return -1; 79 } 80 } | 46 if (!term) { 47 if (setenv("TERM", "vt100", 1) < 0) 48 return -1; 49 if (setenv("TERMCAP", termcap_vt100, 1) < 0) 50 return -1; 51 } 52 if (DebugFD == -1) 53 DebugFD = dup(1); --- 18 unchanged lines hidden (view full) --- 72 else { 73 if (!term) { 74 if (setenv("TERM", "cons25-m", 1) < 0) 75 return -1; 76 if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) 77 return -1; 78 } 79 } |
81 OnVTY = TRUE; | |
82 } 83 if (ioctl(0, TIOCGSIZE, &ts) == -1) { 84 msgDebug("Unable to get terminal size - errno %d\n", errno); 85 ts.ts_lines = 0; 86 } 87 StatusLine = ts.ts_lines ? ts.ts_lines : (OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE); 88 return 0; 89} | 80 } 81 if (ioctl(0, TIOCGSIZE, &ts) == -1) { 82 msgDebug("Unable to get terminal size - errno %d\n", errno); 83 ts.ts_lines = 0; 84 } 85 StatusLine = ts.ts_lines ? ts.ts_lines : (OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE); 86 return 0; 87} |