cmdutils: remove OPT_FUNC2

Make ff* tools only accept opt_* functions taking two arguments.

The distinction between functions with one and two arguments is quite
pointless. Simplify parse_options() code.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
This commit is contained in:
Stefano Sabatini
2011-05-28 01:53:00 +02:00
committed by Ronald S. Bultje
parent 009f829dde
commit 26513856d6
6 changed files with 144 additions and 129 deletions

View File

@@ -277,13 +277,11 @@ unknown_opt:
*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, arg, OPT_FLOAT, -INFINITY, INFINITY);
} else if (po->flags & OPT_FUNC2) {
if (po->u.func2_arg(opt, arg) < 0) {
} else {
if (po->u.func_arg(opt, arg) < 0) {
fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);
exit(1);
}
} else if (po->u.func_arg) {
po->u.func_arg(arg);
}
if(po->flags & OPT_EXIT)
exit(0);