From: ChrisB AT PythiaNET DOT com (Chris Breisch) Subject: RE: Problem with stdout BINARY 12 Jun 1997 10:23:56 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Original-To: "'gnu-win32 AT cygnus DOT com'" X-Mailer: Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63 Original-Sender: owner-gnu-win32 AT cygnus DOT com > > > -----Original Message----- > From: Blake McBride [SMTP:blake AT edge DOT net] > Sent: Wednesday, June 11, 1997 4:34 PM > To: gnu-win32 AT cygnus DOT 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 317.637.0375 - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".