From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24625 invoked from network); 11 Feb 2003 08:26:48 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Feb 2003 08:26:48 -0000 Received: (qmail 3039 invoked by alias); 11 Feb 2003 08:26:39 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18220 Received: (qmail 3031 invoked from network); 11 Feb 2003 08:26:39 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 11 Feb 2003 08:26:39 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.147] by sunsite.dk (MessageWall 1.0.8) with SMTP; 11 Feb 2003 8:26:39 -0000 X-VirusChecked: Checked X-Env-Sender: kiddleo@logica.com X-Msg-Ref: server-20.tower-27.messagelabs.com!1044951861!390 Received: (qmail 15398 invoked from network); 11 Feb 2003 08:24:21 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-20.tower-27.messagelabs.com with SMTP; 11 Feb 2003 08:24:21 -0000 Received: from finches.logica.co.uk ([158.234.142.11]) by iris.logica.co.uk (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id IAA22704; Tue, 11 Feb 2003 08:26:35 GMT X-Authentication-Warning: iris.logica.co.uk: Host [158.234.142.11] claimed to be finches.logica.co.uk Received: from finches.logica.co.uk (localhost [127.0.0.1]) by finches.logica.co.uk (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id h1B8TpU08052; Tue, 11 Feb 2003 09:29:52 +0100 In-reply-to: <20030204164425.A192@pcchazelas.free.fr> From: Oliver Kiddle References: <20030204164425.A192@pcchazelas.free.fr> To: Stephane CHAZELAS cc: zsh-workers@sunsite.dk Subject: Re: printf and POSIX compliance Date: Tue, 11 Feb 2003 09:29:51 +0100 Message-ID: <8050.1044952191@finches.logica.co.uk> Sender: kiddleo@logica.com On 4 Feb, you wrote: > 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 Okay, that's what printf(3) and ksh93's printf do. > zsh man pages says that sames sequences as for echo are > recognized. That's not what POSIX requires. It uses the same code as for echo and $'...' and doing otherwise would seem a bit unpleasant to me. That said, it seems to be what ksh93 does. In ksh, $'...' and printf work that way while print does something different. Note also that the behaviour of \c should probably be to cancel further output in printf but it isn't (again because I used the same function as is used by echo). It's an easy enough thing to change though. Should I? And what should it do for print and for posix quotes? Oliver This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.