Restrict the depth of the protocol tree.
[metze/wireshark/wip.git] / captype.c
index 3dc8f73f291f02c31dd1e5067b1ccf68f4dc7690..50f1823f95b83dc7a753143c8a311887bd9a4b68 100644 (file)
--- a/captype.c
+++ b/captype.c
 #include <locale.h>
 #include <errno.h>
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>
 #endif
 
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#ifdef HAVE_LIBZ
-#include <zlib.h>     /* to get the libz version number */
-#endif
-
 #include <glib.h>
 
-#include <wsutil/privileges.h>
-#include <wsutil/filesystem.h>
-#include <wsutil/file_util.h>
+#include <wiretap/wtap.h>
+
 #include <wsutil/crash_info.h>
-#include <wsutil/os_version_info.h>
+#include <wsutil/file_util.h>
+#include <wsutil/filesystem.h>
+#include <wsutil/privileges.h>
 #include <wsutil/ws_version_info.h>
 
 #ifdef HAVE_PLUGINS
 #include <wsutil/plugins.h>
 #endif
 
-#include "wtap.h"
 #include <wsutil/report_err.h>
-#include <wsutil/privileges.h>
 #include <wsutil/str_util.h>
 
 #ifdef _WIN32
@@ -74,8 +61,6 @@
 #include "wsutil/wsgetopt.h"
 #endif
 
-#include "version_info.h"
-
 static void
 print_usage(FILE *output)
 {
@@ -96,32 +81,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(GString *str)
-{
-  /* zlib */
-#if defined(HAVE_LIBZ) && !defined(_WIN32)
-  g_string_append_printf(str, ", with libz %s", zlibVersion());
-#endif
-}
-
 int
 main(int argc, char *argv[])
 {
@@ -134,8 +93,8 @@ main(int argc, char *argv[])
   int    opt;
   int    overall_error_status;
   static const struct option long_options[] = {
-      {(char *)"help", no_argument, NULL, 'h'},
-      {(char *)"version", no_argument, NULL, 'v'},
+      {"help", no_argument, NULL, 'h'},
+      {"version", no_argument, NULL, 'v'},
       {0, 0, 0, 0 }
   };
 
@@ -143,13 +102,14 @@ main(int argc, char *argv[])
   char  *init_progfile_dir_error;
 #endif
 
-  /* Assemble the compile-time version information string */
-  comp_info_str = g_string_new("Compiled ");
-  get_compiled_version_info(comp_info_str, NULL, get_captype_compiled_info);
+  /* Set the C-language locale to the native environment. */
+  setlocale(LC_ALL, "");
+
+  /* Get the compile-time version information string */
+  comp_info_str = get_compiled_version_info(NULL, NULL);
 
-  /* Assemble the run-time version information string */
-  runtime_info_str = g_string_new("Running ");
-  get_runtime_version_info(runtime_info_str, get_captype_runtime_info);
+  /* Get the run-time version information string */
+  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"
@@ -197,7 +157,7 @@ main(int argc, char *argv[])
       case 'h':
         printf("Captype (Wireshark) %s\n"
                "Print the file types of capture files.\n"
-               "See http://www.wireshark.org for more information.\n",
+               "See https://www.wireshark.org for more information.\n",
                get_ws_vcs_version_info());
         print_usage(stdout);
         exit(0);
@@ -217,9 +177,6 @@ main(int argc, char *argv[])
     }
   }
 
-  /* Set the C-language locale to the native environment. */
-  setlocale(LC_ALL, "");
-
   if (argc < 2) {
     print_usage(stderr);
     return 1;