Lines Matching refs:opts

560 static void print_option_help(const struct option *opts, int full)  in print_option_help()  argument
565 if (opts->type == OPTION_GROUP) { in print_option_help()
567 if (*opts->help) in print_option_help()
568 fprintf(stderr, "%s\n", opts->help); in print_option_help()
571 if (!full && (opts->flags & PARSE_OPT_HIDDEN)) in print_option_help()
573 if (opts->flags & PARSE_OPT_DISABLED) in print_option_help()
577 if (opts->short_name) in print_option_help()
578 pos += fprintf(stderr, "-%c", opts->short_name); in print_option_help()
582 if (opts->long_name && opts->short_name) in print_option_help()
584 if (opts->long_name) in print_option_help()
585 pos += fprintf(stderr, "--%s", opts->long_name); in print_option_help()
587 switch (opts->type) { in print_option_help()
594 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
595 if (opts->long_name) in print_option_help()
603 if (opts->flags & PARSE_OPT_NOARG) in print_option_help()
607 if (opts->argh) { in print_option_help()
608 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
609 if (opts->long_name) in print_option_help()
610 pos += fprintf(stderr, "[=<%s>]", opts->argh); in print_option_help()
612 pos += fprintf(stderr, "[<%s>]", opts->argh); in print_option_help()
614 pos += fprintf(stderr, " <%s>", opts->argh); in print_option_help()
616 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
617 if (opts->long_name) in print_option_help()
642 fprintf(stderr, "%*s%s\n", pad + USAGE_GAP, "", opts->help); in print_option_help()
646 const struct option *opts, int full) in usage_with_options_internal() argument
661 if (opts->type != OPTION_GROUP) in usage_with_options_internal()
664 for ( ; opts->type != OPTION_END; opts++) in usage_with_options_internal()
665 print_option_help(opts, full); in usage_with_options_internal()
673 const struct option *opts) in usage_with_options() argument
676 usage_with_options_internal(usagestr, opts, 0); in usage_with_options()
681 const struct option *opts, in parse_options_usage() argument
699 for ( ; opts->type != OPTION_END; opts++) { in parse_options_usage()
701 if (opts->short_name == *optstr) in parse_options_usage()
706 if (opts->long_name == NULL) in parse_options_usage()
709 if (!prefixcmp(optstr, opts->long_name)) in parse_options_usage()
712 !prefixcmp(optstr + 3, opts->long_name)) in parse_options_usage()
716 if (opts->type != OPTION_END) in parse_options_usage()
717 print_option_help(opts, 0); in parse_options_usage()
746 void set_option_flag(struct option *opts, int shortopt, const char *longopt, in set_option_flag() argument
749 for (; opts->type != OPTION_END; opts++) { in set_option_flag()
750 if ((shortopt && opts->short_name == shortopt) || in set_option_flag()
751 (opts->long_name && longopt && in set_option_flag()
752 !strcmp(opts->long_name, longopt))) { in set_option_flag()
753 opts->flags |= flag; in set_option_flag()