forked from osmocom/wireshark
Also define LONGOPT_CAPTURE_COMMON as nothing if we don't have pcap.
While we're at it, simplify the #ifdefs and #defines in capture_opts.h - don't do the same tests twice. Change-Id: I2079167f31789470ef77120054d769d5914745e3 Reviewed-on: https://code.wireshark.org/review/2496 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
5537c53f37
commit
cc4710ac5f
|
@ -66,19 +66,29 @@ extern "C" {
|
|||
#define MIN_NON_CAPTURE_LONGOPT 129
|
||||
|
||||
/*
|
||||
* Long options for capturing common to all capturing programs.
|
||||
* Options for capturing common to all capturing programs.
|
||||
*/
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
#define OPTSTRING_A "A:"
|
||||
#else
|
||||
#define OPTSTRING_A ""
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
|
||||
#define LONGOPT_BUFFER_SIZE \
|
||||
{(char *)"buffer-size", required_argument, NULL, 'B'},
|
||||
#define OPTSTRING_B "B:"
|
||||
#else
|
||||
#define LONGOPT_BUFFER_SIZE
|
||||
#define OPTSTRING_B ""
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PCAP_CREATE
|
||||
#define LONGOPT_MONITOR_MODE {(char *)"monitor-mode", no_argument, NULL, 'I'},
|
||||
#define OPTSTRING_I "I"
|
||||
#else
|
||||
#define LONGOPT_MONITOR_MODE
|
||||
#define OPTSTRING_I ""
|
||||
#endif
|
||||
|
||||
#define LONGOPT_CAPTURE_COMMON \
|
||||
|
@ -90,28 +100,6 @@ extern "C" {
|
|||
{(char *)"snapshot-length", required_argument, NULL, 's'}, \
|
||||
{(char *)"linktype", required_argument, NULL, 'y'}
|
||||
|
||||
/*
|
||||
* Short options for capturing common to all capturing programs.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
#define OPTSTRING_A "A:"
|
||||
#else
|
||||
#define OPTSTRING_A ""
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
|
||||
#define OPTSTRING_B "B:"
|
||||
#else
|
||||
#define OPTSTRING_B ""
|
||||
#endif /* _WIN32 or HAVE_PCAP_CREATE */
|
||||
|
||||
#ifdef HAVE_PCAP_CREATE
|
||||
#define OPTSTRING_I "I"
|
||||
#else
|
||||
#define OPTSTRING_I ""
|
||||
#endif
|
||||
|
||||
#define OPTSTRING_CAPTURE_COMMON \
|
||||
"a:" OPTSTRING_A "b:" OPTSTRING_B "c:Df:i:" OPTSTRING_I "Lps:y:"
|
||||
|
||||
|
|
9
tshark.c
9
tshark.c
|
@ -915,6 +915,11 @@ show_version(GString *comp_info_str, GString *runtime_info_str)
|
|||
runtime_info_str->str);
|
||||
}
|
||||
|
||||
#ifndef HAVE_LIBPCAP
|
||||
#define LONGOPT_CAPTURE_COMMON
|
||||
#define OPTSTRING_CAPTURE_COMMON ""
|
||||
#endif /* HAVE_LIBPCAP */
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -974,10 +979,6 @@ main(int argc, char *argv[])
|
|||
int optind_initial;
|
||||
gchar *output_only = NULL;
|
||||
|
||||
#ifndef HAVE_LIBPCAP
|
||||
#define OPTSTRING_CAPTURE_COMMON ""
|
||||
#endif /* HAVE_LIBPCAP */
|
||||
|
||||
/* the leading - ensures that getopt() does not permute the argv[] entries
|
||||
we have to make sure that the first getopt() preserves the content of argv[]
|
||||
for the subsequent getopt_long() call */
|
||||
|
|
|
@ -500,6 +500,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
// XXX Should the remaining code be in WiresharkApplcation::WiresharkApplication?
|
||||
#ifndef HAVE_LIBPCAP
|
||||
#define LONGOPT_CAPTURE_COMMON
|
||||
#define OPTSTRING_CAPTURE_COMMON ""
|
||||
#endif /* HAVE_LIBPCAP */
|
||||
|
||||
|
|
Loading…
Reference in New Issue