about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2016-09-29 11:00:44 +0100
committerPeter Stephenson <pws@zsh.org>2016-09-29 11:01:00 +0100
commit07c8fbe59632be71e4ad5bfafbf6aa4884cd04c4 (patch)
treec8a34538da3a44dd49ae0d6d1f82539e56e5fc41 /Src/builtin.c
parentd44d23c7578285375f4ded759f7d8412320c3319 (diff)
downloadzsh-07c8fbe59632be71e4ad5bfafbf6aa4884cd04c4.tar.gz
zsh-07c8fbe59632be71e4ad5bfafbf6aa4884cd04c4.tar.xz
zsh-07c8fbe59632be71e4ad5bfafbf6aa4884cd04c4.zip
34943: Fixes for "command" with multiple options.
These need to combine properly, and alos "command -p" with either
-v or -V needs to search for builtins and then using the default
system path.
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 248f929d7..c78fd9b3a 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3643,7 +3643,15 @@ bin_whence(char *nam, char **argv, Options ops, int func)
 		returnval = 1;
 	    }
 	    popheap();
-	} else if ((cnam = findcmd(*argv, 1))) {
+	} else if (func == BIN_COMMAND &&
+		   (hn = builtintab->getnode(builtintab, *argv))) {
+	    /*
+	     * Special case for "command -p[vV]" which needs to
+	     * show a builtin in preference to an external command.
+	     */
+	    builtintab->printnode(hn, printflags);
+	    informed = 1;
+	} else if ((cnam = findcmd(*argv, 1, func == BIN_COMMAND))) {
 	    /* Found external command. */
 	    if (wd) {
 		printf("%s: command\n", *argv);