• Home
  • Raw
  • Download

Lines Matching refs:opts

699 static void print_option_help(const struct option *opts, int full)  in print_option_help()  argument
704 if (opts->type == OPTION_GROUP) { in print_option_help()
706 if (*opts->help) in print_option_help()
707 fprintf(stderr, "%s\n", opts->help); in print_option_help()
710 if (!full && (opts->flags & PARSE_OPT_HIDDEN)) in print_option_help()
712 if (opts->flags & PARSE_OPT_DISABLED) in print_option_help()
716 if (opts->short_name) in print_option_help()
717 pos += fprintf(stderr, "-%c", opts->short_name); in print_option_help()
721 if (opts->long_name && opts->short_name) in print_option_help()
723 if (opts->long_name) in print_option_help()
724 pos += fprintf(stderr, "--%s", opts->long_name); in print_option_help()
726 switch (opts->type) { in print_option_help()
734 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
735 if (opts->long_name) in print_option_help()
743 if (opts->flags & PARSE_OPT_NOARG) in print_option_help()
747 if (opts->argh) { in print_option_help()
748 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
749 if (opts->long_name) in print_option_help()
750 pos += fprintf(stderr, "[=<%s>]", opts->argh); in print_option_help()
752 pos += fprintf(stderr, "[<%s>]", opts->argh); in print_option_help()
754 pos += fprintf(stderr, " <%s>", opts->argh); in print_option_help()
756 if (opts->flags & PARSE_OPT_OPTARG) in print_option_help()
757 if (opts->long_name) in print_option_help()
782 fprintf(stderr, "%*s%s\n", pad + USAGE_GAP, "", opts->help); in print_option_help()
783 if (opts->flags & PARSE_OPT_NOBUILD) in print_option_help()
786 opts->build_opt); in print_option_help()
810 static struct option *options__order(const struct option *opts) in options__order() argument
813 const struct option *o = opts; in options__order()
816 for (o = opts; o->type != OPTION_END; o++) in options__order()
823 memcpy(ordered, opts, len); in options__order()
862 const struct option *opts, int full, in usage_with_options_internal() argument
887 if (opts->type != OPTION_GROUP) in usage_with_options_internal()
890 ordered = options__order(opts); in usage_with_options_internal()
892 opts = ordered; in usage_with_options_internal()
894 for ( ; opts->type != OPTION_END; opts++) { in usage_with_options_internal()
895 if (ctx && ctx->argc > 1 && !option__in_argv(opts, ctx)) in usage_with_options_internal()
897 print_option_help(opts, full); in usage_with_options_internal()
908 const struct option *opts) in usage_with_options() argument
910 usage_with_options_internal(usagestr, opts, 0, NULL); in usage_with_options()
915 const struct option *opts, const char *fmt, ...) in usage_with_options_msg() argument
927 usage_with_options_internal(usagestr, opts, 0, NULL); in usage_with_options_msg()
932 const struct option *opts, in parse_options_usage() argument
950 for ( ; opts->type != OPTION_END; opts++) { in parse_options_usage()
952 if (opts->short_name == *optstr) { in parse_options_usage()
953 print_option_help(opts, 0); in parse_options_usage()
959 if (opts->long_name == NULL) in parse_options_usage()
962 if (strstarts(opts->long_name, optstr)) in parse_options_usage()
963 print_option_help(opts, 0); in parse_options_usage()
965 strstarts(opts->long_name, optstr + 3)) in parse_options_usage()
966 print_option_help(opts, 0); in parse_options_usage()
997 find_option(struct option *opts, int shortopt, const char *longopt) in find_option() argument
999 for (; opts->type != OPTION_END; opts++) { in find_option()
1000 if ((shortopt && opts->short_name == shortopt) || in find_option()
1001 (opts->long_name && longopt && in find_option()
1002 !strcmp(opts->long_name, longopt))) in find_option()
1003 return opts; in find_option()
1008 void set_option_flag(struct option *opts, int shortopt, const char *longopt, in set_option_flag() argument
1011 struct option *opt = find_option(opts, shortopt, longopt); in set_option_flag()
1018 void set_option_nobuild(struct option *opts, int shortopt, in set_option_nobuild() argument
1023 struct option *opt = find_option(opts, shortopt, longopt); in set_option_nobuild()