Undo last two, until I have time to take a good look at the problems.
This commit is contained in:
parent
d1f10f9f74
commit
4dc035fd8a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: getopt.c,v 1.23 2002/06/13 21:18:50 wiz Exp $ */
|
||||
/* $NetBSD: getopt.c,v 1.24 2002/06/21 09:56:33 wiz 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.23 2002/06/13 21:18:50 wiz Exp $");
|
||||
__RCSID("$NetBSD: getopt.c,v 1.24 2002/06/21 09:56:33 wiz Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@ -83,12 +83,12 @@ getopt(nargc, nargv, ostr)
|
||||
|
||||
if (optreset || !*place) { /* update scanning pointer */
|
||||
optreset = 0;
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-'
|
||||
|| place[1] == '\0') {
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
if (*++place == '-' && place[1] == '\0') { /* found "--" */
|
||||
if (place[1] && *++place == '-' /* found "--" */
|
||||
&& place[1] == '\0') {
|
||||
++optind;
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
@ -96,6 +96,12 @@ getopt(nargc, nargv, ostr)
|
||||
} /* option letter okay? */
|
||||
if ((optopt = (int)*place++) == (int)':' ||
|
||||
!(oli = strchr(ostr, optopt))) {
|
||||
/*
|
||||
* if the user didn't specify '-' as an option,
|
||||
* assume it means -1.
|
||||
*/
|
||||
if (optopt == (int)'-')
|
||||
return (-1);
|
||||
if (!*place)
|
||||
++optind;
|
||||
if (opterr && *ostr != ':')
|
||||
|
Loading…
x
Reference in New Issue
Block a user