how to force pipes into binary mode?

Richard Y. Kim rkim1@san.rr.com
Sat Apr 18 19:53:00 GMT 1998


>>>>> "Frank" == Frank Baumgart <godot@uni-paderborn.de> 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 <lhall@rfk.com> 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
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list