summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/getopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/stdlib/getopt.c')
-rw-r--r--src/lib/libc/stdlib/getopt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libc/stdlib/getopt.c b/src/lib/libc/stdlib/getopt.c
index 63c5e6a479..fc0f8c1bc7 100644
--- a/src/lib/libc/stdlib/getopt.c
+++ b/src/lib/libc/stdlib/getopt.c
@@ -32,8 +32,7 @@
32 */ 32 */
33 33
34#if defined(LIBC_SCCS) && !defined(lint) 34#if defined(LIBC_SCCS) && !defined(lint)
35/* static char sccsid[] = "from: @(#)getopt.c 8.2 (Berkeley) 4/2/94"; */ 35static char *rcsid = "$OpenBSD: getopt.c,v 1.4 2002/12/08 22:57:14 millert Exp $";
36static char *rcsid = "$Id: getopt.c,v 1.1.1.1 1995/10/18 08:42:17 deraadt Exp $";
37#endif /* LIBC_SCCS and not lint */ 36#endif /* LIBC_SCCS and not lint */
38 37
39#include <stdio.h> 38#include <stdio.h>
@@ -64,6 +63,9 @@ getopt(nargc, nargv, ostr)
64 static char *place = EMSG; /* option letter processing */ 63 static char *place = EMSG; /* option letter processing */
65 char *oli; /* option letter list index */ 64 char *oli; /* option letter list index */
66 65
66 if (ostr == NULL)
67 return (-1);
68
67 if (optreset || !*place) { /* update scanning pointer */ 69 if (optreset || !*place) { /* update scanning pointer */
68 optreset = 0; 70 optreset = 0;
69 if (optind >= nargc || *(place = nargv[optind]) != '-') { 71 if (optind >= nargc || *(place = nargv[optind]) != '-') {