termcap.c (8347) | termcap.c (8601) |
---|---|
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 --- 12 unchanged lines hidden (view full) --- 21#include <machine/console.h> 22 23#include "sysinstall.h" 24 25int 26set_termcap(void) 27{ 28 char *term; | 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 --- 12 unchanged lines hidden (view full) --- 21#include <machine/console.h> 22 23#include "sysinstall.h" 24 25int 26set_termcap(void) 27{ 28 char *term; |
29 int stat; |
|
29 30 OnVTY = OnSerial = FALSE; | 30 31 OnVTY = OnSerial = FALSE; |
32 if (getpid() != 1) 33 DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); |
|
31 term = getenv("TERM"); | 34 term = getenv("TERM"); |
32 if (term == NULL) { 33 if (ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay) < 0) { | 35 stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); 36 if (stat < 0) { 37 if (!term) { |
34 if (setenv("TERM", "vt100", 1) < 0) 35 return -1; 36 if (setenv("TERMCAP", termcap_vt100, 1) < 0) 37 return -1; | 38 if (setenv("TERM", "vt100", 1) < 0) 39 return -1; 40 if (setenv("TERMCAP", termcap_vt100, 1) < 0) 41 return -1; |
38 DebugFD = dup(1); 39 OnSerial = TRUE; 40 } else if (ColorDisplay) { 41 if (setenv("TERM", "cons25", 1) < 0) 42 return -1; 43 if (setenv("TERMCAP", termcap_cons25, 1) < 0) 44 return -1; 45 DebugFD = open("/dev/ttyv1", O_WRONLY); 46 OnVTY = TRUE; 47 } else { 48 if (setenv("TERM", "cons25-m", 1) < 0) 49 return -1; 50 if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) 51 return -1; 52 DebugFD = open("/dev/ttyv1", O_WRONLY); 53 OnVTY = TRUE; | |
54 } | 42 } |
43 if (DebugFD == -1) 44 DebugFD = dup(1); 45 OnSerial = TRUE; |
|
55 } 56 else { | 46 } 47 else { |
57 DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); | 48 if (ColorDisplay) { 49 if (!term) { 50 if (setenv("TERM", "cons25", 1) < 0) 51 return -1; 52 if (setenv("TERMCAP", termcap_cons25, 1) < 0) 53 return -1; 54 } 55 } 56 else { 57 if (!term) { 58 if (setenv("TERM", "cons25-m", 1) < 0) 59 return -1; 60 if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) 61 return -1; 62 } 63 } 64 if (DebugFD == -1) 65 DebugFD = open("/dev/ttyv1", O_WRONLY); 66 OnVTY = TRUE; |
58 } 59 return 0; 60} | 67 } 68 return 0; 69} |