aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capture_opts.h34
-rw-r--r--tshark.c9
-rw-r--r--ui/qt/main.cpp1
3 files changed, 17 insertions, 27 deletions
diff --git a/capture_opts.h b/capture_opts.h
index d689878023..8c15c00476 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -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:"
diff --git a/tshark.c b/tshark.c
index 79bd386f17..85469ceaa6 100644
--- a/tshark.c
+++ b/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 */
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index 4a0a6e85aa..fd363094ec 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -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 */