diff options
author | stefanf <stefanf@FreeBSD.org> | 2008-11-28 18:55:42 +0000 |
---|---|---|
committer | stefanf <stefanf@FreeBSD.org> | 2008-11-28 18:55:42 +0000 |
commit | 51fb928cb838c8f8904fb9f1b32b94e86f9a2201 (patch) | |
tree | 92b0c4bc072b301bfaa8a03faeeaf36b7a9b6d52 /bin/sh | |
parent | b66b1bfcddae9bff426f7be893c2fe4870370f68 (diff) | |
download | FreeBSD-src-51fb928cb838c8f8904fb9f1b32b94e86f9a2201.zip FreeBSD-src-51fb928cb838c8f8904fb9f1b32b94e86f9a2201.tar.gz |
Report error messages of the builtins 'type' and 'command -V' to stderr instead
of stdout.
Noticed by: Zajcev Evgeny
Diffstat (limited to 'bin/sh')
-rw-r--r-- | bin/sh/exec.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/bin/sh/exec.c b/bin/sh/exec.c index cf78eb2..e11470f 100644 --- a/bin/sh/exec.c +++ b/bin/sh/exec.c @@ -728,9 +728,6 @@ typecmd_impl(int argc, char **argv, int cmd) extern char *const parsekwd[]; for (i = 1; i < argc; i++) { - if (cmd != TYPECMD_SMALLV) - out1str(argv[i]); - /* First look at the keywords */ for (pp = (char **)parsekwd; *pp; pp++) if (**pp == *argv[i] && equal(*pp, argv[i])) @@ -740,7 +737,7 @@ typecmd_impl(int argc, char **argv, int cmd) if (cmd == TYPECMD_SMALLV) out1fmt("%s\n", argv[i]); else - out1str(" is a shell keyword\n"); + out1fmt("%s is a shell keyword\n", argv[i]); continue; } @@ -749,7 +746,8 @@ typecmd_impl(int argc, char **argv, int cmd) if (cmd == TYPECMD_SMALLV) out1fmt("alias %s='%s'\n", argv[i], ap->val); else - out1fmt(" is an alias for %s\n", ap->val); + out1fmt("%s is an alias for %s\n", argv[i], + ap->val); continue; } @@ -775,7 +773,7 @@ typecmd_impl(int argc, char **argv, int cmd) if (cmd == TYPECMD_SMALLV) out1fmt("%s\n", name); else - out1fmt(" is%s %s\n", + out1fmt("%s is%s %s\n", argv[i], (cmdp && cmd == TYPECMD_TYPE) ? " a tracked alias for" : "", name); @@ -784,11 +782,12 @@ typecmd_impl(int argc, char **argv, int cmd) if (cmd == TYPECMD_SMALLV) out1fmt("%s\n", argv[i]); else - out1fmt(" is %s\n", argv[i]); + out1fmt("%s is %s\n", argv[i], + argv[i]); } else { if (cmd != TYPECMD_SMALLV) - out1fmt(": %s\n", - strerror(errno)); + outfmt(out2, "%s: %s\n", + argv[i], strerror(errno)); error |= 127; } } @@ -798,19 +797,19 @@ typecmd_impl(int argc, char **argv, int cmd) if (cmd == TYPECMD_SMALLV) out1fmt("%s\n", argv[i]); else - out1str(" is a shell function\n"); + out1fmt("%s is a shell function\n", argv[i]); break; case CMDBUILTIN: if (cmd == TYPECMD_SMALLV) out1fmt("%s\n", argv[i]); else - out1str(" is a shell builtin\n"); + out1fmt("%s is a shell builtin\n", argv[i]); break; default: if (cmd != TYPECMD_SMALLV) - out1str(": not found\n"); + outfmt(out2, "%s: not found\n", argv[i]); error |= 127; break; } |