From: kerr AT wizard DOT net ("Shane Kerr") Subject: Re: using cat on binary files (CTRL-Z trauma) 28 Oct 1996 21:07:08 -0800 Sender: daemon AT cygnus DOT com Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199610290352.WAA05725.cygnus.gnu-win32@wizard.wizard.net> Comments: Authenticated sender is Original-To: Geoffrey Noer , gnu-win32 AT cygnus DOT com X-mailer: Pegasus Mail for Win32 (v2.42a) Original-Sender: owner-gnu-win32 AT cygnus DOT com > John Cook taps on the keyboard: > > > > ...And if CTRL-Z is _not_ an EOF character, then why does cat > > behave this way within Windows NT? Is cat not intended for binary > > files under Win32 environments? > > The problem in this case seems to be that many Unix programs don't > specify O_BINARY when appropriate. Since cat always works in text > mode, control-Z gets trapped as EOF even when it shouldn't. Many UNIX programs don't specify WHAT??? O_BINARY is strictly a MS-DOS artifact. Well, maybe Mac's have it, I don't know. There _is_ no O_BINARY flag in UNIX, so I would hazard to guess that there are _very_ few UNIX programs that use it. > I've added this as a known bug to look into. For now, it would be > best to avoid catting binary files. I would suggest that for maximum compatibility files should default to binary mode. > For backwards compatibility, we will probably have to keep around > the Control-Z as EOF support for quite a while. This shouldn't be > an issue as long as binary files are recognized as such. In UNIX, Control-D typically serves to mark the end of input from a TTY, although this can be set via a stty. In MS-..., I mean Win32, it would seem to make sense to have Control-Z count as EOF from the console, but not in files. Just my $0.02. - For help on using this list, send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".