diff options
author | наб <nabijaczleweli@nabijaczleweli.xyz> | 2023-01-04 12:35:13 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2023-01-08 20:03:41 +0800 |
commit | ba57b84b305dd16f9d3e0d798835a7e9e15454ae (patch) | |
tree | 21573e80c4ef1c26715fc5386ccca1c05fc97ab5 | |
parent | 54485578e01017534dae30731f7682abadb38a09 (diff) | |
download | dash-ba57b84b305dd16f9d3e0d798835a7e9e15454ae.tar.gz |
builtin: Ignore first -- in type for consistency
This appears to be the only remaining built-in that doesn't use
nextopt() to parse its arguments (and isn't forbidden from doing so) ‒
users expect to be able to do this, and it's nice to be consistent here.
Test with: type -- ls --
Correct output lists ls=/bin/ls, then --=ENOENT
Wrong output lists --=ENOENT, ls=/bin/ls, --=ENOENT
Fixes: https://bugs.debian.org/870317
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | src/exec.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -766,11 +766,11 @@ unsetfunc(const char *name) int typecmd(int argc, char **argv) { - int i; int err = 0; - for (i = 1; i < argc; i++) { - err |= describe_command(out1, argv[i], NULL, 1); + nextopt(nullstr); + while (*argptr) { + err |= describe_command(out1, *argptr++, NULL, 1); } return err; } |