path: root/Documentation/technical/api-parse-options.txt
diff options
authorJunio C Hamano <>2009-05-23 08:38:32 (GMT)
committerJunio C Hamano <>2009-05-23 08:38:32 (GMT)
commit104d3794481c83f8db00ccf85134fc55c76852f9 (patch)
treeddd0c863652be1ecade06d66bca1e8eb5fb37409 /Documentation/technical/api-parse-options.txt
parent9d764f9538f63d654a1147e11920c2bc36b75194 (diff)
parentff3c7f9a264da41a2cd7b7a28a27f8ad935b81a9 (diff)
Merge branch 'rs/grep-parseopt'
* rs/grep-parseopt: grep: make callback functions static grep: use parseopt grep: remove global variable builtin_grep parseopt: add PARSE_OPT_NODASH parseopt: add OPT_NUMBER_CALLBACK parseopt: add OPT_NEGBIT
Diffstat (limited to 'Documentation/technical/api-parse-options.txt')
1 files changed, 12 insertions, 0 deletions
diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
index e30c602..b43458e 100644
--- a/Documentation/technical/api-parse-options.txt
+++ b/Documentation/technical/api-parse-options.txt
@@ -137,6 +137,10 @@ There are some macros to easily define options:
Introduce a boolean option.
If used, `int_var` is bitwise-ored with `mask`.
+`OPT_NEGBIT(short, long, &int_var, description, mask)`::
+ Introduce a boolean option.
+ If used, `int_var` is bitwise-anded with the inverted `mask`.
`OPT_SET_INT(short, long, &int_var, description, integer)`::
Introduce a boolean option.
If used, set `int_var` to `integer`.
@@ -166,6 +170,14 @@ There are some macros to easily define options:
`OPT_ARGUMENT(long, description)`::
Introduce a long-option argument that will be kept in `argv[]`.
+`OPT_NUMBER_CALLBACK(&var, description, func_ptr)`::
+ Recognize numerical options like -123 and feed the integer as
+ if it was an argument to the function given by `func_ptr`.
+ The result will be put into `var`. There can be only one such
+ option definition. It cannot be negated and it takes no
+ arguments. Short options that happen to be digits take
+ precedence over it.
The last element of the array must be `OPT_END()`.