2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 15:45:25 +00:00

add an argument to indicate how long to wait before draining the keyboard's input queue. This keeps people from overrunning input into the shell, etc.

This commit is contained in:
Michael Graff
2000-06-22 00:25:33 +00:00
parent 2834197ede
commit 9f95b0199c
2 changed files with 6 additions and 3 deletions

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: keyboard.h,v 1.1 2000/06/21 01:45:21 explorer Exp $ */ /* $Id: keyboard.h,v 1.2 2000/06/22 00:25:33 explorer Exp $ */
#ifndef ISC_KEYBOARD_H #ifndef ISC_KEYBOARD_H
#define ISC_KEYBOARD_H 1 #define ISC_KEYBOARD_H 1
@@ -36,7 +36,7 @@ isc_result_t
isc_keyboard_open(isc_keyboard_t *keyboard); isc_keyboard_open(isc_keyboard_t *keyboard);
isc_result_t isc_result_t
isc_keyboard_close(isc_keyboard_t *keyboard); isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleepseconds);
isc_result_t isc_result_t
isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp); isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp);

View File

@@ -70,9 +70,12 @@ isc_keyboard_open(isc_keyboard_t *keyboard) {
} }
isc_result_t isc_result_t
isc_keyboard_close(isc_keyboard_t *keyboard) { isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleeptime) {
REQUIRE(keyboard != NULL); REQUIRE(keyboard != NULL);
if (sleeptime > 0)
(void)sleep(sleeptime);
(void)tcsetattr(keyboard->fd, TCSAFLUSH, &keyboard->saved_mode); (void)tcsetattr(keyboard->fd, TCSAFLUSH, &keyboard->saved_mode);
close(keyboard->fd); close(keyboard->fd);