summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2014-10-27 16:56:46 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2014-10-27 16:56:46 +0800
commit12ad48bb31b003eb6d3106478b7760a031969a36 (patch)
treeadf44e59d97cba2fa949fc8ff31e125ba78f02f3 /src
parent[BUILTIN] Simplify echo command (diff)
downloaddash-12ad48bb31b003eb6d3106478b7760a031969a36.tar.gz
dash-12ad48bb31b003eb6d3106478b7760a031969a36.zip
[BUILTIN] Handle -- in dotcmd
This patch adds a nextopt call in dotcmd in order to handle --.

Reported-by: Stephane Chazelas <stephane_chazelas@yahoo.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'src')
-rw-r--r--src/main.c8
1 files changed, 6 insertions, 2 deletions
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;
 }