Lines Matching refs:opts

693 static void print_option_help(const struct option *opts, int full)  in print_option_help()  argument
698 if (opts->type == OPTION_GROUP) { in print_option_help()
700 if (*opts->help) in print_option_help()
701 fprintf(stderr, "%s\n", opts->help); in print_option_help()
704 if (!full && (opts->flags & PARSE_OPT_HIDDEN)) in print_option_help()
706 if (opts->flags & PARSE_OPT_DISABLED) in print_option_help()
710 if (opts->short_name) in print_option_help()
711 pos += fprintf(stderr, "-%c", opts->short_name); in print_option_help()
715 if (opts->long_name && opts->short_name) in print_option_help()
717 if (opts->long_name) in print_option_help()
718 pos += fprintf(stderr, "--%s", opts->long_name); in print_option_help()
720 switch (opts->type) { in print_option_help()
728 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
729 if (opts->long_name) in print_option_help()
737 if (opts->flags & PARSE_OPT_NOARG) in print_option_help()
741 if (opts->argh) { in print_option_help()
742 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
743 if (opts->long_name) in print_option_help()
744 pos += fprintf(stderr, "[=<%s>]", opts->argh); in print_option_help()
746 pos += fprintf(stderr, "[<%s>]", opts->argh); in print_option_help()
748 pos += fprintf(stderr, " <%s>", opts->argh); in print_option_help()
750 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
751 if (opts->long_name) in print_option_help()
776 fprintf(stderr, "%*s%s\n", pad + USAGE_GAP, "", opts->help); in print_option_help()
777 if (opts->flags & PARSE_OPT_NOBUILD) in print_option_help()
780 opts->build_opt); in print_option_help()
804 static struct option *options__order(const struct option *opts) in options__order() argument
807 const struct option *o = opts; in options__order()
810 for (o = opts; o->type != OPTION_END; o++) in options__order()
817 memcpy(ordered, opts, len); in options__order()
856 const struct option *opts, int full, in usage_with_options_internal() argument
881 if (opts->type != OPTION_GROUP) in usage_with_options_internal()
884 ordered = options__order(opts); in usage_with_options_internal()
886 opts = ordered; in usage_with_options_internal()
888 for ( ; opts->type != OPTION_END; opts++) { in usage_with_options_internal()
889 if (ctx && ctx->argc > 1 && !option__in_argv(opts, ctx)) in usage_with_options_internal()
891 print_option_help(opts, full); in usage_with_options_internal()
902 const struct option *opts) in usage_with_options() argument
904 usage_with_options_internal(usagestr, opts, 0, NULL); in usage_with_options()
909 const struct option *opts, const char *fmt, ...) in usage_with_options_msg() argument
921 usage_with_options_internal(usagestr, opts, 0, NULL); in usage_with_options_msg()
926 const struct option *opts, in parse_options_usage() argument
944 for ( ; opts->type != OPTION_END; opts++) { in parse_options_usage()
946 if (opts->short_name == *optstr) { in parse_options_usage()
947 print_option_help(opts, 0); in parse_options_usage()
953 if (opts->long_name == NULL) in parse_options_usage()
956 if (strstarts(opts->long_name, optstr)) in parse_options_usage()
957 print_option_help(opts, 0); in parse_options_usage()
959 strstarts(opts->long_name, optstr + 3)) in parse_options_usage()
960 print_option_help(opts, 0); in parse_options_usage()
991 find_option(struct option *opts, int shortopt, const char *longopt) in find_option() argument
993 for (; opts->type != OPTION_END; opts++) { in find_option()
994 if ((shortopt && opts->short_name == shortopt) || in find_option()
995 (opts->long_name && longopt && in find_option()
996 !strcmp(opts->long_name, longopt))) in find_option()
997 return opts; in find_option()
1002 void set_option_flag(struct option *opts, int shortopt, const char *longopt, in set_option_flag() argument
1005 struct option *opt = find_option(opts, shortopt, longopt); in set_option_flag()
1012 void set_option_nobuild(struct option *opts, int shortopt, in set_option_nobuild() argument
1017 struct option *opt = find_option(opts, shortopt, longopt); in set_option_nobuild()