5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
12 #include <_PDCLIB_glue.h>
14 extern struct _PDCLIB_file_t * _PDCLIB_filelist;
16 int fflush_unlocked( struct _PDCLIB_file_t * stream )
20 stream = _PDCLIB_filelist;
21 /* TODO: Check what happens when fflush( NULL ) encounters write errors, in other libs */
23 while ( stream != NULL )
25 if ( stream->status & _PDCLIB_FWRITE )
27 if ( _PDCLIB_flushbuffer( stream ) == EOF )
32 stream = stream->next;
38 return _PDCLIB_flushbuffer( stream );
42 int fflush( struct _PDCLIB_file_t * stream )
45 int res = fflush_unlocked(stream);
46 funlockfile( stream );
53 #include <_PDCLIB_test.h>
57 /* Testing covered by ftell.c */