From: Stephen Boyd <bebarino@gmail.com>
To: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Jakub Narebski <jnareb@gmail.com>,
Sverre Rabbelier <srabbelier@gmail.com>
Subject: Re: [PATCHv2 1/2] parse-options: add PARSE_OPT_LITERAL_ARGHELP for complicated argh's
Date: Thu, 21 May 2009 14:27:25 -0700 [thread overview]
Message-ID: <4A15C73D.3010301@gmail.com> (raw)
In-Reply-To: <780e0a6b0905211203g3223fe3fp5eed27ebf244394a@mail.gmail.com>
Stephen Boyd wrote:
> On Thu, May 21, 2009 at 9:51 AM, René Scharfe
> <rene.scharfe@lsrfire.ath.cx> wrote:
>> Junio C Hamano schrieb:
>>> Hmmm, why does this break t0040 (I am queuing this on top of 5acb3e5)?
>> Probably because it changes this:
>>
>> Â Â Â Â pos += fprintf(...);
>>
>> into this (simplified, usage_argh() expanded):
>>
>> Â Â Â Â pos += pos + fprintf(...);
>>
>> usage_argh() doesn't need the parameter pos.
>>
>> René
>>
>
> Woops. I thought I ran the tests but I guess I didn't. This is the
> correct fix, thanks.
And here's the patch you can squash in.
diff --git a/parse-options.c b/parse-options.c
index 2b880b1..e8955be 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -361,7 +361,7 @@ int parse_options(int argc, const char **argv, const struct option *options,
return parse_options_end(&ctx);
}
-static int usage_argh(const struct option *opts, int pos)
+static int usage_argh(const struct option *opts)
{
const char *s;
int literal = opts->flags & PARSE_OPT_LITERAL_ARGHELP;
@@ -372,7 +372,7 @@ static int usage_argh(const struct option *opts, int pos)
s = literal ? "[%s]" : "[<%s>]";
else
s = literal ? " %s" : " <%s>";
- return pos + fprintf(stderr, s, opts->argh);
+ return fprintf(stderr, s, opts->argh);
}
#define USAGE_OPTS_WIDTH 24
@@ -436,7 +436,7 @@ int usage_with_options_internal(const char * const *usagestr,
/* FALLTHROUGH */
case OPTION_STRING:
if (opts->argh)
- pos += usage_argh(opts, pos);
+ pos += usage_argh(opts);
else {
if (opts->flags & PARSE_OPT_OPTARG)
if (opts->long_name)
next prev parent reply other threads:[~2009-05-21 21:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-17 10:47 [PATCH 1/3] show-branch: Fix die message in parse_reflog_param() Stephen Boyd
2009-05-17 10:47 ` [PATCH 2/3] parse-options: add PARSE_OPT_CUSTOM_ARGH for complicated argh's Stephen Boyd
2009-05-17 10:47 ` [PATCH 3/3] show-branch: migrate to parse-options API Stephen Boyd
2009-05-18 6:14 ` [PATCH 2/3] parse-options: add PARSE_OPT_CUSTOM_ARGH for complicated argh's Junio C Hamano
2009-05-18 7:08 ` Stephen Boyd
2009-05-18 7:57 ` Junio C Hamano
2009-05-18 8:06 ` Stephen Boyd
2009-05-18 22:52 ` Jakub Narebski
2009-05-19 5:09 ` Sverre Rabbelier
2009-05-21 7:33 ` [PATCHv2 1/2] parse-options: add PARSE_OPT_LITERAL_ARGHELP " Stephen Boyd
2009-05-21 16:26 ` Junio C Hamano
2009-05-21 16:51 ` René Scharfe
2009-05-21 19:03 ` Stephen Boyd
2009-05-21 21:27 ` Stephen Boyd [this message]
2009-05-21 7:33 ` [PATCHv2 2/2] show-branch: migrate to parse-options API Stephen Boyd
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=4A15C73D.3010301@gmail.com \
--to=bebarino@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jnareb@gmail.com \
--cc=rene.scharfe@lsrfire.ath.cx \
--cc=srabbelier@gmail.com \
/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 NNTP newsgroup(s).