]> pd.if.org Git - pdclib/blobdiff - functions/stdio/fflush.c
Comment cleanups.
[pdclib] / functions / stdio / fflush.c
index 5118503c530e413232e79dc8ece526356597ccf0..67dba7c8f2f6cb84bfe2c903fa33b5fe168624d1 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /* fflush( FILE * )
 
    This file is part of the Public Domain C Library (PDCLib).
@@ -22,9 +20,12 @@ int fflush( struct _PDCLIB_file_t * stream )
         int rc = 0;
         while ( stream != NULL )
         {
-            if ( stream->bufidx > stream->bufend )
+            if ( stream->status & _PDCLIB_FWRITE )
             {
-                rc |= _PDCLIB_fflush( stream );
+                if ( _PDCLIB_flushbuffer( stream ) == EOF )
+                {
+                    rc = EOF;
+                }
             }
             stream = stream->next;
         }
@@ -32,7 +33,7 @@ int fflush( struct _PDCLIB_file_t * stream )
     }
     else
     {
-        return _PDCLIB_fflush( stream );
+        return _PDCLIB_flushbuffer( stream );
     }
 }
                 
@@ -43,7 +44,7 @@ int fflush( struct _PDCLIB_file_t * stream )
 
 int main( void )
 {
-    TESTCASE( NO_TESTDRIVER );
+    /* Testing covered by ftell.c */
     return TEST_RESULTS;
 }