]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[getopt] Accept "--" as an end-of-options marker
authorMarin Hannache <mareo@mareo.fr>
Wed, 2 Nov 2011 00:22:00 +0000 (00:22 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 2 Nov 2011 00:23:57 +0000 (00:23 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/getopt.c

index b67da0c1301a26675751ebe064c96087d84312d5..8a0fa2d08f030eb069806b942a2eade4700573b4 100644 (file)
@@ -239,6 +239,11 @@ int getopt_long ( int argc, char * const argv[], const char *optstring,
 
        /* Check for long options */
        if ( *(opttext++) == '-' ) {
+               /* "--" indicates end of options */
+               if ( *opttext == '\0' ) {
+                       optind++;
+                       return -1;
+               }
                for ( longopt = longopts ; longopt->name ; longopt++ ) {
                        if ( ! match_long_option ( argc, argv, opttext,
                                                   longopt, &option ) )