www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/05/10/03:36:35

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
From: pavenis AT lanet DOT lv
To: Neil Booth <neil AT daikokuya DOT demon DOT co DOT uk>
Date: Fri, 10 May 2002 10:36:26 +0300
MIME-Version: 1.0
Subject: Re: RFA: Ignore DOS end-of-line characters (ctrl-Z) unless -W
Cc: djgpp-workers AT delorie DOT com, zack AT codesourcery DOT com,
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>,
Nick Clifton <nickc AT cambridge DOT redhat DOT com>, gcc-patches AT gcc DOT gnu DOT org
Message-ID: <3CDBA2AA.23908.1A2DCE@localhost>
In-reply-to: <20020509172313.GC14306@daikokuya.demon.co.uk>
References: <3CDA764D DOT 1410 DOT A1F3EA AT localhost>
X-mailer: Pegasus Mail for Windows (v4.01)
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

On 9 May 2002 at 18:23, Neil Booth wrote:

> pavenis AT lanet DOT lv wrote:-
> 
> > +#ifdef __DJGPP__
> > +      if (!isatty(file->fd))
> > +        setmode (file->fd, O_BINARY);
> > +#endif
> > +    }
> 
> Please add a comment about why this is there, too.  Thanks,
> 
Of course.  (and also Changelog entry I forgot previous time ...)

Andris

2002-05-10  Andris Pavenis  <pavenis AT lanet DOT lv>

	* cppfiles.c (open_file): Change mode (DJGPP only) of redirected 
        input to O_BINARY


--- gcc/cppfiles.c~4	Thu May  9 10:32:46 2002
+++ gcc/cppfiles.c	Fri May 10 10:26:28 2002
@@ -270,7 +270,15 @@
      Special case: the empty string is translated to stdin.  */
 
   if (filename[0] == '\0')
-    file->fd = 0;
+    {
+      file->fd = 0;
+#ifdef __DJGPP__
+      /* For DJGPP redirected input is opened in text mode. Change it
+         to binary mode.  */
+      if (! isatty(file->fd))
+        setmode (file->fd, O_BINARY);
+#endif
+    }
   else
     file->fd = open (file->name, O_RDONLY | O_NOCTTY | O_BINARY, 0666);
 



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019