Gracefully degrade to getopt if getopt_long does not exist.
This commit is contained in:
parent
9c627aae6b
commit
647c1a33c8
|
@ -11552,6 +11552,7 @@ fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for ac_func in \
|
for ac_func in \
|
||||||
|
@ -11570,6 +11571,7 @@ for ac_func in \
|
||||||
ftruncate64 \
|
ftruncate64 \
|
||||||
getnetbyaddr \
|
getnetbyaddr \
|
||||||
getnetbyname \
|
getnetbyname \
|
||||||
|
getopt_long \
|
||||||
getpagesize \
|
getpagesize \
|
||||||
getprotobyname \
|
getprotobyname \
|
||||||
getprotobynumber \
|
getprotobynumber \
|
||||||
|
@ -11743,6 +11745,7 @@ done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for ac_header in \
|
for ac_header in \
|
||||||
|
@ -11752,6 +11755,7 @@ for ac_header in \
|
||||||
direct.h \
|
direct.h \
|
||||||
elf.h \
|
elf.h \
|
||||||
float.h \
|
float.h \
|
||||||
|
getopt.h \
|
||||||
ieeefp.h \
|
ieeefp.h \
|
||||||
io.h \
|
io.h \
|
||||||
libio.h \
|
libio.h \
|
||||||
|
|
|
@ -932,6 +932,7 @@ AC_CHECK_FUNCS(\
|
||||||
ftruncate64 \
|
ftruncate64 \
|
||||||
getnetbyaddr \
|
getnetbyaddr \
|
||||||
getnetbyname \
|
getnetbyname \
|
||||||
|
getopt_long \
|
||||||
getpagesize \
|
getpagesize \
|
||||||
getprotobyname \
|
getprotobyname \
|
||||||
getprotobynumber \
|
getprotobynumber \
|
||||||
|
@ -980,6 +981,7 @@ AC_CHECK_HEADERS(\
|
||||||
direct.h \
|
direct.h \
|
||||||
elf.h \
|
elf.h \
|
||||||
float.h \
|
float.h \
|
||||||
|
getopt.h \
|
||||||
ieeefp.h \
|
ieeefp.h \
|
||||||
io.h \
|
io.h \
|
||||||
libio.h \
|
libio.h \
|
||||||
|
|
|
@ -134,6 +134,12 @@
|
||||||
/* Define to 1 if you have the `getnetbyname' function. */
|
/* Define to 1 if you have the `getnetbyname' function. */
|
||||||
#undef HAVE_GETNETBYNAME
|
#undef HAVE_GETNETBYNAME
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <getopt.h> header file. */
|
||||||
|
#undef HAVE_GETOPT_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getopt_long' function. */
|
||||||
|
#undef HAVE_GETOPT_LONG
|
||||||
|
|
||||||
/* Define to 1 if you have the `getpagesize' function. */
|
/* Define to 1 if you have the `getpagesize' function. */
|
||||||
#undef HAVE_GETPAGESIZE
|
#undef HAVE_GETPAGESIZE
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,9 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <getopt.h>
|
#ifdef HAVE_GETOPT_H
|
||||||
|
# include <getopt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "wrc.h"
|
#include "wrc.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
@ -284,6 +286,7 @@ int getopt (int argc, char *const *argv, const char *optstring);
|
||||||
static void rm_tempfile(void);
|
static void rm_tempfile(void);
|
||||||
static void segvhandler(int sig);
|
static void segvhandler(int sig);
|
||||||
|
|
||||||
|
#ifdef HAVE_GETOPT_LONG
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{ "input", 1, 0, 'i' },
|
{ "input", 1, 0, 'i' },
|
||||||
{ "output", 1, 0, 'o' },
|
{ "output", 1, 0, 'o' },
|
||||||
|
@ -297,6 +300,7 @@ static struct option long_options[] = {
|
||||||
{ "version", 0, 0, 3 },
|
{ "version", 0, 0, 3 },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -327,7 +331,11 @@ int main(int argc,char *argv[])
|
||||||
strcat(cmdline, " ");
|
strcat(cmdline, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GETOPT_LONG
|
||||||
while((optc = getopt_long(argc, argv, "a:AbB:cC:d:D:eEF:ghH:i:I:l:LmnNo:O:p:rstTVw:W", long_options, &opti)) != EOF)
|
while((optc = getopt_long(argc, argv, "a:AbB:cC:d:D:eEF:ghH:i:I:l:LmnNo:O:p:rstTVw:W", long_options, &opti)) != EOF)
|
||||||
|
#else
|
||||||
|
while((optc = getopt(argc, argv, "a:AbB:cC:d:D:eEF:ghH:i:I:l:LmnNo:O:p:rstTVw:W")) != EOF)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
switch(optc)
|
switch(optc)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue