We include <unistd.h> for getopt(), but, on Windows, we supply our own
getopt() (as it's a UN*X API), so supply our own header and include that
instead.
While we're at it, mark the copyright strings as unused (to squelch
compiler warnings), and don't include the headers for select() or poll()
in capturetest.c, as we don't use those APIs there (that's what
selpolltest(), which is UN*X-only, is for). <unistd.h> or "getopt.h"
should declare the getopt() external variables, so don't declare them
ourselves.
lbl/os-sunos4.h \
lbl/os-ultrix4.h \
missing/getopt.c \
lbl/os-sunos4.h \
lbl/os-ultrix4.h \
missing/getopt.c \
missing/snprintf.c \
mkdep \
msdos/bin2c.c \
missing/snprintf.c \
mkdep \
msdos/bin2c.c \
--- /dev/null
+/*
+ * 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);
-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
"@(#) 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
-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
"@(#) 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
#include <string.h>
#include <stdarg.h>
#include <limits.h>
#include <string.h>
#include <stdarg.h>
#include <limits.h>
+#ifdef _WIN32
+#include "getopt.h"
+#else
#include <unistd.h>
#endif
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#endif
#include <errno.h>
#include <sys/types.h>
-#ifndef _WIN32
-#include <sys/select.h>
-#include <poll.h>
-#endif
-extern int optind;
-extern int opterr;
-extern char *optarg;
-
int
main(int argc, char **argv)
{
int
main(int argc, char **argv)
{
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
+#ifdef _WIN32
+#include "getopt.h"
+#else
#include <unistd.h>
#endif
#include <fcntl.h>
#include <unistd.h>
#endif
#include <fcntl.h>
static void warn(const char *, ...)
__attribute__((format (printf, 1, 2)));
static void warn(const char *, ...)
__attribute__((format (printf, 1, 2)));
-extern int optind;
-extern int opterr;
-extern char *optarg;
#ifdef BDEBUG
int dflag;
#endif
#ifdef BDEBUG
int dflag;
#endif
-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
"@(#) 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
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
+#ifdef _WIN32
+#include "getopt.h"
+#else
#include <errno.h>
#define MAXIMUM_SNAPLEN 65535
#include <errno.h>
#define MAXIMUM_SNAPLEN 65535
static void error(const char *, ...);
static void warning(const char *, ...);
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)
{
int
main(int argc, char **argv)
{
-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
"@(#) 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
-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
"@(#) 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
-extern int optind;
-extern int opterr;
-extern char *optarg;
-
int
main(int argc, char **argv)
{
int
main(int argc, char **argv)
{
static void warning(const char *, ...)
__attribute__((format (printf, 1, 2)));
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()".
/*
* 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()".