From fb8e8fa13147842d7e614acc80f381ae7a697535 Mon Sep 17 00:00:00 2001 From: ache Date: Tue, 6 Jul 2004 13:58:45 +0000 Subject: Keep it sync with OpenBSD: An optional argument cannot start with '-', even if permutation is disabled. Obtained from: OpenBSD getopt_long.c v1.17 --- lib/libc/stdlib/getopt_long.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/libc/stdlib/getopt_long.c b/lib/libc/stdlib/getopt_long.c index 28e24ae..47eab1f 100644 --- a/lib/libc/stdlib/getopt_long.c +++ b/lib/libc/stdlib/getopt_long.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getopt_long.c,v 1.16 2004/02/04 18:17:25 millert Exp $ */ +/* $OpenBSD: getopt_long.c,v 1.17 2004/06/03 18:46:52 millert Exp $ */ /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ /* @@ -571,9 +571,10 @@ start: } else if (!(flags & FLAG_PERMUTE)) { /* * If permutation is disabled, we can accept an - * optional arg separated by whitespace. + * optional arg separated by whitespace so long + * as it does not start with a dash (-). */ - if (optind + 1 < nargc) + if (optind + 1 < nargc && *nargv[optind + 1] != '-') optarg = nargv[++optind]; } place = EMSG; -- cgit v1.1