From: Marin Hannache Date: Wed, 2 Nov 2011 00:22:00 +0000 (+0000) Subject: [getopt] Accept "--" as an end-of-options marker X-Git-Tag: v1.20.1~2057 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be90241ec292ba561562827b2685d2881bc92b5e;p=thirdparty%2Fipxe.git [getopt] Accept "--" as an end-of-options marker Signed-off-by: Michael Brown --- diff --git a/src/core/getopt.c b/src/core/getopt.c index b67da0c13..8a0fa2d08 100644 --- a/src/core/getopt.c +++ b/src/core/getopt.c @@ -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 ) )