Proposed fix for FS#20538
On Thu, Mar 24, 2011 at 12:18:20AM -0500, Dan McGee wrote:
> On Wed, Mar 23, 2011 at 10:41 AM, Dave Reisner <email@example.com> wrote:
> > https://bugs.archlinux.org/task/20538
> > The attached patch flushes the terminal input buffer shortly before
> > prompting users for input to answer a question. On the one hand, I can
> > see how this might be nice when you accidentally hit <enter> twice, or
> > fat finger a key during a download and press <enter> at the prompt only
> > to be oddly returned to your shell. On the other hand, I've occasionally
> > abused this exact behavior to walk away from my computer in the middle
> > of a large -Syu.
> > Thoughts? Any issues with the code approach?
> You only use it in util, mark it static and drop it from util.h.
> Is this stuff we should guard using autoconf? I think if you add it to
> AC_CHECK_HEADERS and AC_CHECK_FUNCS you'll have useful #defines usable
> from config.h.
Done, and done. I've made flush_term_input effectively a NOOP when
tcflush isn't available. Changes are in my GH repo .