Lines Matching refs:opts

675 static void print_option_help(const struct option *opts, int full)  in print_option_help()  argument
680 if (opts->type == OPTION_GROUP) { in print_option_help()
682 if (*opts->help) in print_option_help()
683 fprintf(stderr, "%s\n", opts->help); in print_option_help()
686 if (!full && (opts->flags & PARSE_OPT_HIDDEN)) in print_option_help()
688 if (opts->flags & PARSE_OPT_DISABLED) in print_option_help()
692 if (opts->short_name) in print_option_help()
693 pos += fprintf(stderr, "-%c", opts->short_name); in print_option_help()
697 if (opts->long_name && opts->short_name) in print_option_help()
699 if (opts->long_name) in print_option_help()
700 pos += fprintf(stderr, "--%s", opts->long_name); in print_option_help()
702 switch (opts->type) { in print_option_help()
709 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
710 if (opts->long_name) in print_option_help()
718 if (opts->flags & PARSE_OPT_NOARG) in print_option_help()
722 if (opts->argh) { in print_option_help()
723 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
724 if (opts->long_name) in print_option_help()
725 pos += fprintf(stderr, "[=<%s>]", opts->argh); in print_option_help()
727 pos += fprintf(stderr, "[<%s>]", opts->argh); in print_option_help()
729 pos += fprintf(stderr, " <%s>", opts->argh); in print_option_help()
731 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
732 if (opts->long_name) in print_option_help()
757 fprintf(stderr, "%*s%s\n", pad + USAGE_GAP, "", opts->help); in print_option_help()
758 if (opts->flags & PARSE_OPT_NOBUILD) in print_option_help()
761 opts->build_opt); in print_option_help()
785 static struct option *options__order(const struct option *opts) in options__order() argument
788 const struct option *o = opts; in options__order()
791 for (o = opts; o->type != OPTION_END; o++) in options__order()
798 memcpy(ordered, opts, len); in options__order()
837 const struct option *opts, int full, in usage_with_options_internal() argument
862 if (opts->type != OPTION_GROUP) in usage_with_options_internal()
865 ordered = options__order(opts); in usage_with_options_internal()
867 opts = ordered; in usage_with_options_internal()
869 for ( ; opts->type != OPTION_END; opts++) { in usage_with_options_internal()
870 if (ctx && ctx->argc > 1 && !option__in_argv(opts, ctx)) in usage_with_options_internal()
872 print_option_help(opts, full); in usage_with_options_internal()
883 const struct option *opts) in usage_with_options() argument
885 usage_with_options_internal(usagestr, opts, 0, NULL); in usage_with_options()
890 const struct option *opts, const char *fmt, ...) in usage_with_options_msg() argument
902 usage_with_options_internal(usagestr, opts, 0, NULL); in usage_with_options_msg()
907 const struct option *opts, in parse_options_usage() argument
925 for ( ; opts->type != OPTION_END; opts++) { in parse_options_usage()
927 if (opts->short_name == *optstr) { in parse_options_usage()
928 print_option_help(opts, 0); in parse_options_usage()
934 if (opts->long_name == NULL) in parse_options_usage()
937 if (strstarts(opts->long_name, optstr)) in parse_options_usage()
938 print_option_help(opts, 0); in parse_options_usage()
940 strstarts(opts->long_name, optstr + 3)) in parse_options_usage()
941 print_option_help(opts, 0); in parse_options_usage()
972 find_option(struct option *opts, int shortopt, const char *longopt) in find_option() argument
974 for (; opts->type != OPTION_END; opts++) { in find_option()
975 if ((shortopt && opts->short_name == shortopt) || in find_option()
976 (opts->long_name && longopt && in find_option()
977 !strcmp(opts->long_name, longopt))) in find_option()
978 return opts; in find_option()
983 void set_option_flag(struct option *opts, int shortopt, const char *longopt, in set_option_flag() argument
986 struct option *opt = find_option(opts, shortopt, longopt); in set_option_flag()
993 void set_option_nobuild(struct option *opts, int shortopt, in set_option_nobuild() argument
998 struct option *opt = find_option(opts, shortopt, longopt); in set_option_nobuild()