From: Jeff King Date: Fri, 18 Mar 2011 09:54:17 GMT Subject: Re: [PATCH/RFD 0/2] revision.c: --merges, --no-merges and --merges-only Message-ID: <20110318095417.GA18526@sigill.intra.peff.net> In-Reply-To: <4D8328F9.9050100@drmicha.warpmail.net> On Fri, Mar 18, 2011 at 10:42:17AM +0100, Michael J Gruber wrote: > > I saw it, I was just expecting you to start the "D" with some text. :) > > According to my expectation, I get many more responses doing it this way :) Heh, you are just trolling? :) > Maybe you can help me understand this one: > > int parse_opt_tertiary(const struct option *opt, const char *arg, int unset) > { > int *target = opt->value; > *target = unset ? 2 : 1; > return 0; > } > > This is no tri-state, is it? (It's used only for the undocumented > --autoupdate option to rerere.) I guess it's more like unset/yes/no, > which, admittedly, counts to 3, but still. Yeah, it is not what you want. It takes no argument at all, but is a boolean that uses "1" and "2" for "yes" and "no" (with presumably "0" as the "unset" version, though this callback doesn't care). If you want a parse-options example of what you're trying to do, try OPT__COLOR. -Peff