aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capinfos.c39
-rw-r--r--captype.c39
-rw-r--r--dumpcap.c22
-rw-r--r--editcap.c39
-rw-r--r--mergecap.c40
-rw-r--r--reordercap.c39
-rw-r--r--text2pcap.c34
-rw-r--r--tfshark.c28
-rw-r--r--tshark.c22
-rw-r--r--ui/gtk/main.c22
-rw-r--r--wireshark-qt.cpp22
-rw-r--r--wsutil/ws_version_info.c25
12 files changed, 38 insertions, 333 deletions
diff --git a/capinfos.c b/capinfos.c
index e75e70e1ec..2476a62a18 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -69,10 +69,6 @@
#include <glib.h>
-#ifdef HAVE_LIBZ
-#include <zlib.h> /* to get the libz version number */
-#endif
-
#include <wiretap/wtap.h>
#include <wsutil/crash_info.h>
@@ -1366,37 +1362,6 @@ hash_to_str(const unsigned char *hash, size_t length, char *str) {
}
#endif /* HAVE_LIBGCRYPT */
-static void
-get_capinfos_compiled_info(GString *str)
-{
- /* LIBZ */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBZ
- g_string_append(str, "with libz ");
-#ifdef ZLIB_VERSION
- g_string_append(str, ZLIB_VERSION);
-#else /* ZLIB_VERSION */
- g_string_append(str, "(version unknown)");
-#endif /* ZLIB_VERSION */
-#else /* HAVE_LIBZ */
- g_string_append(str, "without libz");
-#endif /* HAVE_LIBZ */
-}
-
-static void
-get_capinfos_runtime_info(
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- GString *str)
-#else
- GString *str _U_)
-#endif
-{
- /* zlib */
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- g_string_append_printf(str, ", with libz %s", zlibVersion());
-#endif
-}
-
int
main(int argc, char *argv[])
{
@@ -1428,10 +1393,10 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
/* Get the compile-time version information string */
- comp_info_str = get_compiled_version_info(NULL, get_capinfos_compiled_info);
+ comp_info_str = get_compiled_version_info(NULL, NULL);
/* Get the run-time version information string */
- runtime_info_str = get_runtime_version_info(get_capinfos_runtime_info);
+ runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Capinfos (Wireshark) %s\n"
diff --git a/captype.c b/captype.c
index 1390f0ce06..f41f0a22a3 100644
--- a/captype.c
+++ b/captype.c
@@ -36,10 +36,6 @@
#include <getopt.h>
#endif
-#ifdef HAVE_LIBZ
-#include <zlib.h> /* to get the libz version number */
-#endif
-
#include <glib.h>
#include <wiretap/wtap.h>
@@ -86,37 +82,6 @@ failure_message(const char *msg_format _U_, va_list ap _U_)
}
#endif
-static void
-get_captype_compiled_info(GString *str)
-{
- /* LIBZ */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBZ
- g_string_append(str, "with libz ");
-#ifdef ZLIB_VERSION
- g_string_append(str, ZLIB_VERSION);
-#else /* ZLIB_VERSION */
- g_string_append(str, "(version unknown)");
-#endif /* ZLIB_VERSION */
-#else /* HAVE_LIBZ */
- g_string_append(str, "without libz");
-#endif /* HAVE_LIBZ */
-}
-
-static void
-get_captype_runtime_info(
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- GString *str)
-#else
- GString *str _U_)
-#endif
-{
- /* zlib */
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- g_string_append_printf(str, ", with libz %s", zlibVersion());
-#endif
-}
-
int
main(int argc, char *argv[])
{
@@ -142,10 +107,10 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
/* Get the compile-time version information string */
- comp_info_str = get_compiled_version_info(NULL, get_captype_compiled_info);
+ comp_info_str = get_compiled_version_info(NULL, NULL);
/* Get the run-time version information string */
- runtime_info_str = get_runtime_version_info(get_captype_runtime_info);
+ runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Captype (Wireshark) %s\n"
diff --git a/dumpcap.c b/dumpcap.c
index ccb297ddde..2d2d4d61a9 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -54,10 +54,6 @@
#include <signal.h>
#include <errno.h>
-#ifdef HAVE_LIBZ
-#include <zlib.h> /* to get the libz version number */
-#endif
-
#include <wsutil/cmdarg_err.h>
#include <wsutil/crash_info.h>
#include <wsutil/ws_diag_control.h>
@@ -3706,19 +3702,6 @@ get_dumpcap_compiled_info(GString *str)
/* Capture libraries */
g_string_append(str, ", ");
get_compiled_caplibs_version(str);
-
- /* LIBZ */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBZ
- g_string_append(str, "with libz ");
-#ifdef ZLIB_VERSION
- g_string_append(str, ZLIB_VERSION);
-#else /* ZLIB_VERSION */
- g_string_append(str, "(version unknown)");
-#endif /* ZLIB_VERSION */
-#else /* HAVE_LIBZ */
- g_string_append(str, "without libz");
-#endif /* HAVE_LIBZ */
}
static void
@@ -3727,11 +3710,6 @@ get_dumpcap_runtime_info(GString *str)
/* Capture libraries */
g_string_append(str, ", ");
get_runtime_caplibs_version(str);
-
- /* zlib */
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- g_string_append_printf(str, ", with libz %s", zlibVersion());
-#endif
}
/* And now our feature presentation... [ fade to music ] */
diff --git a/editcap.c b/editcap.c
index bf2270fb4f..4927e4ecaf 100644
--- a/editcap.c
+++ b/editcap.c
@@ -54,10 +54,6 @@
#include <getopt.h>
#endif
-#ifdef HAVE_LIBZ
-#include <zlib.h> /* to get the libz version number */
-#endif
-
#include <wiretap/wtap.h>
#include "epan/etypes.h"
@@ -908,37 +904,6 @@ failure_message(const char *msg_format _U_, va_list ap _U_)
}
#endif
-static void
-get_editcap_compiled_info(GString *str)
-{
- /* LIBZ */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBZ
- g_string_append(str, "with libz ");
-#ifdef ZLIB_VERSION
- g_string_append(str, ZLIB_VERSION);
-#else /* ZLIB_VERSION */
- g_string_append(str, "(version unknown)");
-#endif /* ZLIB_VERSION */
-#else /* HAVE_LIBZ */
- g_string_append(str, "without libz");
-#endif /* HAVE_LIBZ */
-}
-
-static void
-get_editcap_runtime_info(
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- GString *str)
-#else
- GString *str _U_)
-#endif
-{
- /* zlib */
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- g_string_append_printf(str, ", with libz %s", zlibVersion());
-#endif
-}
-
static wtap_dumper *
editcap_dump_open(const char *filename, guint32 snaplen,
wtap_optionblock_t shb_hdr,
@@ -1017,10 +982,10 @@ main(int argc, char *argv[])
#endif /* _WIN32 */
/* Get the compile-time version information string */
- comp_info_str = get_compiled_version_info(NULL, get_editcap_compiled_info);
+ comp_info_str = get_compiled_version_info(NULL, NULL);
/* Get the run-time version information string */
- runtime_info_str = get_runtime_version_info(get_editcap_runtime_info);
+ runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Editcap (Wireshark) %s\n"
diff --git a/mergecap.c b/mergecap.c
index f6fad775e3..3e93ea592a 100644
--- a/mergecap.c
+++ b/mergecap.c
@@ -34,10 +34,6 @@
#include <getopt.h>
#endif
-#ifdef HAVE_LIBZ
-#include <zlib.h> /* to get the libz version number */
-#endif
-
#include <string.h>
#include <wiretap/wtap.h>
@@ -177,38 +173,6 @@ list_idb_merge_modes(void) {
}
}
-static void
-get_mergecap_compiled_info(GString *str)
-{
- /* LIBZ */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBZ
- g_string_append(str, "with libz ");
-#ifdef ZLIB_VERSION
- g_string_append(str, ZLIB_VERSION);
-#else /* ZLIB_VERSION */
- g_string_append(str, "(version unknown)");
-#endif /* ZLIB_VERSION */
-#else /* HAVE_LIBZ */
- g_string_append(str, "without libz");
-#endif /* HAVE_LIBZ */
-}
-
-static void
-get_mergecap_runtime_info(
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- GString *str)
-#else
- GString *str _U_)
-#endif
-{
- /* zlib */
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- g_string_append_printf(str, ", with libz %s", zlibVersion());
-#endif
-}
-
-
static gboolean
merge_callback(merge_event event, int num,
const merge_in_file_t in_files[], const guint in_file_count,
@@ -317,10 +281,10 @@ main(int argc, char *argv[])
#endif /* _WIN32 */
/* Get the compile-time version information string */
- comp_info_str = get_compiled_version_info(NULL, get_mergecap_compiled_info);
+ comp_info_str = get_compiled_version_info(NULL, NULL);
/* Get the run-time version information string */
- runtime_info_str = get_runtime_version_info(get_mergecap_runtime_info);
+ runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Mergecap (Wireshark) %s\n"
diff --git a/reordercap.c b/reordercap.c
index 4b226e2251..983e13c283 100644
--- a/reordercap.c
+++ b/reordercap.c
@@ -32,10 +32,6 @@
#include <getopt.h>
#endif
-#ifdef HAVE_LIBZ
-#include <zlib.h> /* to get the libz version number */
-#endif
-
#include <wiretap/wtap.h>
#ifndef HAVE_GETOPT_LONG
@@ -151,37 +147,6 @@ frames_compare(gconstpointer a, gconstpointer b)
return nstime_cmp(time1, time2);
}
-static void
-get_reordercap_compiled_info(GString *str)
-{
- /* LIBZ */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBZ
- g_string_append(str, "with libz ");
-#ifdef ZLIB_VERSION
- g_string_append(str, ZLIB_VERSION);
-#else /* ZLIB_VERSION */
- g_string_append(str, "(version unknown)");
-#endif /* ZLIB_VERSION */
-#else /* HAVE_LIBZ */
- g_string_append(str, "without libz");
-#endif /* HAVE_LIBZ */
-}
-
-static void
-get_reordercap_runtime_info(
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- GString *str)
-#else
- GString *str _U_)
-#endif
-{
- /* zlib */
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- g_string_append_printf(str, ", with libz %s", zlibVersion());
-#endif
-}
-
#ifdef HAVE_PLUGINS
/*
* Don't report failures to load plugins because most (non-wiretap) plugins
@@ -236,10 +201,10 @@ main(int argc, char *argv[])
#endif
/* Get the compile-time version information string */
- comp_info_str = get_compiled_version_info(NULL, get_reordercap_compiled_info);
+ comp_info_str = get_compiled_version_info(NULL, NULL);
/* Get the run-time version information string */
- runtime_info_str = get_runtime_version_info(get_reordercap_runtime_info);
+ runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Reordercap (Wireshark) %s\n"
diff --git a/text2pcap.c b/text2pcap.c
index e50dad30b6..fc6b7d4e6b 100644
--- a/text2pcap.c
+++ b/text2pcap.c
@@ -126,10 +126,6 @@
#include <errno.h>
#include <assert.h>
-#ifdef HAVE_LIBZ
-#include <zlib.h> /* to get the libz version number */
-#endif
-
#ifndef HAVE_GETOPT_LONG
#include "wsutil/wsgetopt.h"
#endif
@@ -1438,32 +1434,6 @@ print_usage (FILE *output)
MAX_PACKET);
}
-static void
-get_text2pcap_compiled_info(GString *str)
-{
- /* LIBZ */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBZ
- g_string_append(str, "with libz ");
-#ifdef ZLIB_VERSION
- g_string_append(str, ZLIB_VERSION);
-#else /* ZLIB_VERSION */
- g_string_append(str, "(version unknown)");
-#endif /* ZLIB_VERSION */
-#else /* HAVE_LIBZ */
- g_string_append(str, "without libz");
-#endif /* HAVE_LIBZ */
-}
-
-static void
-get_text2pcap_runtime_info(GString *str)
-{
- /* zlib */
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- g_string_append_printf(str, ", with libz %s", zlibVersion());
-#endif
-}
-
/*----------------------------------------------------------------------
* Parse CLI options
*/
@@ -1486,10 +1456,10 @@ parse_options (int argc, char *argv[])
#endif /* _WIN32 */
/* Get the compile-time version information string */
- comp_info_str = get_compiled_version_info(NULL, get_text2pcap_compiled_info);
+ comp_info_str = get_compiled_version_info(NULL, NULL);
/* get the run-time version information string */
- runtime_info_str = get_runtime_version_info(get_text2pcap_runtime_info);
+ runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Text2pcap (Wireshark) %s\n"
diff --git a/tfshark.c b/tfshark.c
index fea110c1e5..595917cf8a 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -35,10 +35,6 @@
#include <errno.h>
-#ifdef HAVE_LIBZ
-#include <zlib.h> /* to get the libz version number */
-#endif
-
#ifndef HAVE_GETOPT_LONG
#include "wsutil/wsgetopt.h"
#endif
@@ -727,29 +723,8 @@ print_current_user(void) {
}
static void
-get_tfshark_compiled_version_info(GString *str)
-{
- /* LIBZ */
-#ifdef HAVE_LIBZ
- g_string_append(str, "with libz ");
-#ifdef ZLIB_VERSION
- g_string_append(str, ZLIB_VERSION);
-#else /* ZLIB_VERSION */
- g_string_append(str, "(version unknown)");
-#endif /* ZLIB_VERSION */
-#else /* HAVE_LIBZ */
- g_string_append(str, "without libz");
-#endif /* HAVE_LIBZ */
-}
-
-static void
get_tfshark_runtime_version_info(GString *str)
{
- /* zlib */
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- g_string_append_printf(str, ", with libz %s", zlibVersion());
-#endif
-
/* stuff used by libwireshark */
epan_get_runtime_version_info(str);
}
@@ -844,8 +819,7 @@ main(int argc, char *argv[])
initialize_funnel_ops();
/* Get the compile-time version information string */
- comp_info_str = get_compiled_version_info(get_tfshark_compiled_version_info,
- epan_get_compiled_version_info);
+ comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info);
/* Get the run-time version information string */
runtime_info_str = get_runtime_version_info(get_tfshark_runtime_version_info);
diff --git a/tshark.c b/tshark.c
index df41600762..7407e82ea8 100644
--- a/tshark.c
+++ b/tshark.c
@@ -40,10 +40,6 @@
#include <signal.h>
#endif
-#ifdef HAVE_LIBZ
-#include <zlib.h> /* to get the libz version number */
-#endif
-
#ifdef HAVE_LIBCAP
# include <sys/capability.h>
#endif
@@ -921,19 +917,6 @@ get_tshark_compiled_version_info(GString *str)
{
/* Capture libraries */
get_compiled_caplibs_version(str);
-
- /* LIBZ */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBZ
- g_string_append(str, "with libz ");
-#ifdef ZLIB_VERSION
- g_string_append(str, ZLIB_VERSION);
-#else /* ZLIB_VERSION */
- g_string_append(str, "(version unknown)");
-#endif /* ZLIB_VERSION */
-#else /* HAVE_LIBZ */
- g_string_append(str, "without libz");
-#endif /* HAVE_LIBZ */
}
static void
@@ -945,11 +928,6 @@ get_tshark_runtime_version_info(GString *str)
get_runtime_caplibs_version(str);
#endif
- /* zlib */
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- g_string_append_printf(str, ", with libz %s", zlibVersion());
-#endif
-
/* stuff used by libwireshark */
epan_get_runtime_version_info(str);
}
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index 1a4e53383d..efd56f7748 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -44,10 +44,6 @@
#include "wsutil/wsgetopt.h"
#endif
-#ifdef HAVE_LIBZ
-#include <zlib.h> /* to get the libz version number */
-#endif
-
#ifdef HAVE_EXTCAP
#include <extcap.h>
#endif
@@ -1969,19 +1965,6 @@ get_wireshark_gtk_compiled_info(GString *str)
/* Capture libraries */
g_string_append(str, ", ");
get_compiled_caplibs_version(str);
-
- /* LIBZ */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBZ
- g_string_append(str, "with libz ");
-#ifdef ZLIB_VERSION
- g_string_append(str, ZLIB_VERSION);
-#else /* ZLIB_VERSION */
- g_string_append(str, "(version unknown)");
-#endif /* ZLIB_VERSION */
-#else /* HAVE_LIBZ */
- g_string_append(str, "without libz");
-#endif /* HAVE_LIBZ */
}
static void
@@ -2018,11 +2001,6 @@ get_wireshark_runtime_info(GString *str)
get_runtime_caplibs_version(str);
#endif
- /* zlib */
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- g_string_append_printf(str, ", with libz %s", zlibVersion());
-#endif
-
/* stuff used by libwireshark */
epan_get_runtime_version_info(str);
diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp
index ec2d74b4f2..5c474a69bc 100644
--- a/wireshark-qt.cpp
+++ b/wireshark-qt.cpp
@@ -27,10 +27,6 @@
#include <signal.h>
#endif
-#ifdef HAVE_LIBZ
-#include <zlib.h> /* to get the libz version number */
-#endif
-
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
@@ -311,19 +307,6 @@ get_wireshark_qt_compiled_info(GString *str)
/* Capture libraries */
g_string_append(str, ", ");
get_compiled_caplibs_version(str);
-
- /* LIBZ */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBZ
- g_string_append(str, "with libz ");
-#ifdef ZLIB_VERSION
- g_string_append(str, ZLIB_VERSION);
-#else /* ZLIB_VERSION */
- g_string_append(str, "(version unknown)");
-#endif /* ZLIB_VERSION */
-#else /* HAVE_LIBZ */
- g_string_append(str, "without libz");
-#endif /* HAVE_LIBZ */
}
// xxx copied from ../gtk/main.c
@@ -357,11 +340,6 @@ get_wireshark_runtime_info(GString *str)
get_runtime_caplibs_version(str);
#endif
- /* zlib */
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
- g_string_append_printf(str, ", with libz %s", zlibVersion());
-#endif
-
/* stuff used by libwireshark */
epan_get_runtime_version_info(str);
diff --git a/wsutil/ws_version_info.c b/wsutil/ws_version_info.c
index 8298e8226e..e479ab1942 100644
--- a/wsutil/ws_version_info.c
+++ b/wsutil/ws_version_info.c
@@ -33,6 +33,10 @@
#include <glib.h>
+#ifdef HAVE_LIBZ
+#include <zlib.h>
+#endif
+
#include "version.h"
#include <wsutil/ws_version_info.h>
@@ -71,6 +75,20 @@ end_string(GString *str)
}
}
+static const gchar *
+get_zlib_compiled_version_info(void)
+{
+#ifdef HAVE_LIBZ
+#ifdef ZLIB_VERSION
+ return "with libz "ZLIB_VERSION;
+#else
+ return "with libz (version unknown)";
+#endif /* ZLIB_VERSION */
+#else
+ return "without libz";
+#endif /* HAVE_LIBZ */
+}
+
/*
* Get various library compile-time versions, put them in a GString,
* and return the GString.
@@ -112,6 +130,8 @@ get_compiled_version_info(void (*prepend_info)(GString *),
"GLib (version unknown)");
#endif
+ g_string_append_printf(str, ", %s", get_zlib_compiled_version_info());
+
/* Additional application-dependent information */
if (append_info)
(*append_info)(str);
@@ -334,6 +354,11 @@ get_runtime_version_info(void (*additional_info)(GString *))
if (additional_info)
(*additional_info)(str);
+ /* zlib */
+#if defined(HAVE_LIBZ) && !defined(_WIN32)
+ g_string_append_printf(str, ", with libz %s", zlibVersion());
+#endif
+
g_string_append(str, ".");
/* CPU Info */