From 16d880ef5fbd6f3fe02192a02e5cfd451a752ca9 Mon Sep 17 00:00:00 2001 From: millert <> Date: Fri, 22 Sep 2006 17:22:05 +0000 Subject: [PATCH] Back out change in rev 1.15 of to allow whitespace to separate a flag from its optional argument if permutation is disabled. The idea was that since "r:" would match "-r foo" then "r::" should match "-r foo" too as long as we know that things have not been reshuffled. Unfortunately, this causes incompatibilities with GNU getopt_long when the POSIXLY_CORRECT environment variable is set. OK deraadt@ --- src/lib/libc/stdlib/getopt_long.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/lib/libc/stdlib/getopt_long.c b/src/lib/libc/stdlib/getopt_long.c index 41b6cd9f..db05a2d5 100644 --- a/src/lib/libc/stdlib/getopt_long.c +++ b/src/lib/libc/stdlib/getopt_long.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getopt_long.c,v 1.20 2005/10/25 15:49:37 jmc Exp $ */ +/* $OpenBSD: getopt_long.c,v 1.21 2006/09/22 17:22:05 millert Exp $ */ /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ /* @@ -457,7 +457,6 @@ start: optarg = NULL; if (*place) /* no white space */ optarg = place; - /* XXX: disable test for :: if PC? (GNU doesn't) */ else if (oli[1] != ':') { /* arg not optional */ if (++optind >= nargc) { /* no arg */ place = EMSG; @@ -467,14 +466,6 @@ start: return (BADARG); } else optarg = nargv[optind]; - } else if (!(flags & FLAG_PERMUTE)) { - /* - * If permutation is disabled, we can accept an - * optional arg separated by whitespace so long - * as it does not start with a dash (-). - */ - if (optind + 1 < nargc && *nargv[optind + 1] != '-') - optarg = nargv[++optind]; } place = EMSG; ++optind;