add fpurge

Eric Blake
Sun Jun 28 11:51:00 GMT 2009

Hash: SHA1

Bash would like to use fpurge, as part of making file redirections to
builtin operators work correctly.  It is not (yet) standardized, but does
provide some useful semantics.  BSD has fpurge in <stdio.h>, Linux has
__fpurge (same behavior, but no return value) in <stdio_ext.h>.

OK to commit?  I wrote this implementation from scratch using fflush.c as
a reference, then tested it in cygwin, and verified that it passes the
gnulib unit test for fpurge (some BSD implementations fail the gnulib unit
test, because they leave read-write FILEs in an inconsistent state,
otherwise I might have just copied a BSD version).

I'm not sure why my rebuilt diff is larger than I expected; I
used autoconf 2.59 and automake 1.9.6 as directed in README.

2009-06-27  Eric Blake  <>

	Add fpurge.
	* stdio/fpurge.c (fpurge, _fpurge_r): New file.
	* libc/stdio/ (ELIX_4_SOURCES, CHEWOUT_FILES, fpurge):
	Build it.
	* libc/stdio/ Regenerated.
	* libc/include/stdio.h (fpurge, _fpurge_r): New declarations.

- --
Don't work too hard, make some time for fun as well!

Eric Blake   
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: newlib.patch35
URL: <>

More information about the Newlib mailing list