git.99rst.org
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
26141b5
)
parse-opt: add PARSE_OPT_KEEP_ARGV0 parser option.
author
Pierre Habouzit
<redacted>
Mon, 23 Jun 2008 22:31:31 +0000
(
00:31
+0200)
committer
Junio C Hamano
<redacted>
Mon, 30 Jun 2008 21:51:13 +0000
(14:51 -0700)
This way, argv[0] isn't clobbered when parse-options filters argv[].
Signed-off-by: Pierre Habouzit <redacted>
Signed-off-by: Junio C Hamano <redacted>
parse-options.c
patch
|
blob
|
history
parse-options.h
patch
|
blob
|
history
diff --git
a/parse-options.c
b/parse-options.c
index 0d3818ab4884e1df51d5e082df2a1e80d2582cdd..469831d21b99e2ea6d5d0be51555d853d68a7682 100644
(file)
--- 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 aeed627e9757df03df94a2c93bbd8112f4bb9a2c..c5f0b4b4dabb5a40027c0cc588549904e0efcc6f 100644
(file)
--- 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 {
git clone https://git.99rst.org/PROJECT