|
|
|
@ -130,10 +130,11 @@ void parse_options(int argc, char **argv, const OptionDef *options, |
|
|
|
|
handleoptions = 0; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
po= find_option(options, opt + 1); |
|
|
|
|
if (!po->name && opt[1] == 'n' && opt[2] == 'o') { |
|
|
|
|
opt++; |
|
|
|
|
po= find_option(options, opt); |
|
|
|
|
if (!po->name && opt[0] == 'n' && opt[1] == 'o') { |
|
|
|
|
/* handle 'no' bool option */ |
|
|
|
|
po = find_option(options, opt + 3); |
|
|
|
|
po = find_option(options, opt + 2); |
|
|
|
|
if (!(po->name && (po->flags & OPT_BOOL))) |
|
|
|
|
goto unknown_opt; |
|
|
|
|
bool_val = 0; |
|
|
|
@ -160,13 +161,13 @@ unknown_opt: |
|
|
|
|
} else if (po->flags & OPT_BOOL) { |
|
|
|
|
*po->u.int_arg = bool_val; |
|
|
|
|
} else if (po->flags & OPT_INT) { |
|
|
|
|
*po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX); |
|
|
|
|
*po->u.int_arg = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX); |
|
|
|
|
} else if (po->flags & OPT_INT64) { |
|
|
|
|
*po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX); |
|
|
|
|
*po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX); |
|
|
|
|
} else if (po->flags & OPT_FLOAT) { |
|
|
|
|
*po->u.float_arg = parse_number_or_die(opt+1, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0); |
|
|
|
|
*po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0); |
|
|
|
|
} else if (po->flags & OPT_FUNC2) { |
|
|
|
|
if(po->u.func2_arg(opt+1, arg)<0) |
|
|
|
|
if(po->u.func2_arg(opt, arg)<0) |
|
|
|
|
goto unknown_opt; |
|
|
|
|
} else { |
|
|
|
|
po->u.func_arg(arg); |
|
|
|
|