From 39bc18ac3290db498ba2a6e3d30637f836947340 Mon Sep 17 00:00:00 2001 From: Michael Shalayeff Date: Sat, 26 Apr 1997 17:50:09 +0000 Subject: boot.conf support ttyname function in cons.c rdonly var 'tty' to view tty settings serial console soon --- sys/lib/libsa/cons.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'sys/lib/libsa/cons.c') 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 -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; -- cgit v1.2.3