Mail Archives: cygwin/1997/06/12/23:54:48
Blake McBride writes:
> 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 -
>
> anymore. I don't have time to find and fix the problem for my own use
> and this is the only reason I don't use gnu-win32.
>
> --blake
I've run into the same problem--for instance, if "x" is a binary file,
the commands "dd if=x of=y" and "dd if=x > y" produce different
results ("cat x > y" doesn't work because cat opens its input in TEXT
mode). This is an incredible headache, but the fix is pretty easy.
You need to recompile bash, which always opens redirects in TEXT mode.
You can download my patched copy of bash at
http://www.cs.cornell.edu/home/jyh/cygwin32/
or you can just patch the file "make_cmd.c" with the following patch:
*** make_cmd.c Thu Jun 12 10:22:38 1997
--- x Thu Jun 12 11:02:02 1997
***************
*** 467,494 ****
case r_output_direction: /* >foo */
case r_output_force: /* >| foo */
- #ifndef TEXT_MODE
- temp->flags = O_TRUNC | O_WRONLY | O_CREAT | O_BINARY;
- #else
temp->flags = O_TRUNC | O_WRONLY | O_CREAT;
- #endif
break;
case r_input_direction: /* <foo */
case r_inputa_direction: /* foo & makes this. */
- #ifndef TEXT_MODE
- temp->flags = O_RDONLY | O_BINARY;
- #else
temp->flags = O_RDONLY;
- #endif
break;
case r_appending_to: /* >>foo */
- #ifndef TEXT_MODE
- temp->flags = O_APPEND | O_WRONLY | O_CREAT | O_BINARY;
- #else
temp->flags = O_APPEND | O_WRONLY | O_CREAT;
- #endif
break;
case r_deblank_reading_until: /* <<-foo */
--- 467,482 ----
***************
*** 503,521 ****
break;
case r_err_and_out: /* command &>filename */
- #ifndef TEXT_MODE
- temp->flags = O_TRUNC | O_WRONLY | O_CREAT | O_BINARY;
- #else
temp->flags = O_TRUNC | O_WRONLY | O_CREAT;
- #endif
break;
case r_input_output:
- #ifndef TEXT_MODE
- temp->flags = O_RDWR | O_CREAT | O_BINARY;
- #else
temp->flags = O_RDWR | O_CREAT;
- #endif
break;
default:
--- 491,501 ----
--
Jason Hickey Email: jyh AT cs DOT cornell DOT edu
Department of Computer Science Tel: (607) 255-1372
Cornell University
-
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".
- Raw text -