diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-07-01 20:02:23 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-07-01 20:02:23 +0000 |
commit | a80175b1de6ab26b635d22c099a4b8176dacaf14 (patch) | |
tree | ae0980f83635891d7c37177bb9eecfbbd58840d3 /sys | |
parent | bc534aaaae5b3698ae46dd11f81345af9e6f145c (diff) |
smooth char waiting loop
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/stand/boot/cmd.c | 13 | ||||
-rw-r--r-- | sys/stand/boot/cmd.c | 13 |
2 files changed, 10 insertions, 16 deletions
diff --git a/sys/arch/i386/stand/boot/cmd.c b/sys/arch/i386/stand/boot/cmd.c index 8268bbe48f1..83cab1d14bd 100644 --- a/sys/arch/i386/stand/boot/cmd.c +++ b/sys/arch/i386/stand/boot/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.17 1997/06/06 18:23:43 mickey Exp $ */ +/* $OpenBSD: cmd.c,v 1.18 1997/07/01 20:02:22 mickey Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -243,15 +243,12 @@ readline(buf, to) int to; { register char *p = buf, *pe = buf, ch; - register int i; + time_t tt; - for (i = to; i-- && !ischar(); ) -#ifndef _TEST - sleep(1); -#else + for (tt = getsecs() + to; getsecs() < tt && !ischar(); ) ; -#endif - if (i < 0) + + if (!ischar()) return 0; while (1) { diff --git a/sys/stand/boot/cmd.c b/sys/stand/boot/cmd.c index 8268bbe48f1..83cab1d14bd 100644 --- a/sys/stand/boot/cmd.c +++ b/sys/stand/boot/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.17 1997/06/06 18:23:43 mickey Exp $ */ +/* $OpenBSD: cmd.c,v 1.18 1997/07/01 20:02:22 mickey Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -243,15 +243,12 @@ readline(buf, to) int to; { register char *p = buf, *pe = buf, ch; - register int i; + time_t tt; - for (i = to; i-- && !ischar(); ) -#ifndef _TEST - sleep(1); -#else + for (tt = getsecs() + to; getsecs() < tt && !ischar(); ) ; -#endif - if (i < 0) + + if (!ischar()) return 0; while (1) { |