Lines Matching defs:opts

589 		if (!strcmp(arg, "list-opts"))
696 static void print_option_help(const struct option *opts, int full)
701 if (opts->type == OPTION_GROUP) {
703 if (*opts->help)
704 fprintf(stderr, "%s\n", opts->help);
707 if (!full && (opts->flags & PARSE_OPT_HIDDEN))
709 if (opts->flags & PARSE_OPT_DISABLED)
713 if (opts->short_name)
714 pos += fprintf(stderr, "-%c", opts->short_name);
718 if (opts->long_name && opts->short_name)
720 if (opts->long_name)
721 pos += fprintf(stderr, "--%s", opts->long_name);
723 switch (opts->type) {
731 if (opts->flags & PARSE_OPT_OPTARG)
732 if (opts->long_name)
740 if (opts->flags & PARSE_OPT_NOARG)
744 if (opts->argh) {
745 if (opts->flags & PARSE_OPT_OPTARG)
746 if (opts->long_name)
747 pos += fprintf(stderr, "[=<%s>]", opts->argh);
749 pos += fprintf(stderr, "[<%s>]", opts->argh);
751 pos += fprintf(stderr, " <%s>", opts->argh);
753 if (opts->flags & PARSE_OPT_OPTARG)
754 if (opts->long_name)
779 fprintf(stderr, "%*s%s\n", pad + USAGE_GAP, "", opts->help);
780 if (opts->flags & PARSE_OPT_NOBUILD)
783 opts->build_opt);
807 static struct option *options__order(const struct option *opts)
810 const struct option *o = opts;
813 for (o = opts; o->type != OPTION_END; o++)
820 memcpy(ordered, opts, len);
870 const struct option *opts, int full,
895 if (opts->type != OPTION_GROUP)
898 ordered = options__order(opts);
900 opts = ordered;
902 for ( ; opts->type != OPTION_END; opts++) {
903 if (ctx && ctx->argc > 1 && !option__in_argv(opts, ctx))
905 print_option_help(opts, full);
916 const struct option *opts)
918 usage_with_options_internal(usagestr, opts, 0, NULL);
923 const struct option *opts, const char *fmt, ...)
935 usage_with_options_internal(usagestr, opts, 0, NULL);
940 const struct option *opts,
958 for ( ; opts->type != OPTION_END; opts++) {
960 if (opts->short_name == *optstr) {
961 print_option_help(opts, 0);
967 if (opts->long_name == NULL)
970 if (strstarts(opts->long_name, optstr))
971 print_option_help(opts, 0);
973 strstarts(opts->long_name, optstr + 3))
974 print_option_help(opts, 0);
1005 find_option(struct option *opts, int shortopt, const char *longopt)
1007 for (; opts->type != OPTION_END; opts++) {
1008 if ((shortopt && opts->short_name == shortopt) ||
1009 (opts->long_name && longopt &&
1010 !strcmp(opts->long_name, longopt)))
1011 return opts;
1016 void set_option_flag(struct option *opts, int shortopt, const char *longopt,
1019 struct option *opt = find_option(opts, shortopt, longopt);
1026 void set_option_nobuild(struct option *opts, int shortopt,
1031 struct option *opt = find_option(opts, shortopt, longopt);