This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/32784] [win32] Using 'con' as assigned file generates Fortran runtime error: File 'con' does not exist
- From: "jvdelisle at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Jul 2007 23:08:48 -0000
- Subject: [Bug libfortran/32784] [win32] Using 'con' as assigned file generates Fortran runtime error: File 'con' does not exist
- References: <bug-32784-14861@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from jvdelisle at gcc dot gnu dot org 2007-07-21 23:08 -------
Here is a complete patch, tested on Cygwin. I need to test on mingw. Can
anyone help with that?
Index: unix.c
===================================================================
--- unix.c (revision 126808)
+++ unix.c (working copy)
@@ -81,6 +81,13 @@ Boston, MA 02110-1301, USA. */
#define S_IWOTH 0
#endif
+#ifdef __CYGWIN__
+#define HAVE_DOS_CONIO
+#endif
+
+#ifdef __MINGW32__
+#define HAVE_DOS_CONIO
+#endif
/* Unix stream I/O module */
@@ -1259,6 +1266,27 @@ regular_file (st_parameter_open *opp, un
crflag |= O_BINARY;
#endif
+#ifdef HAVE_DOS_CONIO
+ if (strncmp (path, "CONOUT$", 7) == 0)
+ {
+ fd = STDOUT_FILENO;
+ flags->action = ACTION_WRITE;
+ return fd;
+ }
+ if (strncmp (path, "CONIN$", 6) == 0)
+ {
+ fd = STDIN_FILENO;
+ flags->action = ACTION_READ;
+ return fd;
+ }
+ if (strncmp (path, "CONERR$", 7) == 0)
+ {
+ fd = STDERR_FILENO;
+ flags->action = ACTION_WRITE;
+ return fd;
+ }
+#endif
+
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
fd = open (path, rwflag | crflag, mode);
if (flags->action != ACTION_UNSPECIFIED)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32784