Linux-Dash Archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: dash@vger.kernel.org
Cc: 503840@bugs.debian.org, 503840-submitter@bugs.debian.org
Subject: [BUILTIN] Handle -- in dotcmd
Date: Mon, 27 Oct 2014 16:57:41 +0800	[thread overview]
Message-ID: <20141027085741.GA6948@gondor.apana.org.au> (raw)

commit 12ad48bb31b003eb6d3106478b7760a031969a36
Author: Herbert Xu <herbert@gondor.apana.org.au>
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@yahoo.fr>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

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@redhat.com>
 
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@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

                 reply	other threads:[~2014-10-27  8:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141027085741.GA6948@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=503840-submitter@bugs.debian.org \
    --cc=503840@bugs.debian.org \
    --cc=dash@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).