diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-03-20 20:37:26 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-03-20 20:37:26 +0200 |
commit | 366e06bf71b500939fa3a70e3cce91d9a7776e14 (patch) | |
tree | 0404bc19c7247013b1db7323630f494f850bdd5b /getopt.c | |
parent | a95b07bee7574ddf1ef6a9ca6f773cbaf4988707 (diff) | |
download | egawk-366e06bf71b500939fa3a70e3cce91d9a7776e14.tar.gz egawk-366e06bf71b500939fa3a70e3cce91d9a7776e14.tar.bz2 egawk-366e06bf71b500939fa3a70e3cce91d9a7776e14.zip |
Make getopt always compile, fix C89 issues.
Diffstat (limited to 'getopt.c')
-rw-r--r-- | getopt.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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') { |