Date: Wed, 24 Jul 1996 09:13:06 +0200 (IST) From: Eli Zaretskii To: DJ Delorie Cc: djgpp-workers AT delorie DOT com Subject: Re: carriage returns In-Reply-To: <199607240546.BAA32191@delorie.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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.