From: Johannes Schindelin Date: Fri, 29 Feb 2008 01:45:09 +0000 (+0000) Subject: parseopt: add flag to stop on first non option X-Git-Tag: v1.5.5-rc0~24^2~7 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a0ec9d25d9f1c1469ec375169557a1c17d486993;p=git.git parseopt: add flag to stop on first non option Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- diff --git a/parse-options.c b/parse-options.c index d9562ba50..be35785ce 100644 --- a/parse-options.c +++ b/parse-options.c @@ -249,6 +249,8 @@ int parse_options(int argc, const char **argv, const struct option *options, const char *arg = args.argv[0]; if (*arg != '-' || !arg[1]) { + if (flags & PARSE_OPT_STOP_AT_NON_OPTION) + break; argv[j++] = args.argv[0]; continue; } diff --git a/parse-options.h b/parse-options.h index 102ac31fb..0d40cd2f1 100644 --- a/parse-options.h +++ b/parse-options.h @@ -18,6 +18,7 @@ enum parse_opt_type { enum parse_opt_flags { PARSE_OPT_KEEP_DASHDASH = 1, + PARSE_OPT_STOP_AT_NON_OPTION = 2, }; enum parse_opt_option_flags {