summaryrefslogtreecommitdiff
path: root/usr.bin/mg/ttyio.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-05-03 20:40:23 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-05-03 20:40:23 +0000
commitee4fabc5c39065b30e24a2d63196cb833b73278c (patch)
tree3bca64bf11633e55cf3aa679748275adf89cf955 /usr.bin/mg/ttyio.c
parent1149cf529a2c0f87f7c7eaa485d4dc579eefc0a9 (diff)
Add a delay (in miliseconds) argument to ttwait.
Diffstat (limited to 'usr.bin/mg/ttyio.c')
-rw-r--r--usr.bin/mg/ttyio.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/usr.bin/mg/ttyio.c b/usr.bin/mg/ttyio.c
index ef1977c10b4..58ad2cd05a6 100644
--- a/usr.bin/mg/ttyio.c
+++ b/usr.bin/mg/ttyio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttyio.c,v 1.13 2001/01/29 01:58:10 niklas Exp $ */
+/* $OpenBSD: ttyio.c,v 1.14 2001/05/03 20:40:22 art Exp $ */
/*
* POSIX terminal I/O.
@@ -213,13 +213,12 @@ panic(s)
exit(1);
}
-#ifndef NO_DPROMPT
/*
- * A program to return TRUE if we wait for 2 seconds without anything
- * happening, else return FALSE. Cribbed from mod.sources xmodem.
+ * This function returns FALSE if any characters have showed up on the
+ * tty before 'msec' miliseconds.
*/
int
-ttwait()
+ttwait(int msec)
{
fd_set readfds;
struct timeval tmout;
@@ -227,11 +226,10 @@ ttwait()
FD_ZERO(&readfds);
FD_SET(0, &readfds);
- tmout.tv_sec = 2;
- tmout.tv_usec = 0;
+ tmout.tv_sec = msec/1000;
+ tmout.tv_usec = msec - tmout.tv_sec * 1000;
if ((select(1, &readfds, NULL, NULL, &tmout)) == 0)
return (TRUE);
return (FALSE);
}
-#endif /* NO_DPROMPT */