home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.atari.st.tech
- Path: sparky!uunet!think.com!mintaka.lcs.mit.edu!kropotkin.gnu.ai.mit.edu!entropy
- From: entropy@gnu.ai.mit.edu (maximum entropy)
- Subject: Re: Porting UNIX Code to the ST
- In-Reply-To: jvt@its.bt.co.uk's message of 11 Jan 93 16:54:12 GMT
- Message-ID: <ENTROPY.93Jan11183750@kropotkin.gnu.ai.mit.edu>
- Sender: news@mintaka.lcs.mit.edu
- Organization: Not Proud Programmers
- References: <1993Jan5.214420.8268@sae.com> <1993Jan7.124324.27805@its.bt.co.uk>
- <ENTROPY.93Jan7224017@kropotkin.gnu.ai.mit.edu>
- <1993Jan11.165412.844@its.bt.co.uk>
- Date: Mon, 11 Jan 1993 23:37:50 GMT
- Lines: 40
-
- In article <1993Jan11.165412.844@its.bt.co.uk> jvt@its.bt.co.uk (John Trickey) writes:
- >In article <ENTROPY.93Jan7224017@kropotkin.gnu.ai.mit.edu> entropy@gnu.ai.mit.edu (maximum entropy) writes:
- >>
- >>Alternatively, the call:
- >>
- >> _binmode(1);
- >>
- >>somewhere at the beginning of a program will cause all fopen()s to
- >>default to binary mode (you can then force text mode with the "t"
- >>modifier in the mode specifier.) It's much easier, (and cleaner,
- >>IMHO) to make this one small hack than to hunt down all the file mode
- >>arguments all over a large program.
- >
- >Surely thats a bad as the first sin of using Unix specific modes in the
- >original fopen(). All you have done is introduced another restriction to
- >portability just because you cant't be bothered to look for all the fopen()
- >calls :-) :-) You may find you have to hunt them out anyway as to assume
- >all fopen()'s are binary is just ONE HELL OF AN ASSUMPTION.
-
- Under UNIX there is no "text mode" and "binary mode" (or maybe it's
- more accurate to say that both modes are equivalent). So, when
- porting UNIX code to the ST, in almost all cases it IS a valid
- assumption that all I/O should be done in binary mode.
-
- Note that I didn't reccomend that people write code from scratch using
- _binmode(). Of course you should get it right the first time and use
- binary mode when you want it. But the fact remains that there are
- thousands of lines of code for UNIX that make assumptions about binary
- mode, and it's much easier to just switch to a compatibility mode than
- to waste time patching fopens() every time you want to port the latest
- version of your favorite UNIX program. You're right, I can't be
- bothered.
-
- Cheers,
- entropy
- --
- entropy@gnu.ai.mit.edu
- entropy. . .it's not just a good idea, it's the second law.
- Boycott AT&T, Lotus, Apple, and Xerox. Join the League for
- Programming Freedom! Write to lpf@uunet.uu.net for more information.
-