summaryrefslogtreecommitdiff
path: root/openbsd-compat/getopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/getopt.c')
-rw-r--r--openbsd-compat/getopt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/openbsd-compat/getopt.c b/openbsd-compat/getopt.c
index 4a5cfe5f0..a3fe807ee 100644
--- a/openbsd-compat/getopt.c
+++ b/openbsd-compat/getopt.c
@@ -35,7 +35,7 @@
35#if !defined(HAVE_GETOPT) || !defined(HAVE_GETOPT_OPTRESET) 35#if !defined(HAVE_GETOPT) || !defined(HAVE_GETOPT_OPTRESET)
36 36
37#if defined(LIBC_SCCS) && !defined(lint) 37#if defined(LIBC_SCCS) && !defined(lint)
38static char *rcsid = "$OpenBSD: getopt.c,v 1.2 1996/08/19 08:33:32 tholo Exp $"; 38static char *rcsid = "$OpenBSD: getopt.c,v 1.4 2002/12/08 22:57:14 millert Exp $";
39#endif /* LIBC_SCCS and not lint */ 39#endif /* LIBC_SCCS and not lint */
40 40
41#include <stdio.h> 41#include <stdio.h>
@@ -66,6 +66,9 @@ BSDgetopt(nargc, nargv, ostr)
66 static char *place = EMSG; /* option letter processing */ 66 static char *place = EMSG; /* option letter processing */
67 char *oli; /* option letter list index */ 67 char *oli; /* option letter list index */
68 68
69 if (ostr == NULL)
70 return (-1);
71
69 if (BSDoptreset || !*place) { /* update scanning pointer */ 72 if (BSDoptreset || !*place) { /* update scanning pointer */
70 BSDoptreset = 0; 73 BSDoptreset = 0;
71 if (BSDoptind >= nargc || *(place = nargv[BSDoptind]) != '-') { 74 if (BSDoptind >= nargc || *(place = nargv[BSDoptind]) != '-') {