Show 34 quoted lines
> +void die_for_incompatible_opts(const char *opt1_name, int opt1, ...)
> {
> - int count = 0;
> + unsigned count = 0;
> const char *options[4];
> + va_list ap;
> +
> + va_start(ap, opt1);
>
> if (opt1)
> options[count++] = opt1_name;
> - if (opt2)
> - options[count++] = opt2_name;
> - if (opt3)
> - options[count++] = opt3_name;
> - if (opt4)
> - options[count++] = opt4_name;
> + while (count < ARRAY_SIZE(options)) {
> + const char *name = va_arg(ap, const char *);
> + if (!name)
> + break;
> + if (va_arg(ap, int))
> + options[count++] = name;
> + }
> +
> switch (count) {
> case 4:
> die(_("options '%s', '%s', '%s', and '%s' cannot be used together"),
> - opt1_name, opt2_name, opt3_name, opt4_name);
> + options[0], options[1], options[2], options[3]);
> break;
> case 3:
> die(_("options '%s', '%s', and '%s' cannot be used together"),
> diff --git a/parse-options.h b/parse-options.h