summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libc/stdlib/getopt_long.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/libc/stdlib/getopt_long.c b/src/lib/libc/stdlib/getopt_long.c
index 130c1d8bfa..bcbd53cf44 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.3 2002/12/05 21:45:01 millert Exp $ */ 1/* $OpenBSD: getopt_long.c,v 1.4 2002/12/05 22:26:04 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/*-
@@ -38,7 +38,7 @@
38 */ 38 */
39 39
40#if defined(LIBC_SCCS) && !defined(lint) 40#if defined(LIBC_SCCS) && !defined(lint)
41static char *rcsid = "$OpenBSD: getopt_long.c,v 1.3 2002/12/05 21:45:01 millert Exp $"; 41static char *rcsid = "$OpenBSD: getopt_long.c,v 1.4 2002/12/05 22:26:04 millert Exp $";
42#endif /* LIBC_SCCS and not lint */ 42#endif /* LIBC_SCCS and not lint */
43 43
44#include <err.h> 44#include <err.h>
@@ -62,11 +62,11 @@ char *optarg; /* argument associated with option */
62#define FLAG_LONGONLY 0x04 /* operate as getopt_long_only */ 62#define FLAG_LONGONLY 0x04 /* operate as getopt_long_only */
63 63
64/* return values */ 64/* return values */
65#define BADCH (int)'?' 65#define BADCH (int)'?'
66#define BADARG ((*options == ':') ? (int)':' : (int)'?') 66#define BADARG ((*options == ':') ? (int)':' : (int)'?')
67#define INORDER (int)1 67#define INORDER (int)1
68 68
69#define EMSG "" 69#define EMSG ""
70 70
71static int getopt_internal(int, char * const *, const char *, 71static int getopt_internal(int, char * const *, const char *,
72 const struct option *, int *, int); 72 const struct option *, int *, int);
@@ -403,7 +403,9 @@ start:
403 } 403 }
404 if (long_options != NULL && optchar == 'W' && oli[1] == ';') { 404 if (long_options != NULL && optchar == 'W' && oli[1] == ';') {
405 /* -W long-option */ 405 /* -W long-option */
406 if (++optind >= nargc) { /* no arg */ 406 if (*place) /* no space */
407 /* NOTHING */;
408 else if (++optind >= nargc) { /* no arg */
407 place = EMSG; 409 place = EMSG;
408 if (PRINT_ERROR) 410 if (PRINT_ERROR)
409 warnx(recargchar, optchar); 411 warnx(recargchar, optchar);