io.h (flush): Add prototype.
authorJanne Blomqvist <jblomqvi@cc.hut.fi>
Sun, 16 May 2004 13:27:48 +0000 (16:27 +0300)
committerPaul Brook <pbrook@gcc.gnu.org>
Sun, 16 May 2004 13:27:48 +0000 (13:27 +0000)
* io/io.h (flush): Add prototype.
* io/transfer.c (finalize_transfer): Flush partial records.
* io/unix.c (flush): New function.

From-SVN: r81913

libgfortran/ChangeLog
libgfortran/io/io.h
libgfortran/io/transfer.c
libgfortran/io/unix.c

index d3bf438fe16a9a75ae4e35342fae0e16987fd735..27531d84d72002130cf4e501344cc15efbf053b3 100644 (file)
@@ -1,3 +1,9 @@
+2004-05-16  Janne Blomqvist  <jblomqvi@cc.hut.fi>
+
+       * io/io.h (flush): Add prototype.
+       * io/transfer.c (finalize_transfer): Flush partial records.
+       * io/unix.c (flush): New function.
+
 2004-05-15  Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/15234
index 99c2b0241ae52815439eae00c96326b9dfb86faf..1806fb9b870e62d89745fd866f9ab700e80f024e 100644 (file)
@@ -456,6 +456,9 @@ int is_seekable (stream *);
 #define empty_internal_buffer prefix(empty_internal_buffer)
 void empty_internal_buffer(stream *);
 
+#define flush prefix(flush)
+try flush (stream *);
+
 
 /* unit.c */
 
index 2440aea6cf866ba7de0b27275029c0cd5adbc1a3..da2e6150b09a161132f7b4fc5d4aace1ee16327a 100644 (file)
@@ -1338,7 +1338,13 @@ finalize_transfer (void)
       free_fnodes ();
 
       if (advance_status == ADVANCE_NO)
-       return;
+       {
+         /* Most systems buffer lines, so force the partial record
+            to be written out.  */
+         flush (current_unit->s);
+         return;
+       }
+
       next_record (1);
       current_unit->current_record = 0;
     }
index 3cefd2ab5e542b3a3724d4c9221b10e25a9ed50d..104afb2c99f90c1a064558f41ed8e51dafbf2c29 100644 (file)
@@ -1394,6 +1394,12 @@ is_seekable (stream * s)
   return ((unix_stream *) s)->mmaped;
 }
 
+try
+flush (stream *s)
+{
+  return fd_flush( (unix_stream *) s);
+}
+
 
 /* How files are stored:  This is an operating-system specific issue,
    and therefore belongs here.  There are three cases to consider.