Juergen Weber wrote in <http://lists.gnu.org/archive/html/bug-gnulib/2009-04/msg00165.html>: > I am a bit appalled of having to implement all those low-level non-portable > functions to get bash running.
I can understand this feeling... > Or what about writing an generic implementation of the cited functions, that > would be based on Posix API only? This is hardly possible. fpurge's job is to "discard all pending buffered I/O", which is related to fflush, but not the same as fflush. > Instead of having to port fpurge and friends to all platforms, couldn't bash > be based on Posix API only, even if that might be a performance-degradation? > > #if defined SLOW_POSIX_BASED_IMPLEMENTATION > ... > #else > fpurge and friends > #endif Actually, the only places where bash-4.0 calls fpurge is directly after fflush on the same stream, and only on output streams: fflush (stdout); fpurge (stdout); Does someone understand the purpose of this code? IMO fpurge is a nop, right after fflush (assuming that fflush succeeded). Bruno