ether.h \
ethertype.h \
extract.h \
+ getopt.h \
gmpls.h \
gmt2local.h \
interface.h \
missing/dlnames.c \
missing/datalinks.c \
missing/getnameinfo.c \
+ missing/getopt_long.c \
missing/inet_aton.c \
missing/inet_ntop.c \
missing/inet_pton.c \
tcpdump.1.in \
vfprintf.c \
win32/Include/errno.h \
- win32/Include/getopt.h \
win32/Include/w32_fzs.h \
- win32/Src/getopt.c \
win32/prj/GNUmakefile \
win32/prj/WinDump.dsp \
win32/prj/WinDump.dsw
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/dlnames.c
getnameinfo.o: $(srcdir)/missing/getnameinfo.c
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getnameinfo.c
+getopt_long.o: $(srcdir)/missing/getopt_long.c
+ $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getopt_long.c
inet_pton.o: $(srcdir)/missing/inet_pton.c
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_pton.c
inet_ntop.o: $(srcdir)/missing/inet_ntop.c
/* Define to 1 if you have the `getnameinfo' function. */
#undef HAVE_GETNAMEINFO
+/* Define to 1 if you have the `getopt_long' function. */
+#undef HAVE_GETOPT_LONG
+
/* define if you have getrpcbynumber() */
#undef HAVE_GETRPCBYNUMBER
fi
fi
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
fi
+ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long"
+if test "x$ac_cv_func_getopt_long" = xyes; then :
+ $as_echo "#define HAVE_GETOPT_LONG 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" getopt_long.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS getopt_long.$ac_objext"
+ ;;
+esac
+
+fi
+
for ac_func in fork vfork strftime
do :
AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER
fi
fi
+
AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h netdnet/dnetdb.h)
AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
#include <sys/socket.h>
missing_includes=yes
fi
-AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep)
+AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep getopt_long)
AC_CHECK_FUNCS(fork vfork strftime)
AC_CHECK_FUNCS(setlinebuf alarm)
#include <tcpdump-stdinc.h>
#ifdef WIN32
-#include "getopt.h"
#include "w32_fzs.h"
extern int strcasecmp (const char *__s1, const char *__s2);
extern int SIZE_BUF;
#include <smi.h>
#endif
+#ifdef HAVE_GETOPT_LONG
+#include <getopt.h>
+#else
+#include "getopt.h"
+#endif
#include <pcap.h>
#include <signal.h>
#include <stdio.h>
#define Q_FLAG
#endif
+static struct option longopts[] = {
+ { NULL, no_argument, NULL, 'a' },
+ { NULL, no_argument, NULL, 'A' },
+ { NULL, no_argument, NULL, 'b' },
+#if defined(HAVE_PCAP_CREATE) || defined(WIN32)
+ { NULL, required_argument, NULL, 'B' },
+#endif
+ { NULL, required_argument, NULL, 'c' },
+ { NULL, required_argument, NULL, 'C' },
+ { NULL, no_argument, NULL, 'd' },
+ { NULL, no_argument, NULL, 'D' },
+ { NULL, no_argument, NULL, 'L' },
+ { NULL, no_argument, NULL, 'e' },
+ { NULL, required_argument, NULL, 'E' },
+ { NULL, no_argument, NULL, 'f' },
+ { NULL, required_argument, NULL, 'F' },
+ { NULL, required_argument, NULL, 'G' },
+ { NULL, no_argument, NULL, 'h' },
+ { NULL, no_argument, NULL, 'H' },
+ { NULL, required_argument, NULL, 'i' },
+#ifdef HAVE_PCAP_CREATE
+ { NULL, no_argument, NULL, 'I' },
+#endif
+#ifdef HAVE_PCAP_SET_TSTAMP_TYPE
+ { NULL, required_argument, NULL, 'j' },
+ { NULL, no_argument, NULL, 'J' },
+#endif
+ { NULL, no_argument, NULL, 'l' },
+ { NULL, no_argument, NULL, 'K' },
+ { NULL, required_argument, NULL, 'm' },
+ { NULL, required_argument, NULL, 'M' },
+ { NULL, no_argument, NULL, 'n' },
+ { NULL, no_argument, NULL, 'N' },
+ { NULL, no_argument, NULL, 'O' },
+ { NULL, no_argument, NULL, 'p' },
+ { NULL, no_argument, NULL, 'q' },
+#ifdef HAVE_PCAP_SETDIRECTION
+ { NULL, required_argument, NULL, 'Q' },
+#endif
+ { NULL, required_argument, NULL, 'r' },
+ { NULL, no_argument, NULL, 'R' },
+ { NULL, required_argument, NULL, 's' },
+ { NULL, no_argument, NULL, 'S' },
+ { NULL, no_argument, NULL, 't' },
+ { NULL, required_argument, NULL, 'T' },
+ { NULL, no_argument, NULL, 'u' },
+#ifdef HAVE_PCAP_DUMP_FLUSH
+ { NULL, no_argument, NULL, 'U' },
+#endif
+ { NULL, no_argument, NULL, 'v' },
+ { NULL, required_argument, NULL, 'V' },
+ { NULL, required_argument, NULL, 'w' },
+ { NULL, required_argument, NULL, 'W' },
+ { NULL, no_argument, NULL, 'x' },
+ { NULL, no_argument, NULL, 'X' },
+ { NULL, required_argument, NULL, 'y' },
+#if defined(HAVE_PCAP_DEBUG) || defined(HAVE_YYDEBUG)
+ { NULL, no_argument, NULL, 'Y' },
+#endif
+ { NULL, required_argument, NULL, 'z' },
+ { NULL, required_argument, NULL, 'Z' },
+ { NULL, 0, NULL, 0 }
+};
+
#ifndef WIN32
/* Drop root privileges and chroot if necessary */
static void
#endif
while (
- (op = getopt(argc, argv, "aAb" B_FLAG "c:C:d" D_FLAG "eE:fF:G:hHi:" I_FLAG j_FLAG J_FLAG "KlLm:M:nNOpq" Q_FLAG "r:Rs:StT:u" U_FLAG "vV:w:W:xXy:Yz:Z:")) != -1)
+ (op = getopt_long(argc, argv, "aAb" B_FLAG "c:C:d" D_FLAG "eE:fF:G:hHi:" I_FLAG j_FLAG J_FLAG "KlLm:M:nNOpq" Q_FLAG "r:Rs:StT:u" U_FLAG "vV:w:W:xXy:Yz:Z:", longopts, NULL)) != -1)
switch (op) {
case 'a':
+++ /dev/null
-/* Declarations for getopt.
- Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
-
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#ifndef _GETOPT_H
-#define _GETOPT_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-#ifndef WIN32
-extern char *optarg;
-#endif
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns EOF, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-#ifndef WIN32
-extern int optind;
-#endif
-
-/* Callers store zero here to inhibit the error message `getopt' prints
- for unrecognized options. */
-
-#ifndef WIN32
-extern int opterr;
-#endif
-
-/* Set to an option character which was unrecognized. */
-
-extern int optopt;
-
-/* Describe the long-named options requested by the application.
- The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
- of `struct option' terminated by an element containing a name which is
- zero.
-
- The field `has_arg' is:
- no_argument (or 0) if the option does not take an argument,
- required_argument (or 1) if the option requires an argument,
- optional_argument (or 2) if the option takes an optional argument.
-
- If the field `flag' is not NULL, it points to a variable that is set
- to the value given in the field `val' when the option is found, but
- left unchanged if the option is not found.
-
- To have a long-named option do something other than set an `int' to
- a compiled-in constant, such as set a value from `optarg', set the
- option's `flag' field to zero and its `val' field to a nonzero
- value (the equivalent single-letter option character, if there is
- one). For long options that have a zero `flag' field, `getopt'
- returns the contents of the `val' field. */
-
-struct option
-{
-#if __STDC__
- const char *name;
-#else
- char *name;
-#endif
- /* has_arg can't be an enum because some compilers complain about
- type mismatches in all the code that assumes it is an int. */
- int has_arg;
- int *flag;
- int val;
-};
-
-/* Names for the values of the `has_arg' field of `struct option'. */
-
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
-
-#if __STDC__
-#if defined(__GNU_LIBRARY__)
-/* Many other libraries have conflicting prototypes for getopt, with
- differences in the consts, in stdlib.h. To avoid compilation
- errors, only prototype getopt for the GNU C library. */
-extern int getopt (int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
-extern int getopt ();
-#endif /* not __GNU_LIBRARY__ */
-extern int getopt_long (int argc, char *const *argv, const char *shortopts,
- const struct option *longopts, int *longind);
-extern int getopt_long_only (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind);
-
-/* Internal only. Users should not call this directly. */
-extern int _getopt_internal (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind,
- int long_only);
-#else /* not __STDC__ */
-extern int getopt ();
-extern int getopt_long ();
-extern int getopt_long_only ();
-
-extern int _getopt_internal ();
-#endif /* not __STDC__ */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GETOPT_H */
+++ /dev/null
-/*
- * Copyright (c) 1987, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
-#endif /* LIBC_SCCS and not lint */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-int opterr = 1, /* if error message should be printed */
- optind = 1, /* index into parent argv vector */
- optopt, /* character checked for validity */
- optreset; /* reset getopt */
-char *optarg; /* argument associated with option */
-
-#define BADCH (int)'?'
-#define BADARG (int)':'
-#define EMSG ""
-
-/*
- * getopt --
- * Parse argc/argv argument vector.
- */
-int
-getopt(nargc, nargv, ostr)
- int nargc;
- char * const *nargv;
- const char *ostr;
-{
- extern char *program_name;
- static char *place = EMSG; /* option letter processing */
- char *oli; /* option letter list index */
-
- if (optreset || !*place) { /* update scanning pointer */
- optreset = 0;
- if (optind >= nargc || *(place = nargv[optind]) != '-') {
- place = EMSG;
- return (-1);
- }
- if (place[1] && *++place == '-') { /* found "--" */
- ++optind;
- place = EMSG;
- return (-1);
- }
- } /* option letter okay? */
- if ((optopt = (int)*place++) == (int)':' ||
- !(oli = strchr(ostr, optopt))) {
- /*
- * if the user didn't specify '-' as an option,
- * assume it means -1.
- */
- if (optopt == (int)'-')
- return (-1);
- if (!*place)
- ++optind;
- if (opterr && *ostr != ':')
- (void)fprintf(stderr,
- "%s: illegal option -- %c\n", program_name, optopt);
- return (BADCH);
- }
- if (*++oli != ':') { /* don't need argument */
- optarg = NULL;
- if (!*place)
- ++optind;
- }
- else { /* need an argument */
- if (*place) /* no white space */
- optarg = place;
- else if (nargc <= ++optind) { /* no arg */
- place = EMSG;
- if (*ostr == ':')
- return (BADARG);
- if (opterr)
- (void)fprintf(stderr,
- "%s: option requires an argument -- %c\n",
- program_name, optopt);
- return (BADCH);
- }
- else /* white space */
- optarg = nargv[optind];
- place = EMSG;
- ++optind;
- }
- return (optopt); /* dump back option letter */
-}
../../missing/datalinks.o \
../../missing/strsep.o \
../../missing/inet_pton.o \
+ ../../missing/getopt_long.o \
../../machdep.o \
../../oui.o \
../../parsenfsfh.o \
../../smbutil.o \
../../tcpdump.o \
../../util.o \
- ../../Win32/src/getopt.o \
../../cpack.o \
../../ipproto.o \
../../l2vpn.o \
# End Source File
# Begin Source File
-SOURCE=..\Src\getopt.c
+SOURCE=..\..\missing\getopt.c
# End Source File
# Begin Source File
</FileConfiguration>
</File>
<File
- RelativePath="..\Src\getopt.c"
+ RelativePath="..\..\missing\getopt_long.c"
>
<FileConfiguration
Name="Debug|Win32"