Message ID | 20190122002635.9411-2-pclouds@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | nd/diff-parseopt fixups | expand |
diff --git a/parse-options.c b/parse-options.c index a0ff8ea225..cec74522e5 100644 --- a/parse-options.c +++ b/parse-options.c @@ -466,6 +466,10 @@ void parse_options_start(struct parse_opt_ctx_t *ctx, ctx->prefix = prefix; ctx->cpidx = ((flags & PARSE_OPT_KEEP_ARGV0) != 0); ctx->flags = flags; + if ((flags & PARSE_OPT_KEEP_UNKNOWN) && + (flags & PARSE_OPT_STOP_AT_NON_OPTION) && + !(flags & PARSE_OPT_ONE_SHOT)) + BUG("STOP_AT_NON_OPTION and KEEP_UNKNOWN don't go together"); if ((flags & PARSE_OPT_ONE_SHOT) && (flags & PARSE_OPT_KEEP_ARGV0)) BUG("Can't keep argv0 if you don't have it");