summaryrefslogtreecommitdiff
path: root/parse-options.h
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2009-05-07 21:45:08 +0200
committerJunio C Hamano <gitster@pobox.com>2009-05-09 00:29:47 -0700
commite0319ff5ed2b7927302389181449dcd029a26622 (patch)
tree5185c782d22d57ce359f0493bc26aa5ac5215c77 /parse-options.h
parent2f4b97f91071f5060bf2da482cf8b0d70486d808 (diff)
downloadgit-e0319ff5ed2b7927302389181449dcd029a26622.tar.gz
parseopt: add OPT_NUMBER_CALLBACK
Add a way to recognize numerical options. The number is passed to a callback function as a string. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.h')
-rw-r--r--parse-options.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/parse-options.h b/parse-options.h
index f1e2452f69..77919a77fb 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -6,6 +6,7 @@ enum parse_opt_type {
OPTION_END,
OPTION_ARGUMENT,
OPTION_GROUP,
+ OPTION_NUMBER,
/* options with no arguments */
OPTION_BIT,
OPTION_NEGBIT,
@@ -105,6 +106,9 @@ struct option {
parse_opt_approxidate_cb }
#define OPT_CALLBACK(s, l, v, a, h, f) \
{ OPTION_CALLBACK, (s), (l), (v), (a), (h), 0, (f) }
+#define OPT_NUMBER_CALLBACK(v, h, f) \
+ { OPTION_NUMBER, 0, NULL, (v), NULL, (h), \
+ PARSE_OPT_NOARG | PARSE_OPT_NONEG, (f) }
/* parse_options() will filter out the processed options and leave the
* non-option arguments in argv[].