From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21272 invoked by alias); 4 Jan 2015 00:40:09 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19684 Received: (qmail 14569 invoked from network); 4 Jan 2015 00:39:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=Ko/6AtSI c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=YNv0rlydsVwA:10 a=bZITasyQ7ZtgLc-TZUYA:9 a=fmDwQN2UKMX1NClg:21 a=Lbi6XOq1dooxAM6p:21 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <150103164002.ZM23676@torch.brasslantern.com> Date: Sat, 03 Jan 2015 16:40:02 -0800 In-reply-to: <54A85B6C.4020103@eastlink.ca> Comments: In reply to Ray Andrews "Re: symlink chain." (Jan 3, 1:13pm) References: <549E3A7B.9010209@eastlink.ca> <20150102170307.7d2e644a@ntlworld.com> <54A6E6B1.6070201@eastlink.ca> <20150102212422.3a761af5@ntlworld.com> <54A7136C.1060102@eastlink.ca> <20150102222140.1303a633@ntlworld.com> <54A72CEF.9090102@eastlink.ca> <54A740F3.4040902@eastlink.ca> <150102210337.ZM22099@torch.brasslantern.com> <54A783C3.3000006@eastlink.ca> <150102231734.ZM22168@torch.brasslantern.com> <54A82374.1030208@eastlink.ca> <150103120252.ZM23074@torch.brasslantern.com> <54A85B6C.4020103@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: symlink chain. MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 3, 1:13pm, Ray Andrews wrote: } Subject: Re: symlink chain. } } On 01/03/2015 12:02 PM, Bart Schaefer wrote: } > } > Whence is a pocketknife that you seem to want to be a Leatherman tool. } > } > If you want the wrench analogy, wrenches fit on nuts, and nuts of a } > particular shape. } } Well sir, you've made up your mind on that, so I won't flog the subject } further, but to say that if: } } $ whence /usr/bin/zsh } } ... did *not* work. I'd have an easier time accepting your view. My actual view is closer to the pocketknife than to the wrench. The -w and -s options of whence can be useful with a full path. The -m option just isn't that sort of blade. Don't use the knife with both ends unfolded and then complain when you stab yourself in the thumb. However, if you REALLY want the -m option to do something special with arguments that start with a slash, you need this (which I won't commit): diff --git a/Src/builtin.c b/Src/builtin.c index ebc0654..509629f 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -3243,10 +3243,28 @@ bin_whence(char *nam, char **argv, Options ops, int func) } /* Done search for `internal' commands, if the -p option * * was not used. Now search the path. */ - cmdnamtab->filltable(cmdnamtab); - scanmatchtable(cmdnamtab, pprog, 1, 0, 0, - (all ? fetchcmdnamnode : cmdnamtab->printnode), - printflags); + if (**argv == '/') { + if (all) + addlinknode(matchednodes, *argv); + else if ((cnam = findcmd(*argv, 1))) { + /* Found external command. */ + if (wd) { + printf("%s: command\n", *argv); + } else { + if (v && !csh) + zputs(*argv, stdout), fputs(" is ", stdout); + zputs(cnam, stdout); + if (OPT_ISSET(ops,'s') || OPT_ISSET(ops,'S')) + print_if_link(cnam, OPT_ISSET(ops,'S')); + fputc('\n', stdout); + } + } + } else { + cmdnamtab->filltable(cmdnamtab); + scanmatchtable(cmdnamtab, pprog, 1, 0, 0, + (all ? fetchcmdnamnode : cmdnamtab->printnode), + printflags); + } unqueue_signals(); }