From 6e09c17757603c0ae64a9919df724d71ca8c8bf9 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 11 Sep 2003 07:00:05 +0000 Subject: 19059: add -v, -V and -p flags required by POSIX to the command builtin --- Src/builtin.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'Src/builtin.c') 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; -- cgit v1.2.3