diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2005-09-11 15:34:57 +0200 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2005-09-11 13:34:57 +0000 |
commit | b65b81f93559efccba6253afefbe639526fe9d8c (patch) | |
tree | 35236cb14e10c63da0654a19ffe321f96fc4ba9c /libgfortran/io/unix.c | |
parent | e182017e46105b6dc5d9a1f399a03eaf26d30016 (diff) | |
download | gcc-b65b81f93559efccba6253afefbe639526fe9d8c.zip gcc-b65b81f93559efccba6253afefbe639526fe9d8c.tar.gz gcc-b65b81f93559efccba6253afefbe639526fe9d8c.tar.bz2 |
re PR libfortran/20179 (cannot mix C and Fortran I/O)
PR libfortran/20179
* io/unix.c (is_preconnected): Add function to test if a stream
corresponds to a preconnected unit.
* io/io.h: Add prototype for is_preconnected.
* io/transfer.c (data_transfer_init): Do not truncate
preconnected units.
From-SVN: r104141
Diffstat (limited to 'libgfortran/io/unix.c')
-rw-r--r-- | libgfortran/io/unix.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 1a4bedd..ca96c22 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -218,6 +218,17 @@ fix_fd (int fd) return fd; } +int +is_preconnected (stream * s) +{ + int fd; + + fd = ((unix_stream *) s)->fd; + if (fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO) + return 1; + else + return 0; +} /* write()-- Write a buffer to a descriptor, allowing for short writes */ |