ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/05/08/15:03:50

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Date: Wed, 08 May 2002 21:59:38 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: zack AT codesourcery DOT com
Message-Id: <5832-Wed08May2002215938+0300-eliz@is.elta.co.il>
X-Mailer: emacs 21.2.50 (via feedmail 8 I) and Blat ver 1.8.9
CC: pavenis AT latnet DOT lv, nickc AT cambridge DOT redhat DOT com, djgpp-workers AT delorie DOT com,
gcc-patches AT gcc DOT gnu DOT org
In-reply-to: <20020508153338.GE20829@codesourcery.com> (message from Zack
Weinberg on Wed, 8 May 2002 08:33:38 -0700)
Subject: Re: RFA: Ignore DOS end-of-line characters (ctrl-Z) unless -W
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>
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

> Date: Wed, 8 May 2002 08:33:38 -0700
> From: Zack Weinberg <zack AT codesourcery DOT com>
> 
> > For other systems, I guess a warning under -W is okay.
> 
> With or without truncating the input file?

Without, I guess: on any other system, you cannot be sure that the
file with a ^Z came from a DOSish platform.  I expect Unix and
GNU/Linux users outcry if/when they find out that a ^Z causes GCC to
stop reading.

> Is ^Z to be honored wherever it appears, or only immediately after a
> newline sequence?

There's no relation between ^Z and newlines whatsoever.  Old DOS
editors could put a ^Z anywhere, including several ^Zs one after
another.

> > I hope only when the input comes from a file, not from a terminal.
> 
> It makes no distinction.  What goes wrong when one reads from a
> terminal in binary mode under DOS?

You don't have echo, and you cannot easily stop the input (because ^Z
is no longer special to the system calls, and because binary input is
not line-buffered, so many characters are needed before the program
actually sees the ^Z).  Many users decide at this point that the
program has a bug and want to interrupt it.  However, due to
peculiarities of signal support, Ctrl-C is also disabled when the
terminal device is in binary mode (think about using Emacs), so
interrupting also doesn't work.  That's when the user decides their
system is wedged cold, and reboots it...

In other words, switching the terminal to binary mode has too many
nasty side effects.

> (I'm not sure how to open a file in text mode using open(),
> incidentally)

Either O_TEXT in `open' or "rt" in `fopen'.  (I hope I understood the
question, since I think you already know that.)

- Raw text -


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