Skip to content

Commit

Permalink
parse-opt: add PARSE_OPT_KEEP_ARGV0 parser option.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pierre Habouzit authored and Junio C Hamano committed Jun 30, 2008
1 parent 26141b5 commit a32a4ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions parse-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions parse-options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a32a4ea

Please sign in to comment.