aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--getopt.c12
-rw-r--r--getopt1.c5
3 files changed, 21 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 822740d0..70e39b78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-03-20 Arnold D. Robbins <arnold@skeeve.com>
+
+ * getopt.c: Undef ELIDE_CODE for gawk.
+ (_getopt_internal_r): Init first.needs_free to 0. In test for -W
+ move executable code to after declarations for C90 compilers.
+ * getopt1.c: Undef ELIDE_CODE for gawk.
+
2012-03-16 Arnold D. Robbins <arnold@skeeve.com>
* getopt.c, getopt.h, getopt1.c, getopt_int.h, regcomp.c,
diff --git a/getopt.c b/getopt.c
index c539e3d7..c5c72a23 100644
--- a/getopt.c
+++ b/getopt.c
@@ -48,6 +48,11 @@
# endif
#endif
+/* !@#$%^&*() !!!!!!!! */
+#ifdef GAWK
+#undef ELIDE_CODE
+#endif
+
#ifndef ELIDE_CODE
@@ -582,6 +587,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
struct option_list first;
first.p = pfound;
first.next = ambig_list;
+ first.needs_free = 0;
ambig_list = &first;
#if defined _LIBC
@@ -877,9 +883,6 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
/* Convenience. Treat POSIX -W foo same as long option --foo */
if (temp[0] == 'W' && temp[1] == ';')
{
- if (longopts == NULL)
- goto no_longs;
-
char *nameend;
const struct option *p;
const struct option *pfound = NULL;
@@ -888,6 +891,9 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
int indfound = 0;
int option_index;
+ if (longopts == NULL)
+ goto no_longs;
+
/* This is an option that requires an argument. */
if (*d->__nextchar != '\0')
{
diff --git a/getopt1.c b/getopt1.c
index 07b742ea..03fba35e 100644
--- a/getopt1.c
+++ b/getopt1.c
@@ -45,6 +45,11 @@
#endif
#endif
+/* !@#$%^&*() !!!!!!!! */
+#ifdef GAWK
+#undef ELIDE_CODE
+#endif
+
#ifndef ELIDE_CODE