From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13104 invoked from network); 5 Jun 2009 11:11:26 -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.4 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; 5 Jun 2009 11:11:26 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 91808 invoked from network); 5 Jun 2009 11:11:14 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Jun 2009 11:11:14 -0000 Received: (qmail 19627 invoked by alias); 5 Jun 2009 11:11:04 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27035 Received: (qmail 19610 invoked from network); 5 Jun 2009 11:11:03 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 5 Jun 2009 11:11:03 -0000 Received: from cluster-d.mailcontrol.com (cluster-d.mailcontrol.com [85.115.60.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 2E4F88027106 for ; Fri, 5 Jun 2009 13:10:59 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly05d.srv.mailcontrol.com (MailControl) with ESMTP id n55BAqvo010174 for ; Fri, 5 Jun 2009 12:10:53 +0100 Received: from news01.csr.com ([10.99.50.25]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Fri, 5 Jun 2009 12:10:52 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.14.2/8.13.4) with ESMTP id n55BAqog002165 for ; Fri, 5 Jun 2009 12:10:52 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.14.2/8.14.2/Submit) with ESMTP id n55BAqmv002162 for ; Fri, 5 Jun 2009 12:10:52 +0100 X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: run-help's man arguments X-Mailer: MH-E 8.0.3; nmh 1.3; GNU Emacs 22.1.1 Date: Fri, 05 Jun 2009 12:10:52 +0100 Message-ID: <2161.1244200252@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 05 Jun 2009 11:10:52.0678 (UTC) FILETIME=[4A25BA60:01C9E5CE] X-Scanned-By: MailControl A-09-00-10 (www.mailcontrol.com) on 10.68.0.115 X-Virus-Scanned: ClamAV 0.94.2/9425/Fri Jun 5 05:55:18 2009 on bifrost X-Virus-Status: Clean I've only recently started using the vanilla run-help supplied with the shell. Ages ago, in http://www.zsh.org/mla/workers//2000/msg01589.html run-help got changed to invoke "man $@" rather than "man $1". This was described as being "to allow the specification of sections and other man options through" (sic, presumably something missing?) The text has changed since then, but the basic feature is still there. Nobody's ever complained about this, but this is surely weird; that's not how you use run-help, the $@ is the stuff on the command line which doesn't include anything for "man" unless you type it yourself, which is rather against the spirit of run-help (and very well hidden). I ran into this running run-help on locate -r stuff which caused man to barf immediately due to the annoying and confusing GNU feature that options can occur anywhere on the command line, so -r is picked up as an option to "man" rather than "locate". This particular problem is fixed by POSIXLY_CORRECT=1 man $@:t which is presumably benign for other versions of man so I'll commit it. However, the original query remains. Why do we need $@ rather than $1? Why do I need man to produce the error messages No manual entry for -r No manual entry for stuff ? I can see that help on something like "nice locate -r stuff" (stupid example) or even "nice -n 10 locate -r stuff" does something sensible but with some harmless error messages. Is this the correct rationale? Index: Functions/Misc/run-help =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Misc/run-help,v retrieving revision 1.15 diff -u -r1.15 run-help --- Functions/Misc/run-help 25 Apr 2009 20:30:20 -0000 1.15 +++ Functions/Misc/run-help 5 Jun 2009 11:06:22 -0000 @@ -8,8 +8,7 @@ # autoload run-help # -emulate -R zsh -setopt localoptions +emulate -RL zsh local HELPDIR="${HELPDIR:-/usr/share/zsh/$ZSH_VERSION/help}" @@ -103,7 +102,7 @@ done eval "run-help-$1:t ${(q@)cmd_args[2,-1]}" else - man $@:t + POSIXLY_CORRECT=1 man $@:t fi fi ;; -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070