re PR fortran/44931 (For INPUT_UNIT, INQUIRE NAME= should not return "stdin")
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 14 Aug 2010 18:59:18 +0000 (18:59 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 14 Aug 2010 18:59:18 +0000 (18:59 +0000)
2010-08-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libfortran/44931
* io/inquire.c (inquire_via_unit): Add special case for __MINGW32__ to
return special file names CONIN$, CONOUT$, and CONERR$.

From-SVN: r163245

libgfortran/ChangeLog
libgfortran/io/inquire.c

index 6e0ec80714f4a97c9d8a0a43b9b521dc0374c46c..9f767975ac36b48612874fe2cb38d77cebbbbc18 100644 (file)
@@ -1,3 +1,9 @@
+2010-08-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libfortran/44931
+       * io/inquire.c (inquire_via_unit): Add special case for __MINGW32__ to
+       return special file names CONIN$, CONOUT$, and CONERR$.
+
 2010-08-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libfortran/45143
index 540fecb2c5b4f378d496d794dd8897ebb57f0d78..c4994ed179a28b6e93dfca5cb929ff978f3858c7 100644 (file)
@@ -83,8 +83,19 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u)
            fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
        }
       else
-#endif
        fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
+#elif defined __MINGW32__
+      if (u->unit_number == options.stdin_unit)
+       fstrcpy (iqp->name, iqp->name_len, "CONIN$", sizeof("CONIN$"));
+      else if (u->unit_number == options.stdout_unit)
+       fstrcpy (iqp->name, iqp->name_len, "CONOUT$", sizeof("CONOUT$"));
+      else if (u->unit_number == options.stderr_unit)
+       fstrcpy (iqp->name, iqp->name_len, "CONERR$", sizeof("CONERR$"));
+      else
+       fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
+#else
+    fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
+#endif
     }
 
   if ((cf & IOPARM_INQUIRE_HAS_ACCESS) != 0)