summaryrefslogtreecommitdiff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-09-11 07:00:05 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-09-11 07:00:05 +0000
commit6e09c17757603c0ae64a9919df724d71ca8c8bf9 (patch)
tree9e4794eadcc6eb8aedae7f4bdc910dd544794836 /Src/builtin.c
parenta6f583e4187a73c515bbe6214acc036034c81594 (diff)
downloadzsh-6e09c17757603c0ae64a9919df724d71ca8c8bf9.tar.gz
zsh-6e09c17757603c0ae64a9919df724d71ca8c8bf9.zip
19059: add -v, -V and -p flags required by POSIX to the command builtin
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 057800df6..62426facb 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2593,7 +2593,7 @@ bin_unset(char *name, char **argv, Options ops, int func)
return returnval;
}
-/* type, whence, which */
+/* type, whence, which, command */
/**/
int
@@ -2603,6 +2603,7 @@ bin_whence(char *nam, char **argv, Options ops, int func)
Patprog pprog;
int returnval = 0;
int printflags = 0;
+ int aliasflags;
int csh, all, v, wd;
int informed;
char *cnam;
@@ -2624,6 +2625,18 @@ bin_whence(char *nam, char **argv, Options ops, int func)
if (OPT_ISSET(ops,'f'))
printflags |= PRINT_WHENCE_FUNCDEF;
+ if (func == BIN_COMMAND)
+ if (OPT_ISSET(ops,'V')) {
+ printflags = aliasflags = PRINT_WHENCE_VERBOSE;
+ v = 1;
+ } else {
+ aliasflags = PRINT_LIST;
+ printflags = PRINT_WHENCE_SIMPLE;
+ v = 0;
+ }
+ else
+ aliasflags = printflags;
+
/* With -m option -- treat arguments as a glob patterns */
if (OPT_ISSET(ops,'m')) {
for (; *argv; argv++) {
@@ -2677,7 +2690,7 @@ bin_whence(char *nam, char **argv, Options ops, int func)
/* Look for alias */
if ((hn = aliastab->getnode(aliastab, *argv))) {
- aliastab->printnode(hn, printflags);
+ aliastab->printnode(hn, aliasflags);
if (!all)
continue;
informed = 1;