From: Jean-Michel Vourgère Date: Sat, 31 Oct 2015 09:52:43 +0000 (+0100) Subject: Add/fix dashdash support in optparse_long X-Git-Tag: v1.6.0~25^2~4^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1da51d89dbc160d875b1406e3dc735acfdf9142c;p=thirdparty%2Frrdtool-1.x.git Add/fix dashdash support in optparse_long This changes the behaviour of optparse_long so that a '--' tags the end of options, just like optparse and getopt_long. --- diff --git a/src/optparse.c b/src/optparse.c index f6fb7e77..0460cb66 100644 --- a/src/optparse.c +++ b/src/optparse.c @@ -214,6 +214,9 @@ optparse_long(struct optparse *options, char *option = options_argv(options->optind); if (option == NULL) { return -1; + } else if (is_dashdash(option)) { + options->optind++; // consume "--" + return -1; } else if (is_shortopt(option)) { return long_fallback(options, longopts, longindex); } else if (!is_longopt(option)) {