aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2019-12-13 13:13:32 +0100
committerGerald Combs <gerald@wireshark.org>2019-12-13 22:29:01 +0000
commitabd83d9961d7c90896d5f941ecd97850306e3b1f (patch)
treec1cd7bd4f8464f0ec060706a348654ad31da1c50
parent8b8bf626000291c0187715196ee907c1b5265a99 (diff)
cmdline: cleanup option string definitions
Option string composition has grown organically over time and is depending on compilation options also. This results in somewhat complex macro definitions and the use of the string concatenation feature of the C compiler. This change tries to clean up some of this magic by removing definitions of empty strings and merging of adjacent strings. Change-Id: I968449ea9b564915bee468a0cac0e114983ceebe Reviewed-on: https://code.wireshark.org/review/35429 Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r--capture_opts.h8
-rw-r--r--dumpcap.c10
-rw-r--r--ui/commandline.c2
3 files changed, 10 insertions, 10 deletions
diff --git a/capture_opts.h b/capture_opts.h
index 0a35b01341..7ad9df6ea8 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -60,7 +60,7 @@ extern "C" {
#ifdef HAVE_PCAP_REMOTE
#define OPTSTRING_A "A:"
#else
-#define OPTSTRING_A ""
+#define OPTSTRING_A
#endif
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
@@ -69,7 +69,7 @@ extern "C" {
#define OPTSTRING_B "B:"
#else
#define LONGOPT_BUFFER_SIZE
-#define OPTSTRING_B ""
+#define OPTSTRING_B
#endif
#ifdef HAVE_PCAP_CREATE
@@ -77,7 +77,7 @@ extern "C" {
#define OPTSTRING_I "I"
#else
#define LONGOPT_MONITOR_MODE
-#define OPTSTRING_I ""
+#define OPTSTRING_I
#endif
#define LONGOPT_CAPTURE_COMMON \
@@ -381,7 +381,7 @@ capture_opts_free_interface_t(interface_t *device);
}
#endif /* __cplusplus */
-#endif /* capture_opts.h */
+#endif /* __CAPTURE_OPTS_H__ */
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
diff --git a/dumpcap.c b/dumpcap.c
index 850ec98c36..8714b3829e 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -4668,24 +4668,24 @@ main(int argc, char *argv[])
#ifdef HAVE_BPF_IMAGE
#define OPTSTRING_d "d"
#else
-#define OPTSTRING_d ""
+#define OPTSTRING_d
#endif
#ifdef HAVE_PCAP_REMOTE
#define OPTSTRING_r "r"
#define OPTSTRING_u "u"
#else
-#define OPTSTRING_r ""
-#define OPTSTRING_u ""
+#define OPTSTRING_r
+#define OPTSTRING_u
#endif
#ifdef HAVE_PCAP_SETSAMPLING
#define OPTSTRING_m "m:"
#else
-#define OPTSTRING_m ""
+#define OPTSTRING_m
#endif
-#define OPTSTRING OPTSTRING_CAPTURE_COMMON "C:" OPTSTRING_d "gh" "k:" OPTSTRING_m "MN:nPq" OPTSTRING_r "St" OPTSTRING_u "vw:Z:"
+#define OPTSTRING OPTSTRING_CAPTURE_COMMON "C:" OPTSTRING_d "ghk:" OPTSTRING_m "MN:nPq" OPTSTRING_r "St" OPTSTRING_u "vw:Z:"
#ifdef DEBUG_CHILD_DUMPCAP
if ((debug_log = ws_fopen("dumpcap_debug_log.tmp","w")) == NULL) {
diff --git a/ui/commandline.c b/ui/commandline.c
index a495f901ae..39a192fc41 100644
--- a/ui/commandline.c
+++ b/ui/commandline.c
@@ -199,7 +199,7 @@ commandline_print_usage(gboolean for_help_option) {
*/
#define LONGOPT_FULL_SCREEN 65536
-#define OPTSTRING OPTSTRING_CAPTURE_COMMON OPTSTRING_DISSECT_COMMON "C:g:Hh" "jJ:klm:o:P:r:R:Svw:X:Y:z:"
+#define OPTSTRING OPTSTRING_CAPTURE_COMMON OPTSTRING_DISSECT_COMMON "C:g:HhjJ:klm:o:P:r:R:Svw:X:Y:z:"
static const struct option long_options[] = {
{"help", no_argument, NULL, 'h'},
{"read-file", required_argument, NULL, 'r' },