summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormillert <>2006-09-22 17:22:05 +0000
committermillert <>2006-09-22 17:22:05 +0000
commit6ea1c04e14cde761e2faac093669b503a7965de7 (patch)
treef0ed47dc5589f380de0d919f9437587a957cea02 /src
parentfa64073760b61d01b343d6fa820c1e1beb8a76eb (diff)
downloadopenbsd-6ea1c04e14cde761e2faac093669b503a7965de7.tar.gz
openbsd-6ea1c04e14cde761e2faac093669b503a7965de7.tar.bz2
openbsd-6ea1c04e14cde761e2faac093669b503a7965de7.zip
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@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/stdlib/getopt_long.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/lib/libc/stdlib/getopt_long.c b/src/lib/libc/stdlib/getopt_long.c
index 41b6cd9f8d..db05a2d5fc 100644
--- a/src/lib/libc/stdlib/getopt_long.c
+++ b/src/lib/libc/stdlib/getopt_long.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getopt_long.c,v 1.20 2005/10/25 15:49:37 jmc Exp $ */ 1/* $OpenBSD: getopt_long.c,v 1.21 2006/09/22 17:22:05 millert Exp $ */
2/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ 2/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */
3 3
4/* 4/*
@@ -457,7 +457,6 @@ start:
457 optarg = NULL; 457 optarg = NULL;
458 if (*place) /* no white space */ 458 if (*place) /* no white space */
459 optarg = place; 459 optarg = place;
460 /* XXX: disable test for :: if PC? (GNU doesn't) */
461 else if (oli[1] != ':') { /* arg not optional */ 460 else if (oli[1] != ':') { /* arg not optional */
462 if (++optind >= nargc) { /* no arg */ 461 if (++optind >= nargc) { /* no arg */
463 place = EMSG; 462 place = EMSG;
@@ -467,14 +466,6 @@ start:
467 return (BADARG); 466 return (BADARG);
468 } else 467 } else
469 optarg = nargv[optind]; 468 optarg = nargv[optind];
470 } else if (!(flags & FLAG_PERMUTE)) {
471 /*
472 * If permutation is disabled, we can accept an
473 * optional arg separated by whitespace so long
474 * as it does not start with a dash (-).
475 */
476 if (optind + 1 < nargc && *nargv[optind + 1] != '-')
477 optarg = nargv[++optind];
478 } 469 }
479 place = EMSG; 470 place = EMSG;
480 ++optind; 471 ++optind;