From: Linus Torvalds Date: Mon, 23 Jun 2008 16:11:50 GMT Subject: Re: [RFC] Re: Convert 'git blame' to parse_options() Message-ID: In-Reply-To: <20080623082223.GA12130@artemis.madism.org> On Mon, 23 Jun 2008, Pierre Habouzit wrote: > > 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