home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.26 / text0021.txt < prev    next >
Encoding:
Text File  |  1992-02-21  |  5.6 KB  |  107 lines

  1. Submitted-by: jfh@rpp386.cactus.org (John F Haugh II)
  2.  
  3. In article <1991Nov26.232738.3250@uunet.uu.net> gwyn@smoke.brl.mil (Doug Gwyn) writes:
  4. >How utterly off the mark can you be?  ISTRIP was not a POSIX invention;
  5. >it was existing practice, as was the entire 8-bit byte orientation of
  6. >the terminal device support (parity bits etc.)  If you need all 8 data
  7. >bits for your terminal connection then simply don't specify ISTRIP to
  8. >the terminal handler.
  9.  
  10. I'll start with just my remarks regarding ISTRIP since they seem to have
  11. generated the most heat.
  12.  
  13. It was not my intention to claim that POSIX invented ISTRIP, indeed,
  14. they did not - it's mentioned in my System V manual which predates the
  15. notion of POSIX by several years.  Rather, it is my claim that ISTRIP
  16. is required to be supported and that if you support it as described
  17. by the standard, then 8 bit code sets will be destructively translated
  18. on input.  Furthermore, the recovery from such an event is non-trivial
  19. (that is, you can't just turn parity on for your TTY device and make
  20. it work correctly.) for the end user.
  21.  
  22. As an example, EBCDIC has its characters spread throughout the entire
  23. 8 bit range.  If ISTRIP should become turned on, the translation
  24. of the EBCDIC character 'a' would be from 0x81 to 0x01, and for 'A'
  25. it would be from 0xC1 to 0x41.  While the response is often "Don't
  26. do that then", the complaint which I have is that POSIX could have
  27. had the foresight to 1) not require ISTRIP be supported for all
  28. asynchronous hardware interfaces (that is, it becomes implementation
  29. defined as to being supported or not) 2) defined it in terms of the
  30. size of the character being received (that is, "cs7" would mean
  31. "strip to 7 bits" and "cs8" would mean "strip to 8 bits") or 3)
  32. something completely different.  I tend to prefer 1) since 7.1.2.4
  33. defines parity, and it seems ISTRIP is really a parity and word-size
  34. issue.
  35.  
  36. Both the Rationale and 7.1.2.2 explicitly refer to 7 bit characters
  37. "which are common".  Anyone who has worked with characters from the
  38. international character sets is aware that outside of these United
  39. States, 8 bit characters "are common".  There is no room to change
  40. ISTRIP to be more meaningful in the environment which it exists in
  41. because the standard has explicitly stated that it must exist, and
  42. that it must behave in a specific fashion.
  43.  
  44. >                                            (2) Handling terminal
  45. >behavior via bit vectors and ioctl()s is awkward and error-prone; few
  46. >applications I have seen get this entirely right.  Interfaces to allow
  47. >the programmer to more directly and cleanly specify the desired actions
  48. >are clearly needed, and since they didn't exist as part of existing
  49. >commercial UNIX systems (every application programmer ended up rolling
  50. >his own), devising a standard interface for this widely-but-varyingly-
  51. >implemented facility was a positive service to the programmer.  There
  52. >is nothing preventing you from continuing to use your existing kludges
  53. >instead of the POSIX standard terminal control interface, but as a
  54. >matter of improved portability you should probably change your local
  55. >kludges to match the POSIX interface and use the vendor-provided
  56. >version when it exists instead of replacing it with yours.  In the
  57. >long run that should mean that you can stop having to deal with tty
  58. >variations when porting software.
  59.  
  60. This touches on part of my complaint.  By specifying ISTRIP in the
  61. manner which it has been described, a portable application can never
  62. use it since that application is never assured of knowing the size
  63. of its input characters (that is, 7 bits or 8).  It really is an
  64. implementation defined function that the implementation should have
  65. been allowed to control more to its liking.  If, as the Rationale
  66. says "Although the ISTRIP flag is normally superfluous in today's
  67. terminal hardware and software", why is it a required feature?  As
  68. an example of where POSIX is more to my liking, 7.1.2.4 allows the
  69. implementor the decency of not supporting 5, 6, or 7 bit characters
  70. where the underlying hardware may not support such (or even where
  71. it just may not make sense).
  72.  
  73. >In summary, I think 1003.1 addressed the terminal control functionality
  74. >sensibly and responsibly, and that there is no need for it to address
  75. >the kinds of things that you seem to be talking about.
  76.  
  77. Perhaps from a US-centric perspective there isn't - 7 bit ASCII is
  78. the predominant code set, but as POSIX-like operating systems make
  79. their way to Europe and beyond, this conflict between 7 bit and
  80. 8 bit code sets will become more evident.
  81.  
  82. The question which needed to be asked is "What happens if I take
  83. an 8 bit character and process it with a POSIX compliant terminal
  84. interface?"  Which brings up my question, given that ISTRIP must
  85. behave according to the specification, how can I support it in an
  86. environment where 8 bit characters are common?  The answer is I
  87. can't and it is completely meaningless to do so - and there, but
  88. for the grace of POSIX go I ...
  89.  
  90. I can appreciate the statement that the programmer should only
  91. change those bits which are relevant or needed, but as Doug states
  92. above, controlling terminal modes with a collection of bit vectors
  93. is prone to error.  The end user will not care where the problem
  94. lies, only that there is one.  I think that Vince Lombardi said
  95. "By failing to prepare, you are preparing to fail."  This sums it
  96. up - there is no graceful path for non-7-bit character sets to
  97. be supported via that is not "error-prone".
  98. -- 
  99. John F. Haugh II        |I am the NRA.     | UUCP: ...!cs.utexas.edu!rpp386!jfh
  100. Ma Bell: (512) 255-8251 |Take a friend shooting.| Domain: jfh@rpp386.cactus.org
  101. " ... expectation is the mother of disappointment."
  102.         -- Brad Konopik
  103.  
  104.  
  105. Volume-Number: Volume 26, Number 22
  106.  
  107.