From patchwork Sat Aug 14 04:22:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [libfortran] PR44931 Inquire by UNIT on stdin, stdout, and stderr for NAME From: Jerry DeLisle X-Patchwork-Id: 61727 Message-Id: <4C661A09.3000806@verizon.net> To: gfortran Cc: gcc patches , Kai Tietz Date: Fri, 13 Aug 2010 21:22:33 -0700 Hi, This patch is the second part of this fix and adds support for the NAME = for the preconnected units on MingW platforms. Kai, will you please test. Test case should give: 0 CONERR$ 5 CONIN$ 6 CONOUT$ on MingW, otherwise something like this for other systems: 0 /dev/pts/1 5 /dev/pts/1 6 /dev/pts/1 Regression tested on x86-64. OK for trunk if passes MingW? Regards, Jerry 2010-08-14 Jerry DeLisle PR libfortran/44931 * io/inquire.c (inquire_via_unit): Add special case for __MINGW32__ to return special file names CONIN$, CONOUT$, and CONERR$. Index: inquire.c =================================================================== --- inquire.c (revision 163225) +++ inquire.c (working copy) @@ -83,8 +83,25 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_u fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len); } else + fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len); +#elif defined __MINGW32__ + switch (u->unit_number) + { + case options.stdin_unit: + fstrcpy (iqp->name, iqp->name_len, "CONIN$", sizeof("CONIN$")); + break; + case options.stdout_unit: + fstrcpy (iqp->name, iqp->name_len, "CONOUT$", sizeof("CONOUT$")); + break; + case options.stderr_unit: + fstrcpy (iqp->name, iqp->name_len, "CONERR$", sizeof("CONERR$")); + break; + default: + fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len); + } +#else + fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len); #endif - fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len); } if ((cf & IOPARM_INQUIRE_HAS_ACCESS) != 0)