From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20674 invoked from network); 28 Mar 2004 04:49:52 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 28 Mar 2004 04:49:52 -0000 Received: (qmail 7973 invoked by alias); 28 Mar 2004 04:49:43 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19699 Received: (qmail 7918 invoked from network); 28 Mar 2004 04:49:43 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 28 Mar 2004 04:49:43 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [130.225.247.86] by sunsite.dk (MessageWall 1.0.8) with SMTP; 28 Mar 2004 4:49:43 -0000 Received: (qmail 30600 invoked from network); 28 Mar 2004 04:49:43 -0000 Received: from acolyte.scowler.net (216.254.112.45) by a.mx.sunsite.dk with SMTP; 28 Mar 2004 04:49:40 -0000 Received: by acolyte.scowler.net (Postfix, from userid 1000) id 8682170037; Sat, 27 Mar 2004 23:49:12 -0500 (EST) Date: Sat, 27 Mar 2004 23:49:12 -0500 From: Clint Adams To: Bart Schaefer Cc: zsh-workers@sunsite.dk Subject: Re: printf for converting numbers to letters, bug? Message-ID: <20040328044912.GA4602@scowler.net> References: <1040326164256.ZM18660@candle.brasslantern.com> <20040326170042.GA19532@scowler.net> <1040327235312.ZM19835@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1040327235312.ZM19835@candle.brasslantern.com> User-Agent: Mutt/1.5.5.1+cvs20040105i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 > Zsh is (as of 4.2.0) behaving such that, given x='101', > > printf "%c" $x > and > print -r $x[1] > > produce the same output. That behavior is nearly useless. (It is how > /usr/bin/printf on Linux works, though, so I guess it can be interpreted > as a compatibility issue.) Solaris too. > If %b interprets the string \0101 as an octal number and prints the > corresponding character, why shouldn't %c interpret the string 101 as a > decimal number and print the corresponding character? Compatibility. I think an option to do that would be okay, though perhaps a bit confusing. I think it would be nice if bin_printf could peek back in time to see if $x had PM_INTEGER set before it got expanded, but that seems like more trouble than it's worth. > http://www.opengroup.org/onlinepubs/007904975/utilities/printf.html > > I notice that although it mentions %b, there's NO definition of %b on any > of the pages it cross-references: > > http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap05.html > http://www.opengroup.org/onlinepubs/007904975/functions/printf.html > > Where is %b defined? In #7 of EXTENDED DESCRIPTION of the first URL you cited.