Merge branch 'rs/grep-parseopt'
authorJunio C Hamano <gitster@pobox.com>
Sat, 23 May 2009 08:38:32 +0000 (01:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 23 May 2009 08:38:32 +0000 (01:38 -0700)
* 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

1  2 
Documentation/technical/api-parse-options.txt
index e30c602f476da2da632d2cd04396d168c80ab233,beca98d7542be8a63ece24cc91ec979742d518f9..b43458eae6787caab163fadab113dff61e577498
@@@ -137,6 -137,10 +137,10 @@@ There are some macros to easily define 
        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`.
  `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()`.
  
@@@ -198,7 -210,7 +210,7 @@@ The function must be defined in this fo
  
  The callback mechanism is as follows:
  
 -* Inside `funct`, the only interesting member of the structure
 +* Inside `func`, the only interesting member of the structure
    given by `opt` is the void pointer `opt->value`.
    `\*opt->value` will be the value that is saved into `var`, if you
    use `OPT_CALLBACK()`.