summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'input.c')
-rw-r--r--input.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/input.c b/input.c
index c34dabf..9a69e13 100644
--- a/input.c
+++ b/input.c
@@ -349,8 +349,7 @@ _rl_input_available (void)
FD_ZERO (&exceptfds);
FD_SET (tty, &readfds);
FD_SET (tty, &exceptfds);
- timeout.tv_sec = 0;
- timeout.tv_usec = _keyboard_input_timeout;
+ USEC_TO_TIMEVAL (_keyboard_input_timeout, timeout);
return (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) > 0);
#else
@@ -370,6 +369,24 @@ _rl_input_available (void)
}
int
+_rl_nchars_available ()
+{
+ int chars_avail, fd, result;
+
+ chars_avail = 0;
+
+#if defined (FIONREAD)
+ fd = fileno (rl_instream);
+ errno = 0;
+ result = ioctl (fd, FIONREAD, &chars_avail);
+ if (result == -1 && errno == EIO)
+ return -1;
+#endif
+
+ return chars_avail;
+}
+
+int
_rl_input_queued (int t)
{
int old_timeout, r;