Lines Matching defs:opts

627 		if (!strcmp(arg, "list-opts"))
734 static void print_option_help(const struct option *opts, int full)
739 if (opts->type == OPTION_GROUP) {
741 if (*opts->help)
742 fprintf(stderr, "%s\n", opts->help);
745 if (!full && (opts->flags & PARSE_OPT_HIDDEN))
747 if (opts->flags & PARSE_OPT_DISABLED)
751 if (opts->short_name)
752 pos += fprintf(stderr, "-%c", opts->short_name);
756 if (opts->long_name && opts->short_name)
758 if (opts->long_name)
759 pos += fprintf(stderr, "--%s", opts->long_name);
761 switch (opts->type) {
769 if (opts->flags & PARSE_OPT_OPTARG)
770 if (opts->long_name)
778 if (opts->flags & PARSE_OPT_NOARG)
782 if (opts->argh) {
783 if (opts->flags & PARSE_OPT_OPTARG)
784 if (opts->long_name)
785 pos += fprintf(stderr, "[=<%s>]", opts->argh);
787 pos += fprintf(stderr, "[<%s>]", opts->argh);
789 pos += fprintf(stderr, " <%s>", opts->argh);
791 if (opts->flags & PARSE_OPT_OPTARG)
792 if (opts->long_name)
817 fprintf(stderr, "%*s%s\n", pad + USAGE_GAP, "", opts->help);
818 if (opts->flags & PARSE_OPT_NOBUILD)
821 opts->build_opt);
845 static struct option *options__order(const struct option *opts)
848 const struct option *o = NULL, *p = opts;
852 for (p = opts; p != NULL; p = o->parent) {
920 const struct option *opts, int full,
945 if (opts->type != OPTION_GROUP)
948 ordered = options__order(opts);
950 opts = ordered;
952 for ( ; opts->type != OPTION_END; opts++) {
953 if (ctx && ctx->argc > 1 && !option__in_argv(opts, ctx))
955 print_option_help(opts, full);
966 const struct option *opts)
968 usage_with_options_internal(usagestr, opts, 0, NULL);
973 const struct option *opts, const char *fmt, ...)
985 usage_with_options_internal(usagestr, opts, 0, NULL);
990 const struct option *opts,
1008 for ( ; opts->type != OPTION_END; opts++) {
1010 if (opts->short_name == *optstr) {
1011 print_option_help(opts, 0);
1017 if (opts->long_name == NULL)
1020 if (strstarts(opts->long_name, optstr))
1021 print_option_help(opts, 0);
1023 strstarts(opts->long_name, optstr + 3) &&
1024 !(opts->flags & PARSE_OPT_NOAUTONEG))
1025 print_option_help(opts, 0);
1056 find_option(struct option *opts, int shortopt, const char *longopt)
1058 for (; opts->type != OPTION_END; opts++) {
1059 if ((shortopt && opts->short_name == shortopt) ||
1060 (opts->long_name && longopt &&
1061 !strcmp(opts->long_name, longopt)))
1062 return opts;
1067 void set_option_flag(struct option *opts, int shortopt, const char *longopt,
1070 struct option *opt = find_option(opts, shortopt, longopt);
1077 void set_option_nobuild(struct option *opts, int shortopt,
1082 struct option *opt = find_option(opts, shortopt, longopt);