From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10474 invoked from network); 26 Jun 2009 21:24:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 26 Jun 2009 21:24:29 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 51841 invoked from network); 26 Jun 2009 21:24:18 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 26 Jun 2009 21:24:18 -0000 Received: (qmail 5408 invoked by alias); 26 Jun 2009 21:24:11 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27058 Received: (qmail 5388 invoked from network); 26 Jun 2009 21:24:10 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 26 Jun 2009 21:24:10 -0000 Received: from mtaout01-winn.ispmail.ntl.com (mtaout01-winn.ispmail.ntl.com [81.103.221.47]) by bifrost.dotsrc.org (Postfix) with ESMTP id 6522D80307FA for ; Fri, 26 Jun 2009 23:23:57 +0200 (CEST) Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090626212356.ENVA6742.mtaout01-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com> for ; Fri, 26 Jun 2009 22:23:56 +0100 Received: from pws-pc.ntlworld.com ([81.107.42.185]) by aamtaout03-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20090626212356.NXWO2093.aamtaout03-winn.ispmail.ntl.com@pws-pc.ntlworld.com> for ; Fri, 26 Jun 2009 22:23:56 +0100 Received: from pws-pc (pws-pc [127.0.0.1]) by pws-pc.ntlworld.com (8.14.3/8.14.2) with ESMTP id n5QLNqJU008820 for ; Fri, 26 Jun 2009 22:23:52 +0100 Message-Id: <200906262123.n5QLNqJU008820@pws-pc.ntlworld.com> From: Peter Stephenson To: Zsh list Subject: Re: bug in ztrftime(): '%e' and '%f' specifiers swapped In-Reply-To: Message from Greg Klanderman of "Fri, 26 Jun 2009 16:40:25 EDT." <19013.12857.274684.466725@gargle.gargle.HOWL> Date: Fri, 26 Jun 2009 22:23:52 +0100 X-Cloudmark-Analysis: v=1.0 c=1 a=pRuUrRztM2cA:10 a=NLZqzBF-AAAA:8 a=MMrmd-ZLEIhovfp_RFoA:9 a=2I7KXlGiIDT1fOWibmCZNXPMu6EA:4 a=_dQi-Dcv4p4A:10 X-Virus-Scanned: ClamAV 0.94.2/9510/Fri Jun 26 17:46:23 2009 on bifrost X-Virus-Status: Clean Greg Klanderman wrote: > You have inadvertently swapped the meanings of the '%e' and '%f' format > specifiers. Thanks for tracking this down. > However, I find this equivalent patch to be more readable: Interesting how subjective this is, I find it significantly less so (though they're certainly equivalent so this is all rather minor and if you hadn't sent two patches I'd never even have thought about it): - there is no immediate visual cue that the formats do different things - the test for the format letter is repeated without it being obvious it is the same test - it's made even less obvious because the second test has to advance back down the format string since the key letter isn't saved in a variable [we do this sort of thing all the time elsewhere, though] - the fact that 'f' sets the "strip" feature unconditionally is obscured - I'm not that keen on "||" and "&&" in assignments anyway [again, the shell is full of stuff I'm not that keen on] so I've committed the first one. > Btw, are the zsh extension format specifiers documented? See the description of the %D format in the description of prompt escapes, which is where these first occurred; feel free to add some more cross references, I see there isn't one in the zsh/datetime description, for example. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/