OSDN Git Service

* compare-debug: Drop .eh_frame relocations too.
[pf3gnuchains/gcc-fork.git] / libgfortran / io / unix.c
index 4d5ec70..4ecba3a 100644 (file)
@@ -190,17 +190,6 @@ 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;
-}
 
 /* If the stream corresponds to a preconnected unit, we flush the
    corresponding C stream.  This is bugware for mixed C-Fortran codes
@@ -908,6 +897,47 @@ regular_file (st_parameter_open *opp, unit_flags *flags)
       return -1;
     }
 
+#ifdef __CYGWIN__
+  if (opp->file_len == 7)
+    {
+      if (strncmp (path, "CONOUT$", 7) == 0
+         || strncmp (path, "CONERR$", 7) == 0)
+       {
+         fd = open ("/dev/conout", O_WRONLY);
+         flags->action = ACTION_WRITE;
+         return fd;
+       }
+    }
+
+  if (opp->file_len == 6 && strncmp (path, "CONIN$", 6) == 0)
+    {
+      fd = open ("/dev/conin", O_RDONLY);
+      flags->action = ACTION_READ;
+      return fd;
+    }
+#endif
+
+
+#ifdef __MINGW32__
+  if (opp->file_len == 7)
+    {
+      if (strncmp (path, "CONOUT$", 7) == 0
+         || strncmp (path, "CONERR$", 7) == 0)
+       {
+         fd = open ("CONOUT$", O_WRONLY);
+         flags->action = ACTION_WRITE;
+         return fd;
+       }
+    }
+
+  if (opp->file_len == 6 && strncmp (path, "CONIN$", 6) == 0)
+    {
+      fd = open ("CONIN$", O_RDONLY);
+      flags->action = ACTION_READ;
+      return fd;
+    }
+#endif
+
   rwflag = 0;
 
   switch (flags->action)