summaryrefslogtreecommitdiff
path: root/libgfortran/io/file_pos.c
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-28 02:03:21 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-28 02:03:21 +0000
commitf4bfed80dc6b67b5cb6075f8911824bcf2d2473b (patch)
tree90a3e99020a35c7bc8694c854024d883c5c67a81 /libgfortran/io/file_pos.c
parent187386f3c3bb1259b23d25bbbc98210120eff7cc (diff)
downloadgcc-f4bfed80dc6b67b5cb6075f8911824bcf2d2473b.tar.gz
2007-04-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/31532 * io/file_pos.c (st_backspace): Set flags.position for end of file condition and use new function update_position. (st_endfile): Use new function update_position. * io/io.h: Add prototype for new function. * io/inquire.c (inquire_via_unit): If not direct access, set NEXTREC to zero. * io/unit.c (update_position): New function to update position info used by inquire. * io/transfer.c (next_record): Fix typo and use new function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124252 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io/file_pos.c')
-rw-r--r--libgfortran/io/file_pos.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
index 846dae932ec..c9034e8c8ca 100644
--- a/libgfortran/io/file_pos.c
+++ b/libgfortran/io/file_pos.c
@@ -213,13 +213,17 @@ st_backspace (st_parameter_filepos *fpp)
if (u->endfile == AFTER_ENDFILE)
{
u->endfile = AT_ENDFILE;
+ u->flags.position = POSITION_APPEND;
flush (u->s);
struncate (u->s);
}
else
{
if (file_position (u->s) == 0)
- goto done; /* Common special case */
+ {
+ u->flags.position = POSITION_REWIND;
+ goto done; /* Common special case */
+ }
if (u->mode == WRITING)
{
@@ -233,6 +237,7 @@ st_backspace (st_parameter_filepos *fpp)
else
unformatted_backspace (fpp, u);
+ update_position (u);
u->endfile = NO_ENDFILE;
u->current_record = 0;
u->bytes_left = 0;
@@ -271,6 +276,7 @@ st_endfile (st_parameter_filepos *fpp)
flush (u->s);
struncate (u->s);
u->endfile = AFTER_ENDFILE;
+ update_position (u);
unlock_unit (u);
}