Re: [RFC] Re: Convert 'git blame' to parse_options()
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Jun 23, 2008, 16:11 UTC
- Message-ID
- <alpine.LFD.1.10.0806230908500.2926@woody.linux-foundation.org>
- In-Reply-To
- <20080623082223.GA12130@artemis.madism.org>
On Mon, 23 Jun 2008, Pierre Habouzit wrote:
Show 6 quoted lines
> > You can't, mainly because of option aggregation: if the parser1 knows > about -a and -b, parser2 about -c, then, this kind of things is > problematic: -acb because you need to go to the parser '2' to know about > -c, and you can't filter the arguments and keep -c and give -b to > parser1 again, *BECAUSE* 'b' could also be -c argument.
Sure you can. You just rewrite the arguments themselves.
That said, anybody who doesn't use parse_options() right now won't be accepting something like "-abc" *anyway*, and people currently need to use "-a -b -c".
> int (*parse_opt_unknown_cb)(int shortopt, const char *longopt, > const char *value, void *priv);
This doesn't really change anything. It just makes it harder to write a simple partial parser. Just passing in "IGNORE_UNKNOWN" (and probably "STOP_AT_UNKNOWN") is the simplest way to have multiple passes.
Linus