summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguenther <>2015-09-12 14:48:14 +0000
committerguenther <>2015-09-12 14:48:14 +0000
commit816e64a6d2b32b5c4a058d38acc0834a669372c8 (patch)
treed6633671e863c5d5be35c042e2c895b67a1162da
parentddd30c4c28f5907be3ec4f811ed2ea002f0380e6 (diff)
downloadopenbsd-816e64a6d2b32b5c4a058d38acc0834a669372c8.tar.gz
openbsd-816e64a6d2b32b5c4a058d38acc0834a669372c8.tar.bz2
openbsd-816e64a6d2b32b5c4a058d38acc0834a669372c8.zip
Wrap <getopt.h> to make the functions weak and make access to the initialized
variables go direct. (Common variables cannot be aliased.)
-rw-r--r--src/lib/libc/stdlib/getopt_long.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/libc/stdlib/getopt_long.c b/src/lib/libc/stdlib/getopt_long.c
index f46cd8bf4e..21407824dd 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.26 2013/06/08 22:47:56 millert Exp $ */ 1/* $OpenBSD: getopt_long.c,v 1.27 2015/09/12 14:48:14 guenther 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/*
@@ -61,6 +61,11 @@ int optopt = '?'; /* character checked for validity */
61int optreset; /* reset getopt */ 61int optreset; /* reset getopt */
62char *optarg; /* argument associated with option */ 62char *optarg; /* argument associated with option */
63 63
64/* DEF_* only work on initialized (non-COMMON) variables */
65DEF_WEAK(opterr);
66DEF_WEAK(optind);
67DEF_WEAK(optopt);
68
64#define PRINT_ERROR ((opterr) && (*options != ':')) 69#define PRINT_ERROR ((opterr) && (*options != ':'))
65 70
66#define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */ 71#define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */