This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Problem with stdout BINARY


>	
>	
>	-----Original Message-----
>	From:	Blake McBride [SMTP:blake@edge.net]
>	Sent:	Wednesday, June 11, 1997 4:34 PM
>	To:	gnu-win32@cygnus.com
>	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
<ChrisB@PYTHIANet.Com>
317.637.0375
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]