Subject: how to force pipes into binary mode?
From: [email-masked] (Richard Y. Kim)

18 Apr 1998 23:53:18 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: Frank Baumgart <[email-masked]>
Cc: [email-masked]

>>>>> "Frank" == Frank Baumgart <[email-masked]> writes:

    Frank> So, how do I force my pipes which have been created with
    Frank> pipe() to work in binary mode?

Get 
     ftp://ftp.cygnus.com/pub/gnu-win32/gnu-win32-b19/usertools-src.tar.gz

This includes the source for _bash_.
In the bash subdirectory, find the file execute_cmd.c,
In this file, search for the definition of do_piping().
You will see 3 instances of 

  #ifdef __CYGWIN32__
        setmode (0, O_TEXT);
  #endif

in this function. I believe taking out all three sets of code reverts
_bash_ back to the "correct" setting.  Please correct me if I'm wrong.

I want to thank Larry Hall <[email-masked]> for pointing out where to
find above code when I had the same question as Frank.

    Frank> Or better: are there any patches or even cygwin32.dll
    Frank> available working in binary mode generally? (pipes doing
    Frank> text-mode translation is so stupid!)

I could not agree more based on my personal experience. I tried out
gnu-win32 about two years ago. I dropped it right away, because of
problems which I now think were due to text mode pipes. I did not have
the time nor the incentive to figure out what was going on then. I
gave gnu-win32 another shot about a year ago. I dropped it again after
couple of days due to similar problems. This is my third time
around. This time, I spent more time. With the help of people on
gnu-win32 mailing list, I now understand what I need to do to use
gnu-win32.

I hope that Cygnus people take out the code they put in to force text
mode pipe in _bash_ in the next release of gnu-win32.

Richard Y. Kim

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