From a2b4e70705acb5daa5b7b23b46328c463f41c61e Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Thu, 18 May 1995 15:29:47 +0000 Subject: [PATCH] 1. Use 8x16 fonts. 2. Don't use russian screenmap - apparently not necessary with right font. 3. Dequote bogusly quoted font name in english language setting. 4. Use setterm() and hack around an undesirable side-effect (cbreak is unset). 5. be smarter about setting OnVTY, and use it in cases where it makes sense. Submitted by: Nickolay N. Dudorov --- release/sysinstall/Makefile | 15 ++++------ release/sysinstall/lang.c | 25 ++++++++--------- release/sysinstall/sysinstall.h | 9 +++--- release/sysinstall/system.c | 26 ++++++++---------- release/sysinstall/termcap.c | 47 +++++++++++++++++++------------- usr.sbin/sade/Makefile | 15 ++++------ usr.sbin/sade/sade.h | 9 +++--- usr.sbin/sade/system.c | 26 ++++++++---------- usr.sbin/sade/termcap.c | 47 +++++++++++++++++++------------- usr.sbin/sysinstall/Makefile | 15 ++++------ usr.sbin/sysinstall/sysinstall.h | 9 +++--- usr.sbin/sysinstall/system.c | 26 ++++++++---------- usr.sbin/sysinstall/termcap.c | 47 +++++++++++++++++++------------- 13 files changed, 159 insertions(+), 157 deletions(-) diff --git a/release/sysinstall/Makefile b/release/sysinstall/Makefile index 949b57dca716..0fb300a0d735 100644 --- a/release/sysinstall/Makefile +++ b/release/sysinstall/Makefile @@ -62,17 +62,14 @@ makedevs.c: dev2c.sh Makefile rtermcap ./rtermcap vt100 | \ file2c 'const char termcap_vt100[] = {' ',0};' \ >> makedevs.tmp - file2c 'const u_char font_iso_8x14[] = {' '};' \ - < ${.CURDIR}/../../share/syscons/fonts/iso-8x14.fnt \ + cat ${.CURDIR}/../../share/syscons/fonts/iso-8x16.fnt | \ + uudecode | file2c 'const u_char font_iso_8x16[] = {' '};' \ >> makedevs.tmp - file2c 'const u_char font_cp850_8x14[] = {' '};' \ - < ${.CURDIR}/../../share/syscons/fonts/cp850-8x14.fnt \ + cat ${.CURDIR}/../../share/syscons/fonts/cp850-8x16.fnt | \ + uudecode | file2c 'const u_char font_cp850_8x16[] = {' '};' \ >> makedevs.tmp - file2c 'const u_char font_koi8_r_8x14[] = {' '};' \ - < ${.CURDIR}/../../share/syscons/fonts/koi8-r-8x14.fnt \ - >> makedevs.tmp - file2c 'const u_char koi8_r2cp866[] = {' '};' \ - < ${.CURDIR}/../../share/syscons/scrnmaps/koi8-r2cp866 \ + cat ${.CURDIR}/../../share/syscons/fonts/koi8-r-8x16.fnt | \ + uudecode | file2c 'const u_char font_koi8_r_8x16[] = {' '};' \ >> makedevs.tmp mv makedevs.tmp makedevs.c diff --git a/release/sysinstall/lang.c b/release/sysinstall/lang.c index 7f9d16d70d57..744627d1a279 100644 --- a/release/sysinstall/lang.c +++ b/release/sysinstall/lang.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: lang.c,v 1.1 1995/05/04 19:48:12 jkh Exp $ + * $Id: lang.c,v 1.2 1995/05/05 23:47:41 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -46,7 +46,7 @@ void lang_set_Danish(char *str) { - systemChangeFont(font_iso_8x14); + systemChangeFont(font_iso_8x16); systemChangeLang("da_DK.ISO8859-1"); systemChangeTerminal("cons25l1", termcap_cons25l1, "cons25l1-m", termcap_cons25l1_m); @@ -55,7 +55,7 @@ lang_set_Danish(char *str) void lang_set_Dutch(char *str) { - systemChangeFont(font_iso_8x14); + systemChangeFont(font_iso_8x16); systemChangeLang("nl_NL.ISO8859-1"); systemChangeTerminal("cons25l1", termcap_cons25l1, "cons25l1-m", termcap_cons25l1_m); @@ -64,7 +64,7 @@ lang_set_Dutch(char *str) void lang_set_English(char *str) { - systemChangeFont("font_cp850_8x14"); + systemChangeFont(font_cp850_8x16); systemChangeLang("en_US.ISO8859-1"); systemChangeTerminal("cons25", termcap_cons25, "cons25-m", termcap_cons25_m); @@ -73,7 +73,7 @@ lang_set_English(char *str) void lang_set_French(char *str) { - systemChangeFont(font_iso_8x14); + systemChangeFont(font_iso_8x16); systemChangeLang("fr_FR.ISO8859-1"); systemChangeTerminal("cons25l1", termcap_cons25l1, "cons25l1-m", termcap_cons25l1_m); @@ -82,7 +82,7 @@ lang_set_French(char *str) void lang_set_German(char *str) { - systemChangeFont(font_iso_8x14); + systemChangeFont(font_iso_8x16); systemChangeLang("de_DE.ISO8859-1"); systemChangeTerminal("cons25l1", termcap_cons25l1, "cons25l1-m", termcap_cons25l1_m); @@ -91,7 +91,7 @@ lang_set_German(char *str) void lang_set_Italian(char *str) { - systemChangeFont(font_iso_8x14); + systemChangeFont(font_iso_8x16); systemChangeLang("it_IT.ISO8859-1"); systemChangeTerminal("cons25l1", termcap_cons25l1, "cons25l1-m", termcap_cons25l1_m); @@ -101,7 +101,7 @@ lang_set_Italian(char *str) void lang_set_Japanese(char *str) { - systemChangeFont(font_iso_8x14); + systemChangeFont(font_iso_8x16); systemChangeLang("ja_JP.ROMAJI"); systemChangeTerminal("cons25", termcap_cons25, "cons25-m", termcap_cons25_m); @@ -110,7 +110,7 @@ lang_set_Japanese(char *str) void lang_set_Norwegian(char *str) { - systemChangeFont(font_iso_8x14); + systemChangeFont(font_iso_8x16); systemChangeLang("no_NO.ISO8859-1"); systemChangeTerminal("cons25l1", termcap_cons25l1, "cons25l1-m", termcap_cons25l1_m); @@ -119,9 +119,8 @@ lang_set_Norwegian(char *str) void lang_set_Russian(char *str) { - systemChangeFont(font_koi8_r_8x14); + systemChangeFont(font_koi8_r_8x16); systemChangeLang("ru_SU.KOI8-R"); - systemChangeScreenmap(koi8_r2cp866); systemChangeTerminal("cons25r", termcap_cons25r, "cons25r-m", termcap_cons25r_m); } @@ -129,7 +128,7 @@ lang_set_Russian(char *str) void lang_set_Spanish(char *str) { - systemChangeFont(font_iso_8x14); + systemChangeFont(font_iso_8x16); systemChangeLang("es_ES.ISO8859-1"); systemChangeTerminal("cons25l1", termcap_cons25l1, "cons25l1-m", termcap_cons25l1_m); @@ -138,7 +137,7 @@ lang_set_Spanish(char *str) void lang_set_Swedish(char *str) { - systemChangeFont(font_iso_8x14); + systemChangeFont(font_iso_8x16); systemChangeLang("sv_SV.ISO8859-1"); systemChangeTerminal("cons25l1", termcap_cons25l1, "cons25l1-m", termcap_cons25l1_m); diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index e3f00f059a78..b8452c2de135 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.17 1995/05/16 11:37:25 jkh Exp $ + * $Id: sysinstall.h,v 1.18 1995/05/17 14:39:56 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -279,10 +279,9 @@ extern const char termcap_cons25r[]; extern const char termcap_cons25r_m[]; extern const char termcap_cons25l1[]; extern const char termcap_cons25l1_m[]; -extern const u_char font_iso_8x14[]; -extern const u_char font_cp850_8x14[]; -extern const u_char font_koi8_r_8x14[]; -extern const u_char koi8_r2cp866[]; +extern const u_char font_iso_8x16[]; +extern const u_char font_cp850_8x16[]; +extern const u_char font_koi8_r_8x16[]; /* media.c */ extern int mediaSetCDROM(char *str); diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c index 713092f75d27..23dffe9186f2 100644 --- a/release/sysinstall/system.c +++ b/release/sysinstall/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.13 1995/05/18 02:42:33 jkh Exp $ + * $Id: system.c,v 1.14 1995/05/18 09:02:02 jkh Exp $ * * Jordan Hubbard * @@ -221,7 +221,7 @@ void systemChangeFont(const u_char font[]) { if (OnVTY) { - if (ioctl(0, PIO_FONT8x14, font) < 0) + if (ioctl(0, PIO_FONT8x16, font) < 0) msgConfirm("Sorry! Unable to load font for %s", getenv("LANG")); } } @@ -236,30 +236,26 @@ void systemChangeTerminal(char *color, const u_char c_term[], char *mono, const u_char m_term[]) { - if (!OnSerial) { + if (OnVTY) { if (ColorDisplay) { setenv("TERM", color, 1); setenv("TERMCAP", c_term, 1); - /* setterm(color); */ + reset_shell_mode(); + setterm(color); + init_acs(); + cbreak(); noecho(); } else { setenv("TERM", mono, 1); setenv("TERMCAP", m_term, 1); - /* setterm(mono); */ + reset_shell_mode(); + setterm(mono); + init_acs(); + cbreak(); noecho(); } } } -void -systemChangeScreenmap(const u_char newmap[]) -{ - if (OnVTY) { - if (ioctl(0, PIO_SCRNMAP, newmap) < 0) - msgConfirm("Sorry! Unable to load the screenmap for %s", - getenv("LANG")); - } -} - /* Execute a system command, with varargs */ int vsystem(char *fmt, ...) diff --git a/release/sysinstall/termcap.c b/release/sysinstall/termcap.c index 86e758a208ee..2cd8158754b6 100644 --- a/release/sysinstall/termcap.c +++ b/release/sysinstall/termcap.c @@ -26,35 +26,44 @@ int set_termcap(void) { char *term; + int stat; OnVTY = OnSerial = FALSE; + if (getpid() != 1) + DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); term = getenv("TERM"); - if (term == NULL) { - if (ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay) < 0) { + stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); + if (stat < 0) { + if (!term) { if (setenv("TERM", "vt100", 1) < 0) return -1; if (setenv("TERMCAP", termcap_vt100, 1) < 0) return -1; - DebugFD = dup(1); - OnSerial = TRUE; - } else if (ColorDisplay) { - if (setenv("TERM", "cons25", 1) < 0) - return -1; - if (setenv("TERMCAP", termcap_cons25, 1) < 0) - return -1; - DebugFD = open("/dev/ttyv1", O_WRONLY); - OnVTY = TRUE; - } else { - if (setenv("TERM", "cons25-m", 1) < 0) - return -1; - if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) - return -1; - DebugFD = open("/dev/ttyv1", O_WRONLY); - OnVTY = TRUE; } + if (DebugFD == -1) + DebugFD = dup(1); + OnSerial = TRUE; } else { - DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); + if (ColorDisplay) { + if (!term) { + if (setenv("TERM", "cons25", 1) < 0) + return -1; + if (setenv("TERMCAP", termcap_cons25, 1) < 0) + return -1; + } + } + else { + if (!term) { + if (setenv("TERM", "cons25-m", 1) < 0) + return -1; + if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) + return -1; + } + } + if (DebugFD == -1) + DebugFD = open("/dev/ttyv1", O_WRONLY); + OnVTY = TRUE; } return 0; } diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile index 949b57dca716..0fb300a0d735 100644 --- a/usr.sbin/sade/Makefile +++ b/usr.sbin/sade/Makefile @@ -62,17 +62,14 @@ makedevs.c: dev2c.sh Makefile rtermcap ./rtermcap vt100 | \ file2c 'const char termcap_vt100[] = {' ',0};' \ >> makedevs.tmp - file2c 'const u_char font_iso_8x14[] = {' '};' \ - < ${.CURDIR}/../../share/syscons/fonts/iso-8x14.fnt \ + cat ${.CURDIR}/../../share/syscons/fonts/iso-8x16.fnt | \ + uudecode | file2c 'const u_char font_iso_8x16[] = {' '};' \ >> makedevs.tmp - file2c 'const u_char font_cp850_8x14[] = {' '};' \ - < ${.CURDIR}/../../share/syscons/fonts/cp850-8x14.fnt \ + cat ${.CURDIR}/../../share/syscons/fonts/cp850-8x16.fnt | \ + uudecode | file2c 'const u_char font_cp850_8x16[] = {' '};' \ >> makedevs.tmp - file2c 'const u_char font_koi8_r_8x14[] = {' '};' \ - < ${.CURDIR}/../../share/syscons/fonts/koi8-r-8x14.fnt \ - >> makedevs.tmp - file2c 'const u_char koi8_r2cp866[] = {' '};' \ - < ${.CURDIR}/../../share/syscons/scrnmaps/koi8-r2cp866 \ + cat ${.CURDIR}/../../share/syscons/fonts/koi8-r-8x16.fnt | \ + uudecode | file2c 'const u_char font_koi8_r_8x16[] = {' '};' \ >> makedevs.tmp mv makedevs.tmp makedevs.c diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index e3f00f059a78..b8452c2de135 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.17 1995/05/16 11:37:25 jkh Exp $ + * $Id: sysinstall.h,v 1.18 1995/05/17 14:39:56 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -279,10 +279,9 @@ extern const char termcap_cons25r[]; extern const char termcap_cons25r_m[]; extern const char termcap_cons25l1[]; extern const char termcap_cons25l1_m[]; -extern const u_char font_iso_8x14[]; -extern const u_char font_cp850_8x14[]; -extern const u_char font_koi8_r_8x14[]; -extern const u_char koi8_r2cp866[]; +extern const u_char font_iso_8x16[]; +extern const u_char font_cp850_8x16[]; +extern const u_char font_koi8_r_8x16[]; /* media.c */ extern int mediaSetCDROM(char *str); diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index 713092f75d27..23dffe9186f2 100644 --- a/usr.sbin/sade/system.c +++ b/usr.sbin/sade/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.13 1995/05/18 02:42:33 jkh Exp $ + * $Id: system.c,v 1.14 1995/05/18 09:02:02 jkh Exp $ * * Jordan Hubbard * @@ -221,7 +221,7 @@ void systemChangeFont(const u_char font[]) { if (OnVTY) { - if (ioctl(0, PIO_FONT8x14, font) < 0) + if (ioctl(0, PIO_FONT8x16, font) < 0) msgConfirm("Sorry! Unable to load font for %s", getenv("LANG")); } } @@ -236,30 +236,26 @@ void systemChangeTerminal(char *color, const u_char c_term[], char *mono, const u_char m_term[]) { - if (!OnSerial) { + if (OnVTY) { if (ColorDisplay) { setenv("TERM", color, 1); setenv("TERMCAP", c_term, 1); - /* setterm(color); */ + reset_shell_mode(); + setterm(color); + init_acs(); + cbreak(); noecho(); } else { setenv("TERM", mono, 1); setenv("TERMCAP", m_term, 1); - /* setterm(mono); */ + reset_shell_mode(); + setterm(mono); + init_acs(); + cbreak(); noecho(); } } } -void -systemChangeScreenmap(const u_char newmap[]) -{ - if (OnVTY) { - if (ioctl(0, PIO_SCRNMAP, newmap) < 0) - msgConfirm("Sorry! Unable to load the screenmap for %s", - getenv("LANG")); - } -} - /* Execute a system command, with varargs */ int vsystem(char *fmt, ...) diff --git a/usr.sbin/sade/termcap.c b/usr.sbin/sade/termcap.c index 86e758a208ee..2cd8158754b6 100644 --- a/usr.sbin/sade/termcap.c +++ b/usr.sbin/sade/termcap.c @@ -26,35 +26,44 @@ int set_termcap(void) { char *term; + int stat; OnVTY = OnSerial = FALSE; + if (getpid() != 1) + DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); term = getenv("TERM"); - if (term == NULL) { - if (ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay) < 0) { + stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); + if (stat < 0) { + if (!term) { if (setenv("TERM", "vt100", 1) < 0) return -1; if (setenv("TERMCAP", termcap_vt100, 1) < 0) return -1; - DebugFD = dup(1); - OnSerial = TRUE; - } else if (ColorDisplay) { - if (setenv("TERM", "cons25", 1) < 0) - return -1; - if (setenv("TERMCAP", termcap_cons25, 1) < 0) - return -1; - DebugFD = open("/dev/ttyv1", O_WRONLY); - OnVTY = TRUE; - } else { - if (setenv("TERM", "cons25-m", 1) < 0) - return -1; - if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) - return -1; - DebugFD = open("/dev/ttyv1", O_WRONLY); - OnVTY = TRUE; } + if (DebugFD == -1) + DebugFD = dup(1); + OnSerial = TRUE; } else { - DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); + if (ColorDisplay) { + if (!term) { + if (setenv("TERM", "cons25", 1) < 0) + return -1; + if (setenv("TERMCAP", termcap_cons25, 1) < 0) + return -1; + } + } + else { + if (!term) { + if (setenv("TERM", "cons25-m", 1) < 0) + return -1; + if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) + return -1; + } + } + if (DebugFD == -1) + DebugFD = open("/dev/ttyv1", O_WRONLY); + OnVTY = TRUE; } return 0; } diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile index 949b57dca716..0fb300a0d735 100644 --- a/usr.sbin/sysinstall/Makefile +++ b/usr.sbin/sysinstall/Makefile @@ -62,17 +62,14 @@ makedevs.c: dev2c.sh Makefile rtermcap ./rtermcap vt100 | \ file2c 'const char termcap_vt100[] = {' ',0};' \ >> makedevs.tmp - file2c 'const u_char font_iso_8x14[] = {' '};' \ - < ${.CURDIR}/../../share/syscons/fonts/iso-8x14.fnt \ + cat ${.CURDIR}/../../share/syscons/fonts/iso-8x16.fnt | \ + uudecode | file2c 'const u_char font_iso_8x16[] = {' '};' \ >> makedevs.tmp - file2c 'const u_char font_cp850_8x14[] = {' '};' \ - < ${.CURDIR}/../../share/syscons/fonts/cp850-8x14.fnt \ + cat ${.CURDIR}/../../share/syscons/fonts/cp850-8x16.fnt | \ + uudecode | file2c 'const u_char font_cp850_8x16[] = {' '};' \ >> makedevs.tmp - file2c 'const u_char font_koi8_r_8x14[] = {' '};' \ - < ${.CURDIR}/../../share/syscons/fonts/koi8-r-8x14.fnt \ - >> makedevs.tmp - file2c 'const u_char koi8_r2cp866[] = {' '};' \ - < ${.CURDIR}/../../share/syscons/scrnmaps/koi8-r2cp866 \ + cat ${.CURDIR}/../../share/syscons/fonts/koi8-r-8x16.fnt | \ + uudecode | file2c 'const u_char font_koi8_r_8x16[] = {' '};' \ >> makedevs.tmp mv makedevs.tmp makedevs.c diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index e3f00f059a78..b8452c2de135 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.17 1995/05/16 11:37:25 jkh Exp $ + * $Id: sysinstall.h,v 1.18 1995/05/17 14:39:56 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -279,10 +279,9 @@ extern const char termcap_cons25r[]; extern const char termcap_cons25r_m[]; extern const char termcap_cons25l1[]; extern const char termcap_cons25l1_m[]; -extern const u_char font_iso_8x14[]; -extern const u_char font_cp850_8x14[]; -extern const u_char font_koi8_r_8x14[]; -extern const u_char koi8_r2cp866[]; +extern const u_char font_iso_8x16[]; +extern const u_char font_cp850_8x16[]; +extern const u_char font_koi8_r_8x16[]; /* media.c */ extern int mediaSetCDROM(char *str); diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c index 713092f75d27..23dffe9186f2 100644 --- a/usr.sbin/sysinstall/system.c +++ b/usr.sbin/sysinstall/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.13 1995/05/18 02:42:33 jkh Exp $ + * $Id: system.c,v 1.14 1995/05/18 09:02:02 jkh Exp $ * * Jordan Hubbard * @@ -221,7 +221,7 @@ void systemChangeFont(const u_char font[]) { if (OnVTY) { - if (ioctl(0, PIO_FONT8x14, font) < 0) + if (ioctl(0, PIO_FONT8x16, font) < 0) msgConfirm("Sorry! Unable to load font for %s", getenv("LANG")); } } @@ -236,30 +236,26 @@ void systemChangeTerminal(char *color, const u_char c_term[], char *mono, const u_char m_term[]) { - if (!OnSerial) { + if (OnVTY) { if (ColorDisplay) { setenv("TERM", color, 1); setenv("TERMCAP", c_term, 1); - /* setterm(color); */ + reset_shell_mode(); + setterm(color); + init_acs(); + cbreak(); noecho(); } else { setenv("TERM", mono, 1); setenv("TERMCAP", m_term, 1); - /* setterm(mono); */ + reset_shell_mode(); + setterm(mono); + init_acs(); + cbreak(); noecho(); } } } -void -systemChangeScreenmap(const u_char newmap[]) -{ - if (OnVTY) { - if (ioctl(0, PIO_SCRNMAP, newmap) < 0) - msgConfirm("Sorry! Unable to load the screenmap for %s", - getenv("LANG")); - } -} - /* Execute a system command, with varargs */ int vsystem(char *fmt, ...) diff --git a/usr.sbin/sysinstall/termcap.c b/usr.sbin/sysinstall/termcap.c index 86e758a208ee..2cd8158754b6 100644 --- a/usr.sbin/sysinstall/termcap.c +++ b/usr.sbin/sysinstall/termcap.c @@ -26,35 +26,44 @@ int set_termcap(void) { char *term; + int stat; OnVTY = OnSerial = FALSE; + if (getpid() != 1) + DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); term = getenv("TERM"); - if (term == NULL) { - if (ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay) < 0) { + stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); + if (stat < 0) { + if (!term) { if (setenv("TERM", "vt100", 1) < 0) return -1; if (setenv("TERMCAP", termcap_vt100, 1) < 0) return -1; - DebugFD = dup(1); - OnSerial = TRUE; - } else if (ColorDisplay) { - if (setenv("TERM", "cons25", 1) < 0) - return -1; - if (setenv("TERMCAP", termcap_cons25, 1) < 0) - return -1; - DebugFD = open("/dev/ttyv1", O_WRONLY); - OnVTY = TRUE; - } else { - if (setenv("TERM", "cons25-m", 1) < 0) - return -1; - if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) - return -1; - DebugFD = open("/dev/ttyv1", O_WRONLY); - OnVTY = TRUE; } + if (DebugFD == -1) + DebugFD = dup(1); + OnSerial = TRUE; } else { - DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); + if (ColorDisplay) { + if (!term) { + if (setenv("TERM", "cons25", 1) < 0) + return -1; + if (setenv("TERMCAP", termcap_cons25, 1) < 0) + return -1; + } + } + else { + if (!term) { + if (setenv("TERM", "cons25-m", 1) < 0) + return -1; + if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) + return -1; + } + } + if (DebugFD == -1) + DebugFD = open("/dev/ttyv1", O_WRONLY); + OnVTY = TRUE; } return 0; }