| 346 | }; |
| 347 | |
| 348 | static void build_cmdmode_list(struct parse_opt_ctx_t *ctx, |
| 349 | const struct option *opts) |
| 350 | { |
| 351 | ctx->cmdmode_list = NULL; |
| 352 | |
| 353 | for (; opts->type != OPTION_END; opts++) { |
| 354 | struct parse_opt_cmdmode_list *elem = ctx->cmdmode_list; |
| 355 | void *value_ptr = opts->value; |
| 356 | |
| 357 | if (!(opts->flags & PARSE_OPT_CMDMODE) || !value_ptr) |
| 358 | continue; |
| 359 | |
| 360 | while (elem && elem->value_ptr != value_ptr) |
| 361 | elem = elem->next; |
| 362 | if (elem) |
| 363 | continue; |
| 364 | |
| 365 | CALLOC_ARRAY(elem, 1); |
| 366 | elem->value_ptr = value_ptr; |
| 367 | elem->precision = opts->precision; |
| 368 | if (do_get_int_value(value_ptr, opts->precision, &elem->value)) |
| 369 | optbug(opts, "has invalid precision"); |
| 370 | elem->next = ctx->cmdmode_list; |
| 371 | ctx->cmdmode_list = elem; |
| 372 | } |
| 373 | BUG_if_bug("invalid 'struct option'"); |
| 374 | } |
| 375 | |
| 376 | static char *optnamearg(const struct option *opt, const char *arg, |
| 377 | enum opt_parsed flags) |
no test coverage detected