]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Add/fix dashdash support in optparse_long
authorJean-Michel Vourgère <nirgal@debian.org>
Sat, 31 Oct 2015 09:52:43 +0000 (10:52 +0100)
committerJean-Michel Vourgère <nirgal@debian.org>
Sat, 31 Oct 2015 09:58:01 +0000 (10:58 +0100)
This changes the behaviour of optparse_long so that a '--' tags the end of
options, just like optparse and getopt_long.

src/optparse.c

index f6fb7e777ebd1f3c99133ae8f6895804e5e55fc2..0460cb6669cfd38c29036d9b2e372f2a5bce5042 100644 (file)
@@ -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)) {