From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19332 invoked from network); 4 Feb 2003 15:46:05 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 4 Feb 2003 15:46:05 -0000 Received: (qmail 21141 invoked by alias); 4 Feb 2003 15:45:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18189 Received: (qmail 21134 invoked from network); 4 Feb 2003 15:45:54 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 4 Feb 2003 15:45:54 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [213.228.0.176] by sunsite.dk (MessageWall 1.0.8) with SMTP; 4 Feb 2003 15:45:54 -0000 Received: from pcchazelas.free.fr (grenoble-1-a7-62-147-75-207.dial.proxad.net [62.147.75.207]) by postfix4-2.free.fr (Postfix) with ESMTP id 16BEBC0A9 for ; Tue, 4 Feb 2003 16:45:53 +0100 (CET) Received: (from chazelas@localhost) by pcchazelas.free.fr (8.9.3/8.9.3) id QAA00250 for zsh-workers@sunsite.dk; Tue, 4 Feb 2003 16:44:25 +0100 Date: Tue, 4 Feb 2003 16:44:25 +0100 From: Stephane CHAZELAS To: zsh-workers@sunsite.dk Subject: printf and POSIX compliance Message-ID: <20030204164425.A192@pcchazelas.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.3.14i 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