home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / atari / st / tech / 6595 < prev    next >
Encoding:
Text File  |  1993-01-11  |  2.5 KB  |  55 lines

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