X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;ds=sidebyside;f=interactive.c;h=c34a0f6eb3c5ff3fd6fcb0e85546a180d21fd880;hb=refs%2Fheads%2Fmaint;hp=a8197308e8323c8fe78546117cc2e9479df0fbfd;hpb=fb3fd5b4ddaf52e19303126ea1bacacc5954d808;p=paraslash.git diff --git a/interactive.c b/interactive.c index a8197308..9f4dec17 100644 --- a/interactive.c +++ b/interactive.c @@ -312,22 +312,27 @@ static int i9e_post_select(__a_unused struct sched *s, __a_unused void *context) goto rm_btrn; while (input_available()) { if (i9ep->stdout_btrn) { - unsigned len = i9ep->key_sequence_length; - assert(len < sizeof(i9ep->key_sequence) - 1); - buf = i9ep->key_sequence + len; - ret = read(i9ep->ici->fds[0], buf, 1); - if (ret < 0) { - ret = -ERRNO_TO_PARA_ERROR(errno); - goto rm_btrn; + while (i9ep->key_sequence_length < sizeof(i9ep->key_sequence) - 1) { + buf = i9ep->key_sequence + i9ep->key_sequence_length; + ret = read(i9ep->ici->fds[0], buf, 1); + if (ret < 0) { + ret = -ERRNO_TO_PARA_ERROR(errno); + goto rm_btrn; + } + if (ret == 0) { + ret = -E_I9E_EOF; + goto rm_btrn; + } + buf[1] = '\0'; + i9ep->key_sequence_length++; + rl_stuff_char((int)(unsigned char)*buf); + rl_callback_read_char(); + if (!input_available()) + break; } - ret = -E_I9E_EOF; - if (ret == 0) - goto rm_btrn; - buf[1] = '\0'; - i9ep->key_sequence_length++; - rl_stuff_char((int)(unsigned char)*buf); - } - rl_callback_read_char(); + i9ep->key_sequence_length = 0; + } else + rl_callback_read_char(); ret = 0; } if (!i9ep->stdout_btrn)