]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - interactive.c
interactive: Avoid select(2) in input_available().
[paraslash.git] / interactive.c
index 8e61484009cb73b5842485d9168c48aaea9e0002..3af90a6814d79e248178a3e47ae04cd066a8efad 100644 (file)
@@ -258,17 +258,6 @@ static void clear_bottom_line(void)
        rl_point = point;
 }
 
-static bool input_available(void)
-{
-       fd_set rfds;
-       int ret;
-
-       FD_ZERO(&rfds);
-       FD_SET(i9ep->ici->fds[0], &rfds);
-       ret = para_select(1, &rfds, NULL, 0);
-       return ret > 0;
-}
-
 static void i9e_line_handler(char *line)
 {
        int ret;
@@ -309,7 +298,7 @@ static int i9e_post_select(__a_unused struct sched *s, __a_unused void *context)
        ret = 0;
        if (i9ep->caught_sigint)
                goto rm_btrn;
-       while (input_available()) {
+       while (read_ok(i9ep->ici->fds[0]) > 0) {
                if (i9ep->stdout_btrn) {
                        while (i9ep->key_sequence_length < sizeof(i9ep->key_sequence) - 1) {
                                buf = i9ep->key_sequence + i9ep->key_sequence_length;
@@ -326,7 +315,7 @@ static int i9e_post_select(__a_unused struct sched *s, __a_unused void *context)
                                i9ep->key_sequence_length++;
                                rl_stuff_char((int)(unsigned char)*buf);
                                rl_callback_read_char();
-                               if (!input_available())
+                               if (read_ok(i9ep->ici->fds[0]) <= 0)
                                        break;
                        }
                        i9ep->key_sequence_length = 0;