diff --git a/adig.c b/adig.c index 3a5c63ef..1eea3df6 100644 --- a/adig.c +++ b/adig.c @@ -53,11 +53,6 @@ #define T_SRV 33 /* server selection */ #endif -#ifndef optind -extern int optind; -extern char *optarg; -#endif - struct nv { const char *name; int value; diff --git a/ahost.c b/ahost.c index dfb51a93..e381c193 100644 --- a/ahost.c +++ b/ahost.c @@ -40,11 +40,6 @@ #include "inet_net_pton.h" #include "ares_getopt.h" -#ifndef optind -extern int optind; -extern char *optarg; -#endif - #ifndef HAVE_STRUCT_IN6_ADDR struct in6_addr { diff --git a/ares_getopt.c b/ares_getopt.c index c3e81fc4..3b565a49 100644 --- a/ares_getopt.c +++ b/ares_getopt.c @@ -49,11 +49,6 @@ #include #include "ares_getopt.h" -/* declarations to provide consistent linkage */ -extern char *optarg; -extern int optind; -extern int opterr; - int opterr = 1, /* if error message should be printed */ optind = 1, /* index into parent argv vector */ optopt, /* character checked for validity */ diff --git a/ares_getopt.h b/ares_getopt.h index e15dc6bf..3dafaf38 100644 --- a/ares_getopt.h +++ b/ares_getopt.h @@ -33,5 +33,9 @@ int ares_getopt(int nargc, char * const nargv[], const char *ostr); +extern char *optarg; +extern int optind; +extern int opterr; + #endif /* ARES_GETOPT_H */