input = 0;
tty = fileno (rl_instream);
- /* Move this up here to give it first shot, but it can't set chars_avail */
+ /* Move this up here to give it first shot, but it can't set chars_avail,
+ so we assume a single character is available. */
/* XXX - need rl_chars_available_hook? */
if (rl_input_available_hook)
{
result = (*rl_input_available_hook) ();
if (result == 0)
result = -1;
+ else
+ chars_avail = 1;
}
#if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
#endif
if (result <= 0)
return 0; /* Nothing to read. */
+ result = -1; /* there is something, so check how many chars below */
}
#endif