summaryrefslogtreecommitdiff
path: root/tshark.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-07-03 01:45:32 -0700
committerGuy Harris <guy@alum.mit.edu>2014-07-03 08:46:01 +0000
commitb4ce352539ec1e88a8002c65a38cc3029860c0e0 (patch)
treef2c702b2722c20464477e5f85cb5c80abab31915 /tshark.c
parentd70e56a733a1d432dedc0dce7fbd992ef225d0c5 (diff)
downloadwireshark-b4ce352539ec1e88a8002c65a38cc3029860c0e0.tar.gz
Make --help and --version information a bit more uniform.
Have --version print the version number, the copyright information, the "compiled with" information, the "running on/with" information, and the compiler information. Have --help print the version number, a one-line summary of what the program does, a reference to http://www.wireshark.org for more information, a Usage: line, and a list of command-line options. This means programs doing that don't need to include version.h; that's left up to get_ws_vcs_version_info() to do. Change-Id: Idac641bc10e4dfd04c9914d379b3a3e0cc5ca8cb Reviewed-on: https://code.wireshark.org/review/2794 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c66
1 files changed, 61 insertions, 5 deletions
diff --git a/tshark.c b/tshark.c
index cbc5a59b44..cebbd08a43 100644
--- a/tshark.c
+++ b/tshark.c
@@ -901,12 +901,67 @@ show_version(GString *comp_info_str, GString *runtime_info_str)
"%s"
"\n"
"%s",
- get_ws_vcs_version_info(), get_copyright_info(), comp_info_str->str,
- runtime_info_str->str);
+ get_ws_vcs_version_info(), get_copyright_info(),
+ comp_info_str->str, runtime_info_str->str);
}
static void
-get_tshark_runtime_info(GString *str)
+get_tshark_compiled_version_info(GString *str)
+{
+ /* Libpcap */
+ get_compiled_pcap_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 - these libraries are actually used only by dumpcap,
+ * but we mention them here so that a user reporting a bug
+ * can get information about dumpcap's libraries without
+ * having to run dumpcap.
+ */
+#ifndef _WIN32
+ /* This is UN*X-only. */
+ /* LIBCAP */
+ g_string_append(str, ", ");
+#ifdef HAVE_LIBCAP
+ g_string_append(str, "with POSIX capabilities");
+#ifdef _LINUX_CAPABILITY_VERSION
+ g_string_append(str, " (Linux)");
+#endif /* _LINUX_CAPABILITY_VERSION */
+#else /* HAVE_LIBCAP */
+ g_string_append(str, "without POSIX capabilities");
+#endif /* HAVE_LIBCAP */
+#endif /* _WIN32 */
+
+#ifdef __linux__
+ /* This is a Linux-specific library. */
+ /* LIBNL */
+ g_string_append(str, ", ");
+#if defined(HAVE_LIBNL1)
+ g_string_append(str, "with libnl 1");
+#elif defined(HAVE_LIBNL2)
+ g_string_append(str, "with libnl 2");
+#elif defined(HAVE_LIBNL3)
+ g_string_append(str, "with libnl 3");
+#else /* no libnl */
+ g_string_append(str, "without libnl");
+#endif /* libnl version */
+#endif /* __linux__ */
+}
+
+static void
+get_tshark_runtime_version_info(GString *str)
{
#ifdef HAVE_LIBPCAP
/* Libpcap */
@@ -1031,11 +1086,12 @@ main(int argc, char *argv[])
/* Assemble the compile-time version information string */
comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, NULL, epan_get_compiled_version_info);
+ get_compiled_version_info(comp_info_str, get_tshark_compiled_version_info,
+ epan_get_compiled_version_info);
/* Assemble the run-time version information string */
runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, get_tshark_runtime_info);
+ get_runtime_version_info(runtime_info_str, get_tshark_runtime_version_info);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("TShark (Wireshark) %s\n"