summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/getopt_long.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/stdlib/getopt_long.c')
-rw-r--r--src/lib/libc/stdlib/getopt_long.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/getopt_long.c b/src/lib/libc/stdlib/getopt_long.c
index 176ba25bb7..413ec24f4e 100644
--- a/src/lib/libc/stdlib/getopt_long.c
+++ b/src/lib/libc/stdlib/getopt_long.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getopt_long.c,v 1.9 2002/12/08 17:07:46 millert Exp $ */ 1/* $OpenBSD: getopt_long.c,v 1.10 2002/12/08 17:52:26 millert Exp $ */
2/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ 2/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */
3 3
4/* 4/*
@@ -64,7 +64,7 @@
64 */ 64 */
65 65
66#if defined(LIBC_SCCS) && !defined(lint) 66#if defined(LIBC_SCCS) && !defined(lint)
67static char *rcsid = "$OpenBSD: getopt_long.c,v 1.9 2002/12/08 17:07:46 millert Exp $"; 67static char *rcsid = "$OpenBSD: getopt_long.c,v 1.10 2002/12/08 17:52:26 millert Exp $";
68#endif /* LIBC_SCCS and not lint */ 68#endif /* LIBC_SCCS and not lint */
69 69
70#include <err.h> 70#include <err.h>
@@ -301,7 +301,8 @@ getopt_internal(int nargc, char * const *nargv, const char *options,
301 int optchar, short_too; 301 int optchar, short_too;
302 static int posixly_correct = -1; 302 static int posixly_correct = -1;
303 303
304 optarg = NULL; 304 if (options == NULL)
305 return (-1);
305 306
306 /* 307 /*
307 * Disable GNU extensions if POSIXLY_CORRECT is set or options 308 * Disable GNU extensions if POSIXLY_CORRECT is set or options
@@ -323,6 +324,7 @@ getopt_internal(int nargc, char * const *nargv, const char *options,
323 if (optind == 0) 324 if (optind == 0)
324 optind = optreset = 1; 325 optind = optreset = 1;
325 326
327 optarg = NULL;
326 if (optreset) 328 if (optreset)
327 nonopt_start = nonopt_end = -1; 329 nonopt_start = nonopt_end = -1;
328start: 330start: