From be90241ec292ba561562827b2685d2881bc92b5e Mon Sep 17 00:00:00 2001 From: Marin Hannache Date: Wed, 2 Nov 2011 00:22:00 +0000 Subject: [PATCH] [getopt] Accept "--" as an end-of-options marker Signed-off-by: Michael Brown --- src/core/getopt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/getopt.c b/src/core/getopt.c index b67da0c1..8a0fa2d0 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 ) )