[BUILTIN] Handle -- in dotcmd

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

 



commit 12ad48bb31b003eb6d3106478b7760a031969a36
Author: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date:   Mon Oct 27 16:56:46 2014 +0800

    [BUILTIN] Handle -- in dotcmd
    
    This patch adds a nextopt call in dotcmd in order to handle --.
    
    Reported-by: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

diff --git a/ChangeLog b/ChangeLog
index f015066..5212a9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
 	* Use error instead of warnx for fatal errors in printf.
 	* Optimise handling of backslash octals in printf.
 	* Simplify echo command.
+	* Handle -- in dotcmd.
 
 2014-10-13  Eric Blake <eblake@xxxxxxxxxx>
 
diff --git a/src/main.c b/src/main.c
index 00c5e00..985e8c4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -321,15 +321,19 @@ dotcmd(int argc, char **argv)
 {
 	int status = 0;
 
-	if (argc >= 2) {		/* That's what SVR2 does */
+	nextopt(nullstr);
+	argv = argptr;
+
+	if (*argv) {
 		char *fullname;
 
-		fullname = find_dot_file(argv[1]);
+		fullname = find_dot_file(*argv);
 		setinputfile(fullname, INPUT_PUSH_FILE);
 		commandname = fullname;
 		status = cmdloop(0);
 		popfile();
 	}
+
 	return status;
 }

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux