home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / atari / st / tech / 6875 < prev    next >
Encoding:
Internet Message Format  |  1993-01-27  |  3.5 KB

  1. Path: sparky!uunet!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!ira.uka.de!rz.uni-karlsruhe.de!fg70.rz.uni-karlsruhe.de!ig25
  2. From: ig25@fg70.rz.uni-karlsruhe.de (Thomas Koenig)
  3. Newsgroups: comp.sys.atari.st.tech
  4. Subject: Re: Porting UNIX Code to the ST
  5. Date: 26 Jan 93 20:01:54 GMT
  6. Organization: University of Karlsruhe, Germany
  7. Lines: 61
  8. Message-ID: <ig25.728078514@fg70>
  9. References: <73673@cup.portal.com> <KIW0TVU@heaven7.in-berlin.de>
  10. NNTP-Posting-Host: fg70.rz.uni-karlsruhe.de
  11.  
  12. martini@heaven7.in-berlin.de (Martin P. Ibert) writes:
  13.  
  14. >Oh sure. You're right of course. There ARE those nasty "typed" file systems
  15. >that are EVEN WORSE than what we are squabbling about here. I remember
  16. >hacking away at a VMS system trying to find the mode to open a file that
  17. >yields exactly as many bytes as the stat(2) emulation says the file has.
  18. >I didn't found one, and I guess it simply can't be done. So maybe we should
  19. >consider ourselves lucky, after all :-)
  20.  
  21. It is not going to take much longer until you will indeed be able to.
  22. After all, VMS is going to get a POSIX.1 compliant application interface,
  23. so that stat thing better get fixed or else DEC will have quite a number
  24. of irate customers on their hands ;-)
  25.  
  26. But then again, even IBM announced POSIX compliance for MVS, and hat
  27. file system is nothing short of a nightmare... that'll be a sight.
  28. End-of-line character, what a strange concept ;-)
  29.  
  30. >So let's rephrase. The problem is indeed not that UNIX doesn't have a typed
  31. >file system while TOS has; this is rubbish. The problem is really with the
  32. >C language, whose idea of a text file differs from TOS' idea of a text file.
  33. >So in fact, the problem is neither TOS' nor UNIX' problem, but C's problem.
  34.  
  35. True.
  36.  
  37. Unfortunately, with POSIX.1 and ANSI-C being the only reasonable
  38. standards for writing both portable and useful programs above a certain
  39. level, you're stuck.
  40.  
  41. >In C source code, you'll find lots of I/O function calls that explicitly
  42. >or implicitly write or expect a single '\n' as a line delimiter. This is
  43. >not really part of the language proper (which is totally oblivious to
  44. >I/O anyway) but of run-time libraries and/or common usage. This usage
  45. >coincides (not incidentially) with the way text files are usually handled
  46. >on UNIX systems.
  47.  
  48. You have to distinguish between internal and external representation
  49. here.  If you open a file in text mode in C, using fopen(), the \n
  50. character has to be translated to whatever the operating system thinks
  51. is a line delimiter; it might even be the physical end of a record.
  52. For BINARY files, things are different.  I'd be tempted to call any
  53. program broken which writes out a \n to a binary stream and expects it
  54. to be treated as line delimiters by anything that follows (at least
  55. broken WRT to the ANSI Standard).
  56.  
  57. >Okay. So if you write/compile/whatever C programs that produce "text" files
  58. >with '\n' delimited lines, TOS couldn't care less. Those files are perfectly
  59. >legal TOS files. But they violate common TOS usage and are thus no legal
  60. >text files in a TOS environment. So your program has to be considered
  61. >malfunctioning, just like a program that writes files containing ISO-8859/1
  62. >coded 8bit letters.
  63.  
  64. In a way, that's correct.  However, with frequent porting of compressed
  65. files, it might be argued that for reading text files, at least, enough
  66. common usage exists that both \n and \r\n should be recognized when
  67. reading from a text stream.  After all, it can't be that hard to
  68. implement in the stdio library.
  69. -- 
  70. Thomas Koenig, ig25@rz.uni-karlsruhe.de, ig25@dkauni2.bitnet
  71. The joy of engineering is to find a straight line on a double
  72. logarithmic diagram.
  73.