delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/07/24/02:17:42

Date: Wed, 24 Jul 1996 09:13:06 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: DJ Delorie <dj AT delorie DOT com>
Cc: djgpp-workers AT delorie DOT com
Subject: Re: carriage returns
In-Reply-To: <199607240546.BAA32191@delorie.com>
Message-Id: <Pine.SUN.3.91.960724085955.12732H-100000@is>
Mime-Version: 1.0

On Wed, 24 Jul 1996, DJ Delorie wrote:

> gcc is now emitting files with TWO cr's for each lf on most (not all)
> lines.
> 
> This is with lav's new stdio.

Check the redirected stdio's and the the modes that files are read and
written.  A file that is read in BINARY mode should be written in BINARY
mode also; if it was read in TEXT mode, it should be written in TEXT mode. 
If the file in memory already has CRs (like if it was read in BINARY
mode), but some code assumes it hasn't and writes it in TEXT mode, the
extra CR will be added.  If the file is read from a redirected stdin and 
then written to a file, then stdin should be set to BINARY (as I 
understand the new stdio always does binary I/O) like this:

	if (!isatty (fileno (stdin)))
	  setmode (fileno (stdin), O_BINARY);

The same applies to a file that is output to a redirected stdout.

- Raw text -


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