diff options
-rw-r--r-- | Makefile.in | 1 | ||||
-rw-r--r-- | missing/getopt.h | 7 | ||||
-rw-r--r-- | tests/can_set_rfmon_test.c | 2 | ||||
-rw-r--r-- | tests/capturetest.c | 14 | ||||
-rw-r--r-- | tests/filtertest.c | 7 | ||||
-rw-r--r-- | tests/opentest.c | 10 | ||||
-rw-r--r-- | tests/reactivatetest.c | 2 | ||||
-rw-r--r-- | tests/selpolltest.c | 6 | ||||
-rw-r--r-- | tests/valgrindtest.c | 4 |
9 files changed, 23 insertions, 30 deletions
diff --git a/Makefile.in b/Makefile.in index 747a66af..1e7261f6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -278,6 +278,7 @@ EXTRA_DIST = \ lbl/os-sunos4.h \ lbl/os-ultrix4.h \ missing/getopt.c \ + missing/getopt.h \ missing/snprintf.c \ mkdep \ msdos/bin2c.c \ diff --git a/missing/getopt.h b/missing/getopt.h new file mode 100644 index 00000000..d176345a --- /dev/null +++ b/missing/getopt.h @@ -0,0 +1,7 @@ +/* + * Header for the getopt() we supply if the platform doesn't supply it. + */ +extern char *optarg; /* getopt(3) external variables */ +extern int optind, opterr, optopt; + +extern int getopt(int nargc, char * const *nargv, const char *ostr); diff --git a/tests/can_set_rfmon_test.c b/tests/can_set_rfmon_test.c index aa4c1d40..f1644e66 100644 --- a/tests/can_set_rfmon_test.c +++ b/tests/can_set_rfmon_test.c @@ -20,7 +20,7 @@ */ #ifndef lint -static const char copyright[] = +static const char copyright[] _U_ = "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\ The Regents of the University of California. All rights reserved.\n"; #endif diff --git a/tests/capturetest.c b/tests/capturetest.c index 1f217183..f786f092 100644 --- a/tests/capturetest.c +++ b/tests/capturetest.c @@ -20,7 +20,7 @@ */ #ifndef lint -static const char copyright[] = +static const char copyright[] _U_ = "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\ The Regents of the University of California. All rights reserved.\n"; #endif @@ -30,15 +30,13 @@ The Regents of the University of California. All rights reserved.\n"; #include <string.h> #include <stdarg.h> #include <limits.h> -#ifndef _WIN32 +#ifdef _WIN32 +#include "getopt.h" +#else #include <unistd.h> #endif #include <errno.h> #include <sys/types.h> -#ifndef _WIN32 -#include <sys/select.h> -#include <poll.h> -#endif #include <pcap.h> @@ -61,10 +59,6 @@ static char *copy_argv(char **); static pcap_t *pd; -extern int optind; -extern int opterr; -extern char *optarg; - int main(int argc, char **argv) { diff --git a/tests/filtertest.c b/tests/filtertest.c index 60709c78..5f1b9be3 100644 --- a/tests/filtertest.c +++ b/tests/filtertest.c @@ -34,7 +34,9 @@ The Regents of the University of California. All rights reserved.\n"; #include <stdlib.h> #include <string.h> #include <stdarg.h> -#ifndef _WIN32 +#ifdef _WIN32 +#include "getopt.h" +#else #include <unistd.h> #endif #include <fcntl.h> @@ -61,9 +63,6 @@ static void error(const char *, ...) static void warn(const char *, ...) __attribute__((format (printf, 1, 2))); -extern int optind; -extern int opterr; -extern char *optarg; #ifdef BDEBUG int dflag; #endif diff --git a/tests/opentest.c b/tests/opentest.c index 0c915310..60dcf0d1 100644 --- a/tests/opentest.c +++ b/tests/opentest.c @@ -20,7 +20,7 @@ */ #ifndef lint -static const char copyright[] = +static const char copyright[] _U_ = "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\ The Regents of the University of California. All rights reserved.\n"; #endif @@ -30,7 +30,11 @@ The Regents of the University of California. All rights reserved.\n"; #include <stdlib.h> #include <string.h> #include <stdarg.h> +#ifdef _WIN32 +#include "getopt.h" +#else #include <unistd.h> +#endif #include <errno.h> #define MAXIMUM_SNAPLEN 65535 @@ -42,10 +46,6 @@ static void usage(void) __attribute__((noreturn)); static void error(const char *, ...); static void warning(const char *, ...); -extern int optind; -extern int opterr; -extern char *optarg; - int main(int argc, char **argv) { diff --git a/tests/reactivatetest.c b/tests/reactivatetest.c index 9031a64a..2e1b7b67 100644 --- a/tests/reactivatetest.c +++ b/tests/reactivatetest.c @@ -20,7 +20,7 @@ */ #ifndef lint -static const char copyright[] = +static const char copyright[] _U_ = "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\ The Regents of the University of California. All rights reserved.\n"; #endif diff --git a/tests/selpolltest.c b/tests/selpolltest.c index 7e35845e..bba1ff5c 100644 --- a/tests/selpolltest.c +++ b/tests/selpolltest.c @@ -20,7 +20,7 @@ */ #ifndef lint -static const char copyright[] = +static const char copyright[] _U_ = "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\ The Regents of the University of California. All rights reserved.\n"; #endif @@ -55,10 +55,6 @@ static char *copy_argv(char **); static pcap_t *pd; -extern int optind; -extern int opterr; -extern char *optarg; - int main(int argc, char **argv) { diff --git a/tests/valgrindtest.c b/tests/valgrindtest.c index 72786e41..c825952e 100644 --- a/tests/valgrindtest.c +++ b/tests/valgrindtest.c @@ -85,10 +85,6 @@ static void error(const char *, ...) static void warning(const char *, ...) __attribute__((format (printf, 1, 2))); -extern int optind; -extern int opterr; -extern char *optarg; - /* * On Windows, we need to open the file in binary mode, so that * we get all the bytes specified by the size we get from "fstat()". |