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;
}
- 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();
+ i9ep->key_sequence_length = 0;
+ } else
+ rl_callback_read_char();
ret = 0;
}
if (!i9ep->stdout_btrn)