Subject: RE: Problem with stdout BINARY
From: [email-masked] (Chris Breisch)

12 Jun 1997 10:23:56 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <c=US%a=_%p=PYTHIA%l=[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Original-To: "[email-masked]'" <[email-masked]>
X-Mailer: Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63
Original-Sender: [email-masked]

>	
>	
>	-----Original Message-----
>	From:	Blake McBride [SMTP:[email-masked]]
>	Sent:	Wednesday, June 11, 1997 4:34 PM
>	To:	[email-masked]
>	Subject:	Re: Problem with stdout BINARY
>	
>	At 11:29 AM 6/11/97 +0100, you wrote:
>	>Hi everybody,
>	>
>	>Trying to write gif file in stdout with 'putchar'. b18 seems to add a CRNL
>	>every CR he
>	>founds in the file.
>	
>	You know it's one of life's great mysteries.  stdxxx used to be opened in
>	binary mode and then someone changed it.   It seems to me that it's got
>	to be trivial to switch it back.  The reason for changing it is unknown
>	to me.  Since they've changed it to TEXT mode you can't even execute:
>	
>	gzip -dc abc.tar.gz |tar xvf -

There is a (possibly) simple solution to this.  I haven't investigated
the sources, but I did this for emx for OS/2, and it works fairly well
most of the time.

Change the open code for stdxxx to check to see if the file handles
are associated with the console, or with a file or a pipe.  Set them
to TEXT mode when it's the console, and to BINARY mode otherwise.  This
should be done in the program startup code, crt0.o or whatever it is
for cygwin32. This is kind of a kludge, I admit, but seemed to work better
than a unilateral TEXT vs. BINARY decision (for me, anyway) under emx
for OS/2.

	-chris

Chris Breisch
PYTHIA Corporation
<[email-masked]>
317.637.0375
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".