diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-04-26 17:50:09 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-04-26 17:50:09 +0000 |
commit | 39bc18ac3290db498ba2a6e3d30637f836947340 (patch) | |
tree | c51a4d1d3eb0e60ee753f74939d48dd8d35af766 /sys/lib/libsa/cons.c | |
parent | 6bdc1ce3a8ccaf3a9fec3bcb79ef0e745806e9f5 (diff) |
boot.conf support
ttyname function in cons.c
rdonly var 'tty' to view tty settings
serial console soon
Diffstat (limited to 'sys/lib/libsa/cons.c')
-rw-r--r-- | sys/lib/libsa/cons.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sys/lib/libsa/cons.c b/sys/lib/libsa/cons.c index 2e38e664f34..f0677f66149 100644 --- a/sys/lib/libsa/cons.c +++ b/sys/lib/libsa/cons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cons.c,v 1.2 1997/04/02 04:59:22 mickey Exp $ */ +/* $OpenBSD: cons.c,v 1.3 1997/04/26 17:50:08 mickey Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -34,20 +34,35 @@ #include <stand.h> -struct consw *console = &consw[0]; +static struct consw *console = &consw[0]; int cons_probe() { - int i; + int i, f = 0; for (i = 0; i < ncons; i++) { - if ((consw[i].cn_probe)() != 0) + if ((consw[i].cn_probe)() != 0) { + if (f == 0) + f++, console = &consw[i]; printf("%s present\n", consw[i].name); + } } + if (!f) /* not found */ + printf("no any console detected, "); printf("using %s console\n", console->name); return 1; } +char * +ttyname(fd) + int fd; +{ + if (fd) + return "(not a tty)"; + else + return console->name; +} + void putc(c) int c; |