parseopt: add flag to stop on first non option

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin 2008-02-29 01:45:09 +00:00 committed by Junio C Hamano
parent 363d59df1a
commit a0ec9d25d9
2 changed files with 3 additions and 0 deletions

View File

@ -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;
}

View File

@ -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 {