Re: [RFC] Re: Convert 'git blame' to parse_options()
On Mon, Jun 23, 2008 at 11:51:52PM +0000, Junio C Hamano wrote:
Show 11 quoted lines
> Pierre Habouzit <madcoder@debian.org> writes:
>
> > Unrelated but worth to note: many parse_options users just don't care
> > about argv[0] and having it kept each time would rather be a pain for
> > them (they would need to call argv++, argc-- themselves).
>
> Not necessarily. If they were parsing by hand, they were written to deal
> with the fact that argv[0] is not the program argument (iow, they start
> counting from one). And before and after calling parse_options(), they
> need to change that assumption anyway, because parse_options() makes
> argv[0] disappear.
Sure, but for _some_ commands it's easier not having to argv++,
argc--. The patch I sent just allow the caller to ask parse_options to
keep argv[0] in place or not, so that one can cascade parsers if wanted.
Note that with the series I sent, it's less useful to cascade option
parser, you rather mix more of them in your step by step parser. But oh
well, it's a useful feature anyways. We can even make it default, my
sole concern what that NULL-terminated thing, and now that I know we can
count on it, then, well, I absolutely don't care :)
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org