Lines Matching defs:keyboard
18 /* $Id: keyboard.c,v 1.13 2007/06/19 23:47:18 tbox Exp $ */
34 #include <isc/keyboard.h>
38 isc_keyboard_open(isc_keyboard_t *keyboard) {
43 REQUIRE(keyboard != NULL);
49 keyboard->fd = fd;
51 if (tcgetattr(fd, &keyboard->saved_mode) < 0) {
56 current_mode = keyboard->saved_mode;
72 keyboard->result = ISC_R_SUCCESS;
83 isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleeptime) {
84 REQUIRE(keyboard != NULL);
86 if (sleeptime > 0 && keyboard->result != ISC_R_CANCELED)
89 (void)tcsetattr(keyboard->fd, TCSAFLUSH, &keyboard->saved_mode);
90 (void)close(keyboard->fd);
92 keyboard->fd = -1;
98 isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp) {
103 REQUIRE(keyboard != NULL);
106 cc = read(keyboard->fd, &c, 1);
108 keyboard->result = ISC_R_IOERROR;
109 return (keyboard->result);
112 controlchars = keyboard->saved_mode.c_cc;
114 keyboard->result = ISC_R_CANCELED;
115 return (keyboard->result);
124 isc_keyboard_canceled(isc_keyboard_t *keyboard) {
125 return (ISC_TF(keyboard->result == ISC_R_CANCELED));