summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/getopt_long.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2015-09-12 14:48:14 +0000
committerguenther <guenther@openbsd.org>2015-09-12 14:48:14 +0000
commit0efd2def317b9301899bd5f4b4036505346a77ee (patch)
treeb4093bbd79c072fc0a7f0de5ddd7ba4f087a7975 /lib/libc/stdlib/getopt_long.c
parentProvide an ftpproxy6 rc script. ftp-proxy can only open one listening socket (diff)
downloadwireguard-openbsd-0efd2def317b9301899bd5f4b4036505346a77ee.tar.xz
wireguard-openbsd-0efd2def317b9301899bd5f4b4036505346a77ee.zip
Wrap <getopt.h> to make the functions weak and make access to the initialized
variables go direct. (Common variables cannot be aliased.)
Diffstat (limited to 'lib/libc/stdlib/getopt_long.c')
-rw-r--r--lib/libc/stdlib/getopt_long.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libc/stdlib/getopt_long.c b/lib/libc/stdlib/getopt_long.c
index f46cd8bf4e4..21407824ddf 100644
--- a/lib/libc/stdlib/getopt_long.c
+++ b/lib/libc/stdlib/getopt_long.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getopt_long.c,v 1.26 2013/06/08 22:47:56 millert Exp $ */
+/* $OpenBSD: getopt_long.c,v 1.27 2015/09/12 14:48:14 guenther Exp $ */
/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */
/*
@@ -61,6 +61,11 @@ int optopt = '?'; /* character checked for validity */
int optreset; /* reset getopt */
char *optarg; /* argument associated with option */
+/* DEF_* only work on initialized (non-COMMON) variables */
+DEF_WEAK(opterr);
+DEF_WEAK(optind);
+DEF_WEAK(optopt);
+
#define PRINT_ERROR ((opterr) && (*options != ':'))
#define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */