On 2 Apr 2007, at 17:24, Paul Eggert wrote:
"Gary V. Vaughan" <[EMAIL PROTECTED]> writes:At worst we need an autoconf test to see whether fflush works on stdin,but maybe all that is needed is to call fpurge when present, and fallback to fflush otherwise?For what it's worth, on Solaris it's called __fpurge and is declared in <stdio_ext.h> (along with __fpending and friends). The documentation says it "discards any pending buffered I/O on the stream." It returns void.
__fpurge appears to be supported on Linux too: http://www.die.net/doc/linux/man/man3/fpurge.3.html On Mac OS there doesn't seem to be any evidence of an __fpurge function: ] man __fpurge No manual entry for __fpurge ] find /usr/include -name '*.h' -exec fgrep -l __fpurge {} \; ] uname -aDarwin Garys-MacBook.local 8.9.1 Darwin Kernel Version 8.9.1: Thu Feb 22 20:55:00 PST 2007; root:xnu-792.18.15~1/RELEASE_I386 i386 i386
Even on Linux, the fflush man page doesn't mention input streams: http://www.die.net/doc/linux/man/man3/fflush.3.html So it seems that using fflush(stdin) is probably the wrong thing to do altogether for a portable application. Cheers, Gary -- ())_. Email me: [EMAIL PROTECTED] ( '/ Read my blog: http://blog.azazil.net / )= ...and my book: http://sources.redhat.com/autobook `(_~)_ Join my AGLOCO Network: http://www.agloco.com/r/BBBS7912
PGP.sig
Description: This is a digitally signed message part