aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/unix.c
diff options
context:
space:
mode:
authorDavid Edelsohn <edelsohn@gnu.org>2005-01-23 00:14:31 +0000
committerDavid Edelsohn <dje@gcc.gnu.org>2005-01-22 19:14:31 -0500
commitfbac336391e238f8e92714fce5431f69d4f2d338 (patch)
tree58334819ab2857c14b05d08b9782ac195c0413b5 /libgfortran/io/unix.c
parenta059cdb8632f1a0a64d0ae2b4ada084ab69cac5e (diff)
downloadgcc-fbac336391e238f8e92714fce5431f69d4f2d338.zip
gcc-fbac336391e238f8e92714fce5431f69d4f2d338.tar.gz
gcc-fbac336391e238f8e92714fce5431f69d4f2d338.tar.bz2
re PR libfortran/19052 (unit 0 not preconnected to standard error)
PR libgfortran/19052 * libgfortran.h (options_t): Add stderr_unit. * io/io.h (error_stream): Declare. * io/open.c (new_unit): Do not terminate abnormally if opening file preconnected to stdin, stdout, or stderr. * io/unit.c (init_units): Initialize stderr_unit. * io/unix.c (error_stream): New function. * runtime/environ.c (GFORTRAN_STDERR_UNIT): New environment variable. From-SVN: r94090
Diffstat (limited to 'libgfortran/io/unix.c')
-rw-r--r--libgfortran/io/unix.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index daa0fb1..5dc31a5 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -1160,7 +1160,7 @@ input_stream (void)
}
-/* output_stream()-- Return a stream pointer to the default input stream.
+/* output_stream()-- Return a stream pointer to the default output stream.
* Called on initialization. */
stream *
@@ -1170,6 +1170,15 @@ output_stream (void)
}
+/* error_stream()-- Return a stream pointer to the default error stream.
+ * Called on initialization. */
+
+stream *
+error_stream (void)
+{
+ return fd_to_stream (STDERR_FILENO, PROT_WRITE);
+}
+
/* init_error_stream()-- Return a pointer to the error stream. This
* subroutine is called when the stream is needed, rather than at
* initialization. We want to work even if memory has been seriously