home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.31 / text0037.txt < prev    next >
Encoding:
Text File  |  1993-07-15  |  1.2 KB  |  31 lines

  1. Submitted-by: djm@eng.umd.edu (David J. MacKenzie)
  2.  
  3. Several people have complained that the GNU printf program (part of
  4. the GNU shell utilities) handles %c in a less than useful way: it
  5. treats the argument as a string and prints the first character.
  6. That is how I had interpreted POSIX.2; in particular, this paragraph
  7. from the printf section of draft 11.2:
  8.  
  9.  The argument operands shall be treated as strings if the corresponding
  10.  conversion character is b, c, or s; otherwise, it shall be evaluated as a
  11.  C constant, as described by the C Standard {7}, with the following
  12.  extensions:
  13.  
  14. I have heard that Chris Torek's BSD printf program does the same thing
  15. with %c, but I haven't verified that myself.
  16.  
  17. What people would like %c to do is for 'printf "%c" 3' to print a
  18. control-c character (using ASCII) rather than a digit.
  19.  
  20. I am a little confused now, because the table in section 2.12 that the
  21. printf section refers to for most of its specification says:
  22.  
  23.     c           The integer argument shall be converted to an unsigned
  24.                 char and the resulting byte shall be written.
  25.  
  26. Can someone clarify what the %c conversion should do?
  27.  
  28.  
  29. Volume-Number: Volume 31, Number 39
  30.  
  31.