+#if USE_KLIBC_KBD
+ for (saved_set = set;; set = saved_set) {
+ if ((mode & TW_INPUT)
+ && (sp->_extended_key
+ || (KbdPeek(&ki, 0) == 0
+ && (ki.fbStatus & KBDTRF_FINAL_CHAR_IN)))) {
+ FD_ZERO(&set);
+ FD_SET(sp->_ifd, &set);
+ result = 1;
+ break;
+ }
+
+ tv.tv_sec = 0;
+ tv.tv_usec = (milliseconds == 0) ? 0 : (10 * 1000);
+
+ if ((result = select(count, &set, NULL, NULL, &tv)) != 0)
+ break;
+
+ /* Time out ? */
+ if (milliseconds >= 0 && _nc_gettime(&t0, FALSE) >= milliseconds) {
+ result = 0;
+ break;
+ }
+ }
+#else