ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/05/08/12:23:49

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 <zack AT codesourcery DOT com>
To: Andris Pavenis <pavenis AT latnet DOT lv>
Cc: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>,
Nick Clifton <nickc AT cambridge DOT redhat DOT com>, 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: <Pine DOT LNX DOT 4 DOT 21 DOT 0205081655590 DOT 26648-100000 AT gulbis DOT latnet DOT lv> <Pine DOT SUN DOT 3 DOT 91 DOT 1020508170644 DOT 25387K-100000 AT is> <20020508153338 DOT GE20829 AT codesourcery DOT com> <200205081853 DOT 11194 DOT pavenis AT latnet DOT lv>
Mime-Version: 1.0
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

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

- Raw text -


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