From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19087 invoked from network); 4 Jan 2007 17:08:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO,UPPERCASE_25_50 autolearn=ham version=3.1.7 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 4 Jan 2007 17:08:04 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 77323 invoked from network); 4 Jan 2007 17:07:58 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Jan 2007 17:07:58 -0000 Received: (qmail 13896 invoked by alias); 4 Jan 2007 17:07:53 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23088 Received: (qmail 13887 invoked from network); 4 Jan 2007 17:07:52 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 4 Jan 2007 17:07:52 -0000 Received: (qmail 77075 invoked from network); 4 Jan 2007 17:07:52 -0000 Received: from cluster-c.mailcontrol.com (168.143.177.190) by a.mx.sunsite.dk with SMTP; 4 Jan 2007 17:07:48 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly23c.srv.mailcontrol.com (MailControl) with ESMTP id l04H7WPk022032 for ; Thu, 4 Jan 2007 17:07:41 GMT Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Thu, 4 Jan 2007 17:07:40 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.8/8.13.4) with ESMTP id l04H7Ldc018283 for ; Thu, 4 Jan 2007 17:07:21 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.13.8/8.13.8/Submit) with ESMTP id l04H7KRg018280 for ; Thu, 4 Jan 2007 17:07:21 GMT Message-Id: <200701041707.l04H7KRg018280@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: Zsh hackers list Subject: Re: printf %b In-reply-to: <20070104163200.GA4883@sc> References: <20061227145818.GA4369@sc> <20070104153612.7aeb604f.pws@csr.com> <20070104163200.GA4883@sc> Comments: In-reply-to Stephane Chazelas message dated "Thu, 04 Jan 2007 16:32:00 +0000." Date: Thu, 04 Jan 2007 17:07:20 +0000 From: Peter Stephenson X-OriginalArrivalTime: 04 Jan 2007 17:07:40.0279 (UTC) FILETIME=[D7512870:01C73022] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-07-06-00 (www.mailcontrol.com) on 10.67.0.133 Stephane Chazelas wrote: > POSIX says > > printf '\123' > and > printf %b '\0123' > > should output "S" (note that the two syntaxes are different!) > > and > > printf '\0123' should output 3 > printf %b '\123' should output \123 (I think). Thanks, I hadn't found that bit. At least the really world is screwed up, too. Index: Src/builtin.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v retrieving revision 1.171 diff -u -r1.171 builtin.c --- Src/builtin.c 10 Dec 2006 23:27:03 -0000 1.171 +++ Src/builtin.c 4 Jan 2007 17:05:53 -0000 @@ -3490,7 +3490,7 @@ fmt = OPT_ARG(ops,'f'); if (fmt) fmt = getkeystring(fmt, &flen, OPT_ISSET(ops,'b') ? GETKEYS_BINDKEY : - GETKEYS_PRINTF, &fmttrunc); + GETKEYS_PRINTF_FMT, &fmttrunc); first = args; @@ -3954,7 +3954,7 @@ b = getkeystring(metafy(curarg, curlen, META_USEHEAP), &l, OPT_ISSET(ops,'b') ? GETKEYS_BINDKEY : - GETKEYS_PRINTF, &nnl); + GETKEYS_PRINTF_ARG, &nnl); } else { b = curarg; l = curlen; Index: Src/zsh.h =================================================================== RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v retrieving revision 1.104 diff -u -r1.104 zsh.h --- Src/zsh.h 4 Jan 2007 15:41:23 -0000 1.104 +++ Src/zsh.h 4 Jan 2007 17:05:55 -0000 @@ -1990,8 +1990,10 @@ */ /* echo builtin */ #define GETKEYS_ECHO (GETKEY_BACKSLASH_C) -/* printf format string */ -#define GETKEYS_PRINTF (GETKEY_BACKSLASH_C) +/* printf format string: \123 -> S, \0123 -> NL 3 */ +#define GETKEYS_PRINTF_FMT (GETKEY_OCTAL_ESC|GETKEY_BACKSLASH_C) +/* printf argument: \123 -> \123, \0123 -> S */ +#define GETKEYS_PRINTF_ARG (GETKEY_BACKSLASH_C) /* Full print without -e */ #define GETKEYS_PRINT (GETKEY_OCTAL_ESC|GETKEY_BACKSLASH_C|GETKEY_EMACS) /* bindkey */ -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php