diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2010-07-29 01:32:23 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2010-07-29 01:32:23 +0000 |
commit | 01b9977477971a04c95488e489999bc3d4b43bb3 (patch) | |
tree | ed3790f513f08394de93694eb89a85e8e02d5c8c /libgfortran/io/unix.h | |
parent | fb1341901a435aa26ef846612f9dc98c45d8403f (diff) | |
download | gcc-01b9977477971a04c95488e489999bc3d4b43bb3.zip gcc-01b9977477971a04c95488e489999bc3d4b43bb3.tar.gz gcc-01b9977477971a04c95488e489999bc3d4b43bb3.tar.bz2 |
re PR fortran/44931 (For INPUT_UNIT, INQUIRE NAME= should not return "stdin")
2010-07-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/44931
* io/inquire.c (inquire_via_unit): Use ttyname to return actual device
file name for stdin, stdout, and stderr. If ttyname does not succeed
fall back to default names for these units. Include string.h to allow
using strlen function.
* unix.c: Remove typedef of unix_stream structure, move to unix.h.
* unix.h: Add typedef of unix_stream structure so that it is
accessible to inquire.c.
From-SVN: r162667
Diffstat (limited to 'libgfortran/io/unix.h')
-rw-r--r-- | libgfortran/io/unix.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libgfortran/io/unix.h b/libgfortran/io/unix.h index 3229d50..dc433d7 100644 --- a/libgfortran/io/unix.h +++ b/libgfortran/io/unix.h @@ -41,6 +41,29 @@ struct stream int (*close) (struct stream *); }; + +typedef struct +{ + stream st; + + gfc_offset buffer_offset; /* File offset of the start of the buffer */ + gfc_offset physical_offset; /* Current physical file offset */ + gfc_offset logical_offset; /* Current logical file offset */ + gfc_offset file_length; /* Length of the file, -1 if not seekable. */ + + char *buffer; /* Pointer to the buffer. */ + int fd; /* The POSIX file descriptor. */ + + int active; /* Length of valid bytes in the buffer */ + + int prot; + int ndirty; /* Dirty bytes starting at buffer_offset */ + + int special_file; /* =1 if the fd refers to a special file */ +} +unix_stream; + + /* Inline functions for doing file I/O given a stream. */ static inline ssize_t sread (stream * s, void * buf, ssize_t nbyte) |