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

printf and POSIX compliance



Hello all, and thank you for the very good job

I read at
http://www.opengroup.org/onlinepubs/007904975/utilities/printf.html
that, according to POSIX:

3- In addition to the escape sequences shown in the Base
   Definitions volume of IEEE Std 1003.1-2001, Chapter 5, File
   Format Notation ( '\\' , '\a' , '\b' , '\f' , '\n' , '\r' ,
   '\t' , '\v' ), "\ddd" , where ddd is a one, two, or
   three-digit octal number, shall be written as a byte with the
   numeric value specified by the octal number.

So

printf '\377\0377' | od -c

should return:
0000000 377 037   7
0000003

zsh printf gives:
0000000   \   3   7   7 377
0000005

zsh man pages says that sames sequences as for echo are
recognized. That's not what POSIX requires.

Note that neither bash nor GNU printf behave better.

The "printf '%b' '\0ooo'" is OK though.

--
Stéphane



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