| Anonymous | Login | Signup for a new account | 11-10-2008 10:55 PST |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
| 0000624 | [BusyBox] New Features | feature | always | 01-05-06 06:11 | 01-06-06 12:28 | ||||
| Reporter | Colin Watson | View Status | public | ||||||
| Assigned To | BusyBox | ||||||||
| Priority | normal | Resolution | fixed | ||||||
| Status | closed | Product Version | svn | ||||||
| Summary | 0000624: printf: please support POSIX quoted-argument-character syntax | ||||||||
| Description |
POSIX documents (http://www.opengroup.org/onlinepubs/009695399/utilities/printf.html) [^] the following syntax for printf arguments: The argument operands shall be treated as strings if the corresponding conversion specifier is b, c, or s ; otherwise, it shall be evaluated as a C constant, as described by the ISO C standard, with the following extensions: [...] * If the leading character is a single-quote or double-quote, the value shall be the numeric value in the underlying codeset of the character following the single-quote or double-quote. I found myself wanting this recently in order to convert non-devfs disk device names into indices for display in a partitioning tool (e.g. /dev/hde => "IDE2 master (hde)"). Lacking any other way to map from a-z to 0-25 in shell that I can think of, it was going to have to be a messy sequence of sed commands until somebody pointed out this syntax to me. With this patch, I can just do: printf '%d\n' "'$character" ... to map from a-z to 0-25, which is much nicer. The small attached patch implements this feature; I've checked it against the printf implementation in GNU coreutils. |
||||||||
| Additional Information | |||||||||
| Attached Files |
|
||||||||
|
|
|||||||||
| Copyright © 2000 - 2006 Mantis Group |