diff options
author | guenther <> | 2015-09-12 14:48:14 +0000 |
---|---|---|
committer | guenther <> | 2015-09-12 14:48:14 +0000 |
commit | 816e64a6d2b32b5c4a058d38acc0834a669372c8 (patch) | |
tree | d6633671e863c5d5be35c042e2c895b67a1162da | |
parent | ddd30c4c28f5907be3ec4f811ed2ea002f0380e6 (diff) | |
download | openbsd-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.c | 7 |
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 */ | |||
61 | int optreset; /* reset getopt */ | 61 | int optreset; /* reset getopt */ |
62 | char *optarg; /* argument associated with option */ | 62 | char *optarg; /* argument associated with option */ |
63 | 63 | ||
64 | /* DEF_* only work on initialized (non-COMMON) variables */ | ||
65 | DEF_WEAK(opterr); | ||
66 | DEF_WEAK(optind); | ||
67 | DEF_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 */ |