From 1da51d89dbc160d875b1406e3dc735acfdf9142c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Michel=20Vourg=C3=A8re?= Date: Sat, 31 Oct 2015 10:52:43 +0100 Subject: [PATCH] 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. --- src/optparse.c | 3 +++ 1 file changed, 3 insertions(+) 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)) { -- 2.47.2