parse-options: add OPT_BITOP()
[gitweb.git] / parse-options.c
index 779034e1fd86ad7cbd987d859656abd4c3f782d6..62d94ca2e0323c5d543f9290610fdc52c243ca6a 100644 (file)
@@ -109,6 +109,13 @@ static int get_value(struct parse_opt_ctx_t *p,
                        *(int *)opt->value &= ~opt->defval;
                return 0;
 
+       case OPTION_BITOP:
+               if (unset)
+                       BUG("BITOP can't have unset form");
+               *(int *)opt->value &= ~opt->extra;
+               *(int *)opt->value |= opt->defval;
+               return 0;
+
        case OPTION_COUNTUP:
                if (*(int *)opt->value < 0)
                        *(int *)opt->value = 0;