1003.2-92 specifies the string "--" to be recognized as the option list

delimiter as opposed to any string merely beginning with '-''-'; change to
match the standard.  From Simon J. Gerraty <sjg@quick.com.au> in PR lib/6762.
This commit is contained in:
kleink 1999-01-09 20:31:07 +00:00
parent 33df770bf5
commit 2125814fb5
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: getopt.c,v 1.12 1998/02/03 01:30:17 perry Exp $ */
/* $NetBSD: getopt.c,v 1.13 1999/01/09 20:31:07 kleink Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
#else
__RCSID("$NetBSD: getopt.c,v 1.12 1998/02/03 01:30:17 perry Exp $");
__RCSID("$NetBSD: getopt.c,v 1.13 1999/01/09 20:31:07 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -82,7 +82,8 @@ getopt(nargc, nargv, ostr)
place = EMSG;
return (-1);
}
if (place[1] && *++place == '-') { /* found "--" */
if (place[1] && *++place == '-' /* found "--" */
&& place[1] == '\0') {
++optind;
place = EMSG;
return (-1);