Browse Source

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>
maint
Johannes Schindelin 17 years ago committed by Junio C Hamano
parent
commit
a0ec9d25d9
  1. 2
      parse-options.c
  2. 1
      parse-options.h

2
parse-options.c

@ -249,6 +249,8 @@ int parse_options(int argc, const char **argv, const struct option *options, @@ -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;
}

1
parse-options.h

@ -18,6 +18,7 @@ enum parse_opt_type { @@ -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 {

Loading…
Cancel
Save