X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f Date: Wed, 8 May 2002 09:23:38 -0700 From: Zack Weinberg To: Andris Pavenis Cc: Eli Zaretskii , Nick Clifton , djgpp-workers AT delorie DOT com, gcc-patches AT gcc DOT gnu DOT org Subject: Re: RFA: Ignore DOS end-of-line characters (ctrl-Z) unless -W Message-ID: <20020508162338.GF20829@codesourcery.com> References: <20020508153338 DOT GE20829 AT codesourcery DOT com> <200205081853 DOT 11194 DOT pavenis AT latnet DOT lv> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200205081853.11194.pavenis@latnet.lv> User-Agent: Mutt/1.3.28i 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 Wed, May 08, 2002 at 06:53:11PM +0300, Andris Pavenis wrote: > offset = 0; > +#ifdef __DJGPP__ > + /* For DJGPP redirected input is opened with O_TEXT by default > + change it to O_BINARY */ > + if (inc->fd==0) > + setmode (inc->fd, O_BINARY); > +#endif 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); change that to if (filename[0] == '\0') { file->fd = 0; #ifdef __DJGPP__ setmode(file->fd, O_BINARY) #endif } else ... A tested patch that does that and nothing else is preapproved. ^Z handling should be in _cpp_lex_direct. Add a case to the big switch for '\032', #ifndef HOST_EBCDIC. I want to see this as a separate patch from any fixes for file mode handling. zw