Lines Matching refs:opts

567 static void print_option_help(const struct option *opts, int full)  in print_option_help()  argument
572 if (opts->type == OPTION_GROUP) { in print_option_help()
574 if (*opts->help) in print_option_help()
575 fprintf(stderr, "%s\n", opts->help); in print_option_help()
578 if (!full && (opts->flags & PARSE_OPT_HIDDEN)) in print_option_help()
580 if (opts->flags & PARSE_OPT_DISABLED) in print_option_help()
584 if (opts->short_name) in print_option_help()
585 pos += fprintf(stderr, "-%c", opts->short_name); in print_option_help()
589 if (opts->long_name && opts->short_name) in print_option_help()
591 if (opts->long_name) in print_option_help()
592 pos += fprintf(stderr, "--%s", opts->long_name); in print_option_help()
594 switch (opts->type) { in print_option_help()
601 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
602 if (opts->long_name) in print_option_help()
610 if (opts->flags & PARSE_OPT_NOARG) in print_option_help()
614 if (opts->argh) { in print_option_help()
615 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
616 if (opts->long_name) in print_option_help()
617 pos += fprintf(stderr, "[=<%s>]", opts->argh); in print_option_help()
619 pos += fprintf(stderr, "[<%s>]", opts->argh); in print_option_help()
621 pos += fprintf(stderr, " <%s>", opts->argh); in print_option_help()
623 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
624 if (opts->long_name) in print_option_help()
649 fprintf(stderr, "%*s%s\n", pad + USAGE_GAP, "", opts->help); in print_option_help()
673 static struct option *options__order(const struct option *opts) in options__order() argument
676 const struct option *o = opts; in options__order()
679 for (o = opts; o->type != OPTION_END; o++) in options__order()
682 ordered = memdup(opts, sizeof(*o) * (nr_opts + 1)); in options__order()
723 const struct option *opts, int full, in usage_with_options_internal() argument
748 if (opts->type != OPTION_GROUP) in usage_with_options_internal()
751 ordered = options__order(opts); in usage_with_options_internal()
753 opts = ordered; in usage_with_options_internal()
755 for ( ; opts->type != OPTION_END; opts++) { in usage_with_options_internal()
756 if (ctx && ctx->argc > 1 && !option__in_argv(opts, ctx)) in usage_with_options_internal()
758 print_option_help(opts, full); in usage_with_options_internal()
769 const struct option *opts) in usage_with_options() argument
772 usage_with_options_internal(usagestr, opts, 0, NULL); in usage_with_options()
777 const struct option *opts, const char *fmt, ...) in usage_with_options_msg() argument
787 usage_with_options_internal(usagestr, opts, 0, NULL); in usage_with_options_msg()
792 const struct option *opts, in parse_options_usage() argument
810 for ( ; opts->type != OPTION_END; opts++) { in parse_options_usage()
812 if (opts->short_name == *optstr) { in parse_options_usage()
813 print_option_help(opts, 0); in parse_options_usage()
819 if (opts->long_name == NULL) in parse_options_usage()
822 if (!prefixcmp(opts->long_name, optstr)) in parse_options_usage()
823 print_option_help(opts, 0); in parse_options_usage()
825 !prefixcmp(opts->long_name, optstr + 3)) in parse_options_usage()
826 print_option_help(opts, 0); in parse_options_usage()
856 void set_option_flag(struct option *opts, int shortopt, const char *longopt, in set_option_flag() argument
859 for (; opts->type != OPTION_END; opts++) { in set_option_flag()
860 if ((shortopt && opts->short_name == shortopt) || in set_option_flag()
861 (opts->long_name && longopt && in set_option_flag()
862 !strcmp(opts->long_name, longopt))) { in set_option_flag()
863 opts->flags |= flag; in set_option_flag()