This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ASCII and BINARY files. Why?


Michael Paul Smith <mike@willingham.demon.co.uk> wrote:

> The ASCII or BINARY thing is no big deal in practice.

Then you've probably never done any of these things under UNIX:

1.  Used cat to aggregate a partitioned gzip file:

	cat file.gz.1 file.gz.2 file.gz.3 | gunzip -c > file

2.  Used sed to change the names of symbols in an object file:

	sed 's;read;rEaD;g' < foo.o > newfoo.o

3.  Or even just tried to see a hex or octal dump of what's
    in a file that doesn't contain text:

	od foo.gz

None of these commands work correctly given the default configuration
of the gnu-win32 system (i.e., not mounting with the -b switch).  #1
fails for two different reasons: cat will stop reading when it sees a
^Z in any of the files, and (if you're lucky enough to avoid that),
gunzip see CRNL converted to NL in the byte stream.

It is even possible (under the current defaults) for the following two
commands to work differently:

	zcat foo.gz		# Works.
	zcat < foo.gz		# Fails with CRC error

If none of this bothers you, then fine, but many UNIX software
engineers find it unacceptable for a UNIX emulation package to have a
read() call that (by default) converts CRNL to NL, leaving it up to
the application to do a "binary open" (a meaningless concept under
UNIX) to get the right behavior.

> I 
> have ported many Unix programs to DOS and Win95 and usually this is fixed 
> by greping for fopen() and open() and making the required mods.

Editting the source is explicitly a non-goal of the gnu-win32 project.

> Most Unix software which handles text can be made compatible with DOS,
> Win95, WinNT and Unix in very little time this way

"Very little time" multiplied by hundreds and thousands of
applications ends up being a large amount of time.
--
Francis Litterio                     PGP Key Fingerprint:
franl@world.std.com                  02 37 DF 6C 66 43 CD 2C
http://world.std.com/~franl/         10 C8 B5 8B 57 34 F3 21

-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]