[PATCH v2 2/2] exec: type: ignore first -- for consistency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
---
 src/exec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/exec.c b/src/exec.c
index 87354d4..d61881d 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -760,11 +760,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;
 }
-- 
2.30.2

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux