Make --help and --version information a bit more uniform.
[metze/wireshark/wip.git] / dumpcap.c
index 100be013192b9031a28bd96976a1ff9cae63198c..10a782fea44c06f98f3d930455099053fea47d5b 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -556,14 +556,12 @@ print_usage(FILE *output)
 static void
 show_version(GString *comp_info_str, GString *runtime_info_str)
 {
-    printf(
-        "Dumpcap (Wireshark) %s\n"
-        "\n"
-        "%s\n"
-        "%s\n"
-        "%s\n"
-        "See http://www.wireshark.org for more information.\n",
-        get_ws_vcs_version_info(), get_copyright_info(), comp_info_str->str, runtime_info_str->str);
+    printf("Dumpcap (Wireshark) %s\n"
+           "\n"
+           "%s\n"
+           "%s\n"
+           "%s",
+           get_ws_vcs_version_info(), get_copyright_info(), comp_info_str->str, runtime_info_str->str);
 }
 
 /*
@@ -4156,6 +4154,56 @@ out:
     return ret;
 }
 
+static void
+get_dumpcap_compiled_info(GString *str)
+{
+       /* Libpcap */
+       g_string_append(str, ", ");
+       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 */
+
+#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_dumpcap_runtime_info(GString *str)
 {
@@ -4216,7 +4264,7 @@ 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, NULL);
+    get_compiled_version_info(comp_info_str, NULL, get_dumpcap_compiled_info);
 
     /* Assemble the run-time version information string */
     runtime_info_str = g_string_new("Running ");