path: root/parse-options.h
diff options
authorStephen Boyd <>2009-05-23 18:53:12 (GMT)
committerJunio C Hamano <>2009-05-25 08:07:25 (GMT)
commit377829201783b8a648e07af6ce7d747e0f45dc19 (patch)
treefe989294bc3d3c8adb2c6d6b8fb7702be7c23acf /parse-options.h
parent3d09e64ac10aab1ae6ae1ac9cce7a6ebb43f2e50 (diff)
parse-opts: prepare for OPT_FILENAME
To give OPT_FILENAME the prefix, we pass the prefix to parse_options() which passes the prefix to parse_options_start() which sets the prefix member of parse_opts_ctx accordingly. If there isn't a prefix in the calling context, passing NULL will suffice. Signed-off-by: Stephen Boyd <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'parse-options.h')
1 files changed, 4 insertions, 2 deletions
diff --git a/parse-options.h b/parse-options.h
index fe41ab2..f652c0f 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -122,7 +122,7 @@ struct option {
* non-option arguments in argv[].
* Returns the number of arguments left in argv[].
-extern int parse_options(int argc, const char **argv,
+extern int parse_options(int argc, const char **argv, const char *prefix,
const struct option *options,
const char * const usagestr[], int flags);
@@ -148,13 +148,15 @@ struct parse_opt_ctx_t {
int argc, cpidx;
const char *opt;
int flags;
+ const char *prefix;
extern int parse_options_usage(const char * const *usagestr,
const struct option *opts);
extern void parse_options_start(struct parse_opt_ctx_t *ctx,
- int argc, const char **argv, int flags);
+ int argc, const char **argv, const char *prefix,
+ int flags);
extern int parse_options_step(struct parse_opt_ctx_t *ctx,
const struct option *options,