diff options
author | pst <pst@FreeBSD.org> | 1996-09-26 21:07:11 +0000 |
---|---|---|
committer | pst <pst@FreeBSD.org> | 1996-09-26 21:07:11 +0000 |
commit | 1093963d9f5e559f8ac75340a2626c28a7ecd001 (patch) | |
tree | 148d468cb6aed490402c77706c933a587ee203d2 /usr.sbin | |
parent | a090bd867f45cb07a630cf4a15e1925e4dd202f4 (diff) | |
download | FreeBSD-src-1093963d9f5e559f8ac75340a2626c28a7ecd001.zip FreeBSD-src-1093963d9f5e559f8ac75340a2626c28a7ecd001.tar.gz |
If we're unable to open /dev/ttyv0, assume that we're on a single tty system
and use /dev/console.
I really think the proper test is to determine which device has been configured
to be the console (remember the RB_SERIAL flag?) and use it instead of always
trying to open /dev/ttyv0 first.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sade/system.c | 8 | ||||
-rw-r--r-- | usr.sbin/sade/termcap.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/system.c | 8 | ||||
-rw-r--r-- | usr.sbin/sysinstall/termcap.c | 4 |
4 files changed, 14 insertions, 10 deletions
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index ad89994..80162f1 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.62 1996/07/10 11:38:29 jkh Exp $ + * $Id: system.c,v 1.63 1996/08/01 10:58:54 jkh Exp $ * * Jordan Hubbard * @@ -65,7 +65,11 @@ systemInitialize(int argc, char **argv) /* Are we running as init? */ if (getpid() == 1) { setsid(); - close(0); open("/dev/ttyv0", O_RDWR); + close(0); + if (open("/dev/ttyv0", O_RDWR) < 0) + open("/dev/console", O_RDWR); + else + OnVTY = TRUE; close(1); dup(0); close(2); dup(0); printf("%s running as init\n", argv[0]); diff --git a/usr.sbin/sade/termcap.c b/usr.sbin/sade/termcap.c index 06aca6c..5771e5f 100644 --- a/usr.sbin/sade/termcap.c +++ b/usr.sbin/sade/termcap.c @@ -33,7 +33,6 @@ set_termcap(void) int stat; struct ttysize ts; - OnVTY = FALSE; term = getenv("TERM"); stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); @@ -43,7 +42,7 @@ set_termcap(void) DebugFD = open("/dev/null", O_RDWR, 0); } - if (stat < 0) { + if (!OnVTY || (stat < 0)) { if (!term) { if (setenv("TERM", "vt100", 1) < 0) return -1; @@ -78,7 +77,6 @@ set_termcap(void) return -1; } } - OnVTY = TRUE; } if (ioctl(0, TIOCGSIZE, &ts) == -1) { msgDebug("Unable to get terminal size - errno %d\n", errno); diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c index ad89994..80162f1 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.62 1996/07/10 11:38:29 jkh Exp $ + * $Id: system.c,v 1.63 1996/08/01 10:58:54 jkh Exp $ * * Jordan Hubbard * @@ -65,7 +65,11 @@ systemInitialize(int argc, char **argv) /* Are we running as init? */ if (getpid() == 1) { setsid(); - close(0); open("/dev/ttyv0", O_RDWR); + close(0); + if (open("/dev/ttyv0", O_RDWR) < 0) + open("/dev/console", O_RDWR); + else + OnVTY = TRUE; close(1); dup(0); close(2); dup(0); printf("%s running as init\n", argv[0]); diff --git a/usr.sbin/sysinstall/termcap.c b/usr.sbin/sysinstall/termcap.c index 06aca6c..5771e5f 100644 --- a/usr.sbin/sysinstall/termcap.c +++ b/usr.sbin/sysinstall/termcap.c @@ -33,7 +33,6 @@ set_termcap(void) int stat; struct ttysize ts; - OnVTY = FALSE; term = getenv("TERM"); stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); @@ -43,7 +42,7 @@ set_termcap(void) DebugFD = open("/dev/null", O_RDWR, 0); } - if (stat < 0) { + if (!OnVTY || (stat < 0)) { if (!term) { if (setenv("TERM", "vt100", 1) < 0) return -1; @@ -78,7 +77,6 @@ set_termcap(void) return -1; } } - OnVTY = TRUE; } if (ioctl(0, TIOCGSIZE, &ts) == -1) { msgDebug("Unable to get terminal size - errno %d\n", errno); |