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 <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pierre Habouzit committed
Jun 24, 2008 at 00:31 UTC
a32a4eaa36527ab1c9a999357f9edd5e04591a4a
2 files changed
+2
parse-options.c
+1
@@ -248,6 +248,7 @@ void parse_options_start(struct parse_opt_ctx_t *ctx,
248
ctx->argc = argc - 1;
249
ctx->argv = argv + 1;
250
ctx->out = argv;
251
+ ctx->cpidx = ((flags & PARSE_OPT_KEEP_ARGV0) != 0);
252
ctx->flags = flags;
253
}
254
parse-options.h
+1
@@ -20,6 +20,7 @@ enum parse_opt_type {
20
enum parse_opt_flags {
21
PARSE_OPT_KEEP_DASHDASH = 1,
22
PARSE_OPT_STOP_AT_NON_OPTION = 2,
23
+ PARSE_OPT_KEEP_ARGV0 = 4,
24
};
25
26
enum parse_opt_option_flags {