Re: [RFC] Re: Convert 'git blame' to parse_options()
- From
Jeff King <peff@peff.net>
- Date
- Jun 23, 2008, 17:15 UTC
- Message-ID
- <20080623171505.GB27265@sigill.intra.peff.net>
- In-Reply-To
- <alpine.LFD.1.10.0806230953550.2926@woody.linux-foundation.org>
On Mon, Jun 23, 2008 at 10:06:52AM -0700, Linus Torvalds wrote:
> You'd start off with argv[] looking like [ "foo" "-b" "-a" ] and then > after calling parse_options with that, depending on whether it has > PARSE_OPT_CONTINUE_ON_UNKNOWN or not, you'd either end up with the "-a" > handled (and argv[] now being just [ "foo" "-b" ]), or if you have
How can that be correct, if you don't know whether "-b" takes an argument?
> PARSE_OPT_STOP_ON_UNKNOWN then parse_options() would return without having > done anything, and expecting you to handle the unknown option first and > then restarting the argument parsing.
That is the only thing that makes sense to me, since the command line has to be parsed left-to-right (because the syntactic function of an element relies on the semantics of the element to its left).
-Peff