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