From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9795 invoked from network); 27 Mar 2004 23:53:34 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 27 Mar 2004 23:53:34 -0000 Received: (qmail 3651 invoked by alias); 27 Mar 2004 23:53:19 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19698 Received: (qmail 3560 invoked from network); 27 Mar 2004 23:53:19 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 27 Mar 2004 23:53:19 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [130.225.247.86] by sunsite.dk (MessageWall 1.0.8) with SMTP; 27 Mar 2004 23:53:18 -0000 Received: (qmail 22906 invoked from network); 27 Mar 2004 23:53:18 -0000 Received: from wbar3.sjo1-4-11-009-147.sjo1.dsl-verizon.net (HELO candle.brasslantern.com) (4.11.9.147) by a.mx.sunsite.dk with SMTP; 27 Mar 2004 23:53:16 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id i2RNrCo19836; Sat, 27 Mar 2004 15:53:12 -0800 X-Authentication-Warning: candle.brasslantern.com: schaefer set sender to schaefer@closedmail.com using -f From: Bart Schaefer Message-Id: <1040327235312.ZM19835@candle.brasslantern.com> Date: Sat, 27 Mar 2004 23:53:12 +0000 In-Reply-To: <20040326170042.GA19532@scowler.net> Comments: In reply to Clint Adams "Re: (Fwd) printf for converting numbers to letters, bug?" (Mar 26, 12:00pm) References: <1040326164256.ZM18660@candle.brasslantern.com> <20040326170042.GA19532@scowler.net> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Re: printf for converting numbers to letters, bug? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: **** X-Spam-Status: No, hits=4.7 required=6.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_NJABL,RCVD_IN_NJABL_DIALUP,RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 4.7 On Mar 26, 12:00pm, Clint Adams wrote: } Subject: Re: (Fwd) printf for converting numbers to letters, bug? } } > Looks like "%c" is interpreting the argument as a string and printing } > the first character thereof. It should work more like %d, shouldn't it? } } Not according to POSIX; the argument to %b, %c, or %s is to be } interpreted as a string. Just to clarify my earlier comment: 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.) } If we had octal brace expansion, he could do something like } printf "%b\n" \\0{101..145} 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? I've just been looking at 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?