diff options
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/io.h | 3 | ||||
-rw-r--r-- | libgfortran/io/transfer.c | 8 | ||||
-rw-r--r-- | libgfortran/io/unix.c | 6 |
4 files changed, 22 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index d3bf438..27531d8 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -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 diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 99c2b02..1806fb9 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -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 */ diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 2440aea..da2e615 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -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; } diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 3cefd2a..104afb2c 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -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. |