aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-12-12 18:16:15 -0800
committerGuy Harris <guy@alum.mit.edu>2018-12-13 03:16:13 +0000
commit43dfd45faa8af0b239a671b25ab6a398fa32f5c6 (patch)
tree3ea329a4f3f702e279169382614dcaf553e79431 /ui
parenta34cc98b2ac5a0ad011a1c3a40ce5e59230a9498 (diff)
Move more version-info-related stuff to version_info.c.
Have a ws_init_version_info() routine that, given an application name string: constructs the app-name-and-version-information string, and saves it; adds the initial crash information on platforms that support it, and saves it. Have show_version() use the saved information and take no arguments. Add a show_help_header() routine to print the header for --help command-line options, given a description of the application; it prints the application name and version information, the description, and the "See {wireshark.org URL}" line. Use those routines in various places, including providing the "application name" string in pcapng SHBs. Change-Id: I0042a8fcc91aa919ad5c381a8b8674a007ce66df Reviewed-on: https://code.wireshark.org/review/31029 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui')
-rw-r--r--ui/commandline.c10
-rw-r--r--ui/commandline.h3
-rw-r--r--ui/qt/main.cpp22
-rw-r--r--ui/tap_export_pdu.c2
4 files changed, 8 insertions, 29 deletions
diff --git a/ui/commandline.c b/ui/commandline.c
index 7c0768a0b5..fc3c375a03 100644
--- a/ui/commandline.c
+++ b/ui/commandline.c
@@ -63,11 +63,8 @@ commandline_print_usage(gboolean for_help_option) {
#endif
if (for_help_option) {
+ show_help_header("Interactively dump and analyze network traffic.");
output = stdout;
- fprintf(output, "Wireshark %s\n"
- "Interactively dump and analyze network traffic.\n"
- "See https://www.wireshark.org for more information.\n",
- get_ws_vcs_version_info());
} else {
output = stderr;
}
@@ -204,8 +201,7 @@ static void print_no_capture_support_error(void)
}
#endif
-void commandline_early_options(int argc, char *argv[],
- GString *comp_info_str, GString *runtime_info_str)
+void commandline_early_options(int argc, char *argv[])
{
int opt;
#ifdef HAVE_LIBPCAP
@@ -305,7 +301,7 @@ void commandline_early_options(int argc, char *argv[],
#ifdef _WIN32
create_console();
#endif
- show_version("Wireshark", comp_info_str, runtime_info_str);
+ show_version();
#ifdef _WIN32
destroy_console();
#endif
diff --git a/ui/commandline.h b/ui/commandline.h
index e88b0e16f7..a93d6d6bca 100644
--- a/ui/commandline.h
+++ b/ui/commandline.h
@@ -17,8 +17,7 @@ extern "C" {
extern void commandline_print_usage(gboolean for_help_option);
-extern void commandline_early_options(int argc, char *argv[],
- GString *comp_info_str, GString *runtime_info_str);
+extern void commandline_early_options(int argc, char *argv[]);
/* Command-line options that don't have direct API calls to handle the data */
typedef struct commandline_param_info
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index 351f71985e..a4c27a97fb 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -30,7 +30,6 @@
#include <wsutil/clopts_common.h>
#include <wsutil/cmdarg_err.h>
-#include <wsutil/crash_info.h>
#include <wsutil/filesystem.h>
#include <wsutil/privileges.h>
#ifdef HAVE_PLUGINS
@@ -380,8 +379,6 @@ int main(int argc, char *qt_argv[])
#endif
#endif
gchar *err_msg = NULL;
- GString *comp_info_str = NULL;
- GString *runtime_info_str = NULL;
QString dfilter, read_filter;
#ifdef HAVE_LIBPCAP
@@ -496,11 +493,8 @@ int main(int argc, char *qt_argv[])
#endif /* _WIN32 */
/* Get the compile-time version information string */
- comp_info_str = get_compiled_version_info(get_wireshark_qt_compiled_info,
- get_gui_compiled_info);
-
- /* Assemble the run-time version information string */
- runtime_info_str = get_runtime_version_info(get_wireshark_runtime_info);
+ ws_init_version_info("Wireshark", get_wireshark_qt_compiled_info,
+ get_gui_compiled_info, get_wireshark_runtime_info);
/* Create the user profiles directory */
if (create_profiles_dir(&rf_path) == -1) {
@@ -522,7 +516,7 @@ int main(int argc, char *qt_argv[])
g_free(rf_path);
}
- commandline_early_options(argc, argv, comp_info_str, runtime_info_str);
+ commandline_early_options(argc, argv);
#ifdef _WIN32
reset_library_path();
@@ -554,16 +548,6 @@ int main(int argc, char *qt_argv[])
QString cf_name;
unsigned int in_file_type = WTAP_TYPE_AUTO;
- /* Add it to the information to be reported on a crash. */
- ws_add_crash_info("Wireshark %s\n"
- "\n"
- "%s"
- "\n"
- "%s",
- get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
- g_string_free(comp_info_str, TRUE);
- g_string_free(runtime_info_str, TRUE);
-
#ifdef _WIN32
/* Start windows sockets */
result = WSAStartup( MAKEWORD( 1, 1 ), &wsaData );
diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c
index 5b8165de70..25232f0452 100644
--- a/ui/tap_export_pdu.c
+++ b/ui/tap_export_pdu.c
@@ -119,7 +119,7 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment)
* UTF-8 string containing the name of the application used to create
* this section.
*/
- wtap_block_add_string_option_format(shb_hdr, OPT_SHB_USERAPPL, "Wireshark %s", get_ws_vcs_version_info());
+ wtap_block_add_string_option_format(shb_hdr, OPT_SHB_USERAPPL, "%s", get_appname_and_version());
/* Create fake IDB info */
exp_pdu_tap_data->idb_inf = g_new(wtapng_iface_descriptions_t,1);