summaryrefslogtreecommitdiff
path: root/libc/unistd/getopt.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernds_cb1@t-online.de>2008-06-05 17:42:11 +0000
committerBernd Schmidt <bernds_cb1@t-online.de>2008-06-05 17:42:11 +0000
commite66aed2bde24de88a59153857781b39042c77cac (patch)
tree8cb93474d279b37af2953ee994a4da26b1886f9b /libc/unistd/getopt.c
parentf8b866fc12318109796a8851c061ec72dc079168 (diff)
Revert revision 22027 which totally broke getopt.
Diffstat (limited to 'libc/unistd/getopt.c')
-rw-r--r--libc/unistd/getopt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c
index c28afda0d..754e86f25 100644
--- a/libc/unistd/getopt.c
+++ b/libc/unistd/getopt.c
@@ -162,6 +162,10 @@ int opterr = 1;
int optopt = '?';
+/* Keep a global copy of all internal members of getopt_data. */
+
+static struct _getopt_data getopt_data;
+
#ifndef __GNU_LIBRARY__
@@ -1154,9 +1158,7 @@ _getopt_internal (int argc, char *const *argv, const char *optstring,
const struct option *longopts, int *longind, int long_only)
{
int result;
- struct _getopt_data getopt_data;
- memset(&getopt_data, 0, sizeof(getopt_data));
getopt_data.optind = optind;
getopt_data.opterr = opterr;