hc
2024-10-16 50a212ec906f7524620675f0c57357691c26c81f
kernel/tools/lib/subcmd/parse-options.h
....@@ -25,6 +25,7 @@
2525 OPTION_STRING,
2626 OPTION_INTEGER,
2727 OPTION_LONG,
28
+ OPTION_ULONG,
2829 OPTION_CALLBACK,
2930 OPTION_U64,
3031 OPTION_UINTEGER,
....@@ -70,7 +71,7 @@
7071 *
7172 * `argh`::
7273 * token to explain the kind of argument this option wants. Keep it
73
- * homogenous across the repository.
74
+ * homogeneous across the repository.
7475 *
7576 * `help`::
7677 * the short help associated to what the option does.
....@@ -79,7 +80,7 @@
7980 *
8081 * `flags`::
8182 * mask of parse_opt_option_flags.
82
- * PARSE_OPT_OPTARG: says that the argument is optionnal (not for BOOLEANs)
83
+ * PARSE_OPT_OPTARG: says that the argument is optional (not for BOOLEANs)
8384 * PARSE_OPT_NOARG: says that this option takes no argument, for CALLBACKs
8485 * PARSE_OPT_NONEG: says that this option cannot be negated
8586 * PARSE_OPT_HIDDEN this option is skipped in the default usage, showed in
....@@ -133,6 +134,7 @@
133134 #define OPT_INTEGER(s, l, v, h) { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, int *), .help = (h) }
134135 #define OPT_UINTEGER(s, l, v, h) { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h) }
135136 #define OPT_LONG(s, l, v, h) { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, long *), .help = (h) }
137
+#define OPT_ULONG(s, l, v, h) { .type = OPTION_ULONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned long *), .help = (h) }
136138 #define OPT_U64(s, l, v, h) { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, u64 *), .help = (h) }
137139 #define OPT_STRING(s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), .argh = (a), .help = (h) }
138140 #define OPT_STRING_OPTARG(s, l, v, a, h, d) \
....@@ -149,6 +151,8 @@
149151 { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = "time", .help = (h), .callback = parse_opt_approxidate_cb }
150152 #define OPT_CALLBACK(s, l, v, a, h, f) \
151153 { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = (a), .help = (h), .callback = (f) }
154
+#define OPT_CALLBACK_SET(s, l, v, os, a, h, f) \
155
+ { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = (a), .help = (h), .callback = (f), .set = check_vtype(os, bool *)}
152156 #define OPT_CALLBACK_NOOPT(s, l, v, a, h, f) \
153157 { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = (a), .help = (h), .callback = (f), .flags = PARSE_OPT_NOARG }
154158 #define OPT_CALLBACK_DEFAULT(s, l, v, a, h, f, d) \