From patchwork Sat Aug 14 04:22:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 61727 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 7129EB70DC for ; Sat, 14 Aug 2010 14:23:07 +1000 (EST) Received: (qmail 446 invoked by alias); 14 Aug 2010 04:23:02 -0000 Received: (qmail 428 invoked by uid 22791); 14 Aug 2010 04:23:00 -0000 X-SWARE-Spam-Status: No, hits=3.1 required=5.0 tests=AWL, BAYES_50, BOTNET, RCVD_IN_DNSWL_NONE, TW_CP, TW_IQ, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from vms173013pub.verizon.net (HELO vms173013pub.verizon.net) (206.46.173.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 14 Aug 2010 04:22:49 +0000 Received: from [192.168.1.5] ([unknown] [71.115.233.80]) by vms173013.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L7400MTHK5LQMI4@vms173013.mailsrvcs.net>; Fri, 13 Aug 2010 23:22:35 -0500 (CDT) Message-id: <4C661A09.3000806@verizon.net> Date: Fri, 13 Aug 2010 21:22:33 -0700 From: Jerry DeLisle User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-version: 1.0 To: gfortran Cc: gcc patches , Kai Tietz Subject: [patch, libfortran] PR44931 Inquire by UNIT on stdin, stdout, and stderr for NAME Content-type: multipart/mixed; boundary=------------020504080008060406010200 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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)