X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=interactive.c;h=041376a1057bcf2e98a4c23c2b23c42d73a68345;hb=4314f515abc204cc1696427f34aa9822d1a7150b;hp=a8197308e8323c8fe78546117cc2e9479df0fbfd;hpb=c75c35b176cdacf157d27617e954961c88f33975;p=paraslash.git diff --git a/interactive.c b/interactive.c index a8197308..041376a1 100644 --- a/interactive.c +++ b/interactive.c @@ -45,7 +45,7 @@ static struct i9e_private i9e_private, *i9ep = &i9e_private; * running. * * \return A negative return value of zero means the i9e task terminated. Only - * in this case it is safe to call ie9_close(). + * in this case it is safe to call i9e_close(). */ int i9e_get_error(void) { @@ -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) @@ -556,7 +561,7 @@ __printf_2_3 void i9e_log(int ll, const char* fmt,...) * the given text. If the length of this text exceeds the width of the * terminal, the text is shortened by leaving out a part in the middle. */ -void ie9_print_status_bar(char *buf, unsigned len) +void i9e_print_status_bar(char *buf, unsigned len) { size_t x = i9ep->num_columns, y = (x - 4) / 2;