Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug#386730: zsh: printf doesn't handle single-digit and two-digit octal escapes



Will changing getkeystring() break anything?

> zsh's builtin printf fails to interpret two-digit octal escape, such as '\1'
> or '\33'.  For example:
> 
> zsh% printf '\33abc' | hd
> 00000000  5c 33 33 61 62 63                                 |\33abc|
> 00000006
> 
> On the other hand, the printf from textutils handles them:
> 
> $ /usr/bin/printf '\33abc' | hd
> 00000000  1b 61 62 63                                       |.abc|
> 00000004
> 
> The zshbuiltins man page promises "formatting rules are the same as used in
> C", and C explicitly supports single-digit and double-digit octal escapes in
> string and character literals -- see section "6.4.4.4 Character constants"
> of the C99 standard.
> 
> Furthermore, POSIX explicitly states that \d and \dd are supported by
> printf(1) -- see http://tinyurl.com/gkdfr/, extended description, item 3. 
> The Solaris printf(1), the bash printf builtin, and the FreeBSD printf(1)
> all support them.



Messages sorted by: Reverse Date, Date, Thread, Author