zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: symlink chain.
Date: Sat, 03 Jan 2015 16:40:02 -0800	[thread overview]
Message-ID: <150103164002.ZM23676@torch.brasslantern.com> (raw)
In-Reply-To: <54A85B6C.4020103@eastlink.ca>

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();
 	}


  parent reply	other threads:[~2015-01-04  0:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-27  4:50 Ray Andrews
2014-12-27 23:38 ` Ray Andrews
2015-01-02 17:03 ` Peter Stephenson
2015-01-02 18:42   ` Ray Andrews
2015-01-02 20:27     ` Lawrence Velázquez
2015-01-02 21:19       ` Ray Andrews
2015-01-02 21:24     ` Peter Stephenson
2015-01-02 21:36       ` Ray Andrews
2015-01-02 21:53       ` Ray Andrews
2015-01-02 22:21         ` Peter Stephenson
2015-01-02 23:42           ` Ray Andrews
2015-01-03  1:08             ` Ray Andrews
2015-01-03  5:03               ` Bart Schaefer
2015-01-03  5:53                 ` Ray Andrews
2015-01-03  7:17                   ` Bart Schaefer
2015-01-03 17:14                     ` Ray Andrews
2015-01-03 20:02                       ` Bart Schaefer
2015-01-03 21:13                         ` Ray Andrews
2015-01-03 21:42                           ` Peter Stephenson
2015-01-03 22:42                             ` Ray Andrews
2015-01-04  0:41                               ` Bart Schaefer
2015-01-04  3:45                                 ` Ray Andrews
2015-01-04  0:40                           ` Bart Schaefer [this message]
2015-01-04  3:35                             ` Ray Andrews
2015-01-04  8:31                               ` Bart Schaefer
2015-01-04 20:49                                 ` Ray Andrews
2015-01-05  1:34                                   ` Bart Schaefer
2015-01-05  2:28                                     ` Lawrence Velázquez
2015-01-05  4:24                                       ` Ray Andrews
2015-01-02 22:22         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=150103164002.ZM23676@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).