From: Pierre Habouzit Date: Mon, 23 Jun 2008 22:31:31 +0000 (+0200) Subject: parse-opt: add PARSE_OPT_KEEP_ARGV0 parser option. X-Git-Tag: v1.6.0-rc0~66^2~7 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a32a4eaa36527ab1c9a999357f9edd5e04591a4a;p=git.git parse-opt: add PARSE_OPT_KEEP_ARGV0 parser option. This way, argv[0] isn't clobbered when parse-options filters argv[]. Signed-off-by: Pierre Habouzit Signed-off-by: Junio C Hamano --- diff --git a/parse-options.c b/parse-options.c index 0d3818ab4..469831d21 100644 --- a/parse-options.c +++ b/parse-options.c @@ -248,6 +248,7 @@ void parse_options_start(struct parse_opt_ctx_t *ctx, ctx->argc = argc - 1; ctx->argv = argv + 1; ctx->out = argv; + ctx->cpidx = ((flags & PARSE_OPT_KEEP_ARGV0) != 0); ctx->flags = flags; } diff --git a/parse-options.h b/parse-options.h index aeed627e9..c5f0b4b4d 100644 --- a/parse-options.h +++ b/parse-options.h @@ -20,6 +20,7 @@ enum parse_opt_type { enum parse_opt_flags { PARSE_OPT_KEEP_DASHDASH = 1, PARSE_OPT_STOP_AT_NON_OPTION = 2, + PARSE_OPT_KEEP_ARGV0 = 4, }; enum parse_opt_option_flags {