X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f From: pavenis AT lanet DOT lv To: Andris Pavenis , djgpp-workers AT delorie DOT com, zack AT codesourcery DOT com Date: Thu, 9 May 2002 13:14:53 +0300 MIME-Version: 1.0 Subject: Re: RFA: Ignore DOS end-of-line characters (ctrl-Z) unless -W Cc: Eli Zaretskii , Nick Clifton , djgpp-workers AT delorie DOT com, gcc-patches AT gcc DOT gnu DOT org Message-ID: <3CDA764D.1410.A1F3EA@localhost> In-reply-to: <20020508162338.GF20829@codesourcery.com> References: <200205081853 DOT 11194 DOT pavenis AT latnet DOT lv> X-mailer: Pegasus Mail for Windows (v4.01) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 8 May 2002 at 9:23, Zack Weinberg wrote: > This should be done in open_file(): > > /* ... > > O_BINARY tells some runtime libraries (notably DJGPP) not to do > newline translation; we can handle DOS line breaks just fine > ourselves. > > Special case: the empty string is translated to stdin. */ > > if (filename[0] == '\0') > file->fd = 0; > else > file->fd = open (file->name, O_RDONLY | O_NOCTTY | O_BINARY, 0666); > > A tested patch that does that and nothing else is preapproved. OK. Here it is (tested for DJGPP with 3.1 branch) --- cppfiles.c~1 Thu May 9 10:32:46 2002 +++ cppfiles.c Thu May 9 12:57:10 2002 @@ -270,7 +270,13 @@ Special case: the empty string is translated to stdin. */ if (filename[0] == '\0') - file->fd = 0; + { + file->fd = 0; +#ifdef __DJGPP__ + if (!isatty(file->fd)) + setmode (file->fd, O_BINARY); +#endif + } else file->fd = open (file->name, O_RDONLY | O_NOCTTY | O_BINARY, 0666); Andris PS. I'm also keeping my other patch for handling ^Z for DJGPP in cppfiles.c before it's handled in other place.