aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-06-21 18:02:27 -0700
committerGuy Harris <guy@alum.mit.edu>2014-06-22 01:06:25 +0000
commitc46329c27b8c31729d2d51dc4f69da9b3923de04 (patch)
tree196522550c36225b4248bc8c6ed2fb86d5b0ddab
parenta70dea195625f32a026d10d937345d177f81aead (diff)
Add a routine to return a version string including VCS information.
Add a routine get_ws_vcs_version_info() that, for builds from a tree checked out from Wireshark's version control system, returns a string that includes both the Wireshark version number and an indication of what particular VCS version was checked out, and just returns Wireshark's version number for other builds. Use that routine rather than manually gluing VERSION and the Git version number together. ("vcs", not "git", just in case we do something bizarre or mercurial some day. :-)) Change-Id: Ie5c6dc83b9d3f56655eaef30fec3ec9916b6320d Reviewed-on: https://code.wireshark.org/review/2529 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--dumpcap.c17
-rw-r--r--echld/dispatcher.c4
-rw-r--r--epan/print.c2
-rw-r--r--file.c5
-rw-r--r--rawshark.c14
-rw-r--r--tshark.c19
-rw-r--r--ui/gtk/about_dlg.c6
-rw-r--r--ui/gtk/file_import_dlg.c4
-rw-r--r--ui/gtk/follow_stream.c5
-rw-r--r--ui/gtk/main.c13
-rw-r--r--ui/gtk/main_titlebar.c4
-rw-r--r--ui/gtk/main_welcome.c6
-rw-r--r--ui/gtk/summary_dlg.c5
-rw-r--r--ui/qt/about_dialog.cpp6
-rw-r--r--ui/qt/main.cpp13
-rw-r--r--ui/qt/summary_dialog.cpp4
-rw-r--r--ui/qt/summary_dialog.h2
-rw-r--r--ui/tap_export_pdu.c4
-rw-r--r--version_info.c8
-rw-r--r--version_info.h5
-rw-r--r--wsutil/CMakeLists.txt1
-rw-r--r--wsutil/Makefile.common7
-rw-r--r--wsutil/ws_version_info.c44
-rw-r--r--wsutil/ws_version_info.h44
24 files changed, 162 insertions, 80 deletions
diff --git a/dumpcap.c b/dumpcap.c
index 3a8f4093c7..f25d6f060d 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -69,6 +69,7 @@
#include <wsutil/crash_info.h>
#include <wsutil/copyright_info.h>
+#include <wsutil/ws_version_info.h>
#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
@@ -477,10 +478,10 @@ print_usage(gboolean print_ver)
if (print_ver) {
output = stdout;
fprintf(output,
- "Dumpcap " VERSION "%s\n"
+ "Dumpcap %s\n"
"Capture network packets and dump them into a pcapng file.\n"
"See http://www.wireshark.org for more information.\n",
- wireshark_gitversion);
+ get_ws_vcs_version_info());
} else {
output = stderr;
}
@@ -564,13 +565,13 @@ static void
show_version(GString *comp_info_str, GString *runtime_info_str)
{
printf(
- "Dumpcap " VERSION "%s\n"
+ "Dumpcap %s\n"
"\n"
"%s\n"
"%s\n"
"%s\n"
"See http://www.wireshark.org for more information.\n",
- wireshark_gitversion, 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);
}
/*
@@ -2877,7 +2878,7 @@ capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *err
os_info_str = g_string_new("");
get_os_version_info(os_info_str);
- g_snprintf(appname, sizeof(appname), "Dumpcap " VERSION "%s", wireshark_gitversion);
+ g_snprintf(appname, sizeof(appname), "Dumpcap %s", get_ws_vcs_version_info());
successful = pcapng_write_session_header_block(ld->pdh,
(const char *)capture_opts->capture_comment, /* Comment*/
NULL, /* HW*/
@@ -3370,7 +3371,7 @@ do_file_switch_or_stop(capture_options *capture_opts,
os_info_str = g_string_new("");
get_os_version_info(os_info_str);
- g_snprintf(appname, sizeof(appname), "Dumpcap " VERSION "%s", wireshark_gitversion);
+ g_snprintf(appname, sizeof(appname), "Dumpcap %s", get_ws_vcs_version_info());
successful = pcapng_write_session_header_block(global_ld.pdh,
NULL, /* Comment */
NULL, /* HW */
@@ -4223,12 +4224,12 @@ main(int argc, char *argv[])
get_runtime_version_info(runtime_info_str, NULL);
/* Add it to the information to be reported on a crash. */
- ws_add_crash_info("Dumpcap " VERSION "%s\n"
+ ws_add_crash_info("Dumpcap %s\n"
"\n"
"%s"
"\n"
"%s",
- wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
+ get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);
diff --git a/echld/dispatcher.c b/echld/dispatcher.c
index ac9ef8dc44..82155f6965 100644
--- a/echld/dispatcher.c
+++ b/echld/dispatcher.c
@@ -495,8 +495,8 @@ static void preinit_epan(char* argv0, int (*main)(int, char **)) {
}
/* Add it to the information to be reported on a crash. */
- ws_add_crash_info("Echld " VERSION "%s\n%s\n%s",
- wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
+ ws_add_crash_info("Echld %s\n%s\n%s",
+ ws_get_version_info(), comp_info_str->str, runtime_info_str->str);
init_stuff();
diff --git a/epan/print.c b/epan/print.c
index ea1cbae114..3789443134 100644
--- a/epan/print.c
+++ b/epan/print.c
@@ -1232,7 +1232,7 @@ print_preamble_ps(print_stream_t *self, gchar *filename, const char *version_str
fputs("%% the page title\n", output->fh);
ps_clean_string(psbuffer, filename, MAX_PS_LINE_LENGTH);
- fprintf(output->fh, "/ws_pagetitle (%s - Wireshark " VERSION "%s) def\n", psbuffer, version_string);
+ fprintf(output->fh, "/ws_pagetitle (%s - Wireshark %s) def\n", psbuffer, version_string);
fputs("\n", output->fh);
return !ferror(output->fh);
}
diff --git a/file.c b/file.c
index b56718c81f..53b5e55bb3 100644
--- a/file.c
+++ b/file.c
@@ -42,6 +42,7 @@
#include <wsutil/tempfile.h>
#include <wsutil/file_util.h>
#include <wsutil/filesystem.h>
+#include <wsutil/ws_version_info.h>
#include <wiretap/merge.h>
@@ -76,8 +77,6 @@
#include "ui/progress_dlg.h"
#include "ui/ui_util.h"
-#include "version_info.h"
-
/* Needed for addrinfo */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
@@ -2622,7 +2621,7 @@ cf_print_packets(capture_file *cf, print_args_t *print_args)
callback_args.num_visible_cols = 0;
callback_args.visible_cols = NULL;
- if (!print_preamble(print_args->stream, cf->filename, wireshark_gitversion)) {
+ if (!print_preamble(print_args->stream, cf->filename, get_ws_vcs_version_info())) {
destroy_print_stream(print_args->stream);
return CF_PRINT_WRITE_ERROR;
}
diff --git a/rawshark.c b/rawshark.c
index 48988559e7..5e0e629e15 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -102,6 +102,8 @@
#include <wiretap/libpcap.h>
#include <wiretap/pcap-encap.h>
+#include <wsutil/ws_version_info.h>
+
#ifdef HAVE_LIBPCAP
#include <setjmp.h>
#include "capture-pcap-util.h"
@@ -189,12 +191,12 @@ print_usage(gboolean print_ver)
if (print_ver) {
output = stdout;
fprintf(output,
- "Rawshark " VERSION "%s\n"
+ "Rawshark %s\n"
"Dump and analyze network traffic.\n"
"See http://www.wireshark.org for more information.\n"
"\n"
"%s",
- wireshark_gitversion, get_copyright_info());
+ get_ws_vcs_version_info(), get_copyright_info());
} else {
output = stderr;
}
@@ -427,14 +429,14 @@ set_link_type(const char *lt_arg) {
static void
show_version(GString *comp_info_str, GString *runtime_info_str)
{
- printf("Rawshark " VERSION "%s\n"
+ printf("Rawshark %s\n"
"\n"
"%s"
"\n"
"%s"
"\n"
"%s",
- wireshark_gitversion, get_copyright_info(), comp_info_str->str,
+ get_ws_vcs_version_info(), get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
}
@@ -480,12 +482,12 @@ main(int argc, char *argv[])
get_runtime_version_info(runtime_info_str, NULL);
/* Add it to the information to be reported on a crash. */
- ws_add_crash_info("Rawshark " VERSION "%s\n"
+ ws_add_crash_info("Rawshark %s\n"
"\n"
"%s"
"\n"
"%s",
- wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
+ get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);
diff --git a/tshark.c b/tshark.c
index b761c7270b..70db566b68 100644
--- a/tshark.c
+++ b/tshark.c
@@ -67,6 +67,7 @@
#include <wsutil/report_err.h>
#include <wsutil/copyright_info.h>
#include <wsutil/os_version_info.h>
+#include <wsutil/ws_version_info.h>
#include "globals.h"
#include <epan/timestamp.h>
@@ -276,12 +277,12 @@ print_usage(gboolean print_ver)
if (print_ver) {
output = stdout;
fprintf(output,
- "TShark " VERSION "%s\n"
+ "TShark %s\n"
"Dump and analyze network traffic.\n"
"See http://www.wireshark.org for more information.\n"
"\n"
"%s",
- wireshark_gitversion, get_copyright_info());
+ get_ws_vcs_version_info(), get_copyright_info());
} else {
output = stderr;
}
@@ -403,7 +404,7 @@ glossary_option_help(void)
output = stdout;
- fprintf(output, "TShark " VERSION "%s\n", wireshark_gitversion);
+ fprintf(output, "TShark %s\n", get_ws_vcs_version_info());
fprintf(output, "\n");
fprintf(output, "Usage: tshark -G [report]\n");
@@ -906,14 +907,14 @@ check_capture_privs(void) {
static void
show_version(GString *comp_info_str, GString *runtime_info_str)
{
- printf("TShark " VERSION "%s\n"
+ printf("TShark %s\n"
"\n"
"%s"
"\n"
"%s"
"\n"
"%s",
- wireshark_gitversion, get_copyright_info(), comp_info_str->str,
+ get_ws_vcs_version_info(), get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
}
@@ -991,12 +992,12 @@ main(int argc, char *argv[])
get_runtime_version_info(runtime_info_str, NULL);
/* Add it to the information to be reported on a crash. */
- ws_add_crash_info("TShark " VERSION "%s\n"
+ ws_add_crash_info("TShark %s\n"
"\n"
"%s"
"\n"
"%s",
- wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
+ get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);
@@ -3084,7 +3085,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
}
/* If we don't have an application name add Tshark */
if (shb_hdr->shb_user_appl == NULL) {
- g_snprintf(appname, sizeof(appname), "TShark " VERSION "%s", wireshark_gitversion);
+ g_snprintf(appname, sizeof(appname), "TShark %s", get_ws_vcs_version_info());
shb_hdr->shb_user_appl = appname;
}
@@ -3584,7 +3585,7 @@ write_preamble(capture_file *cf)
switch (output_action) {
case WRITE_TEXT:
- return print_preamble(print_stream, cf ? cf->filename : NULL, wireshark_gitversion);
+ return print_preamble(print_stream, cf ? cf->filename : NULL, get_ws_vcs_version_info());
case WRITE_XML:
if (print_details)
diff --git a/ui/gtk/about_dlg.c b/ui/gtk/about_dlg.c
index 904680e5d2..a7b251defc 100644
--- a/ui/gtk/about_dlg.c
+++ b/ui/gtk/about_dlg.c
@@ -30,6 +30,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/plugins.h>
#include <wsutil/copyright_info.h>
+#include <wsutil/ws_version_info.h>
#ifdef HAVE_LIBSMI
#include <epan/oids.h>
#endif
@@ -41,7 +42,6 @@
#endif
#include "../log.h"
-#include "../version_info.h"
#include "../register.h"
#include "ui/last_open_dir.h"
@@ -314,7 +314,7 @@ about_wireshark_page_new(void)
/* Construct the message string */
message = g_strdup_printf(
- "Version " VERSION "%s\n"
+ "Version %s\n"
"\n"
"%s"
"\n"
@@ -325,7 +325,7 @@ about_wireshark_page_new(void)
"Wireshark is Open Source Software released under the GNU General Public License.\n"
"\n"
"Check the man page and http://www.wireshark.org for more information.",
- wireshark_gitversion, get_copyright_info(), comp_info_str->str,
+ get_ws_vcs_version_info(), get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
msg_label = gtk_label_new(message);
diff --git a/ui/gtk/file_import_dlg.c b/ui/gtk/file_import_dlg.c
index d2a288d34f..fc0c4ec384 100644
--- a/ui/gtk/file_import_dlg.c
+++ b/ui/gtk/file_import_dlg.c
@@ -31,7 +31,6 @@
#include "globals.h"
#include "wtap.h"
#include "pcap-encap.h"
-#include "version_info.h"
#include "ui/simple_dialog.h"
#include "ui/alert_box.h"
@@ -51,6 +50,7 @@
#include "wsutil/file_util.h"
#include "wsutil/tempfile.h"
#include "wsutil/os_version_info.h"
+#include "wsutil/ws_version_info.h"
#define INPUT_FRM_KEY "input_frame"
@@ -474,7 +474,7 @@ file_import_open(text_import_info_t *info)
os_info_str = g_string_new("");
get_os_version_info(os_info_str);
- g_snprintf(appname, sizeof(appname), "Wireshark " VERSION "%s", wireshark_gitversion);
+ g_snprintf(appname, sizeof(appname), "Wireshark %s", get_ws_vcs_version_info());
shb_hdr = g_new(wtapng_section_t,1);
shb_hdr->section_length = -1;
diff --git a/ui/gtk/follow_stream.c b/ui/gtk/follow_stream.c
index 16a8898530..3b548efc52 100644
--- a/ui/gtk/follow_stream.c
+++ b/ui/gtk/follow_stream.c
@@ -44,6 +44,7 @@
#include <ui/simple_dialog.h>
#include <wsutil/file_util.h>
+#include <wsutil/ws_version_info.h>
#include "ui/gtk/color_utils.h"
#include "ui/gtk/stock_icons.h"
@@ -61,8 +62,6 @@
#include "ui/win32/print_win32.h"
#endif
-#include "version_info.h"
-
/* static variable declarations to speed up the performance
* of follow_load_text and follow_add_to_gtk_text
*/
@@ -458,7 +457,7 @@ follow_print_stream(GtkWidget * w _U_, gpointer data)
return;
}
- if (!print_preamble(stream, cfile.filename, wireshark_gitversion))
+ if (!print_preamble(stream, cfile.filename, get_ws_vcs_version_info()))
goto print_error;
switch (follow_read_stream(follow_info, follow_print_text, stream)) {
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index 1d29eb2402..a1caf1acfa 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -64,6 +64,7 @@
#include <wsutil/u3.h>
#include <wsutil/copyright_info.h>
#include <wsutil/os_version_info.h>
+#include <wsutil/ws_version_info.h>
#include <wiretap/merge.h>
@@ -1165,12 +1166,12 @@ print_usage(gboolean print_ver) {
if (print_ver) {
output = stdout;
- fprintf(output, "Wireshark " VERSION "%s\n"
+ fprintf(output, "Wireshark %s\n"
"Interactively dump and analyze network traffic.\n"
"See http://www.wireshark.org for more information.\n"
"\n"
"%s",
- wireshark_gitversion, get_copyright_info());
+ get_ws_vcs_version_info(), get_copyright_info());
} else {
output = stderr;
}
@@ -1260,14 +1261,14 @@ print_usage(gboolean print_ver) {
static void
show_version(void)
{
- printf(PACKAGE " " VERSION "%s\n"
+ printf(PACKAGE " %s\n"
"\n"
"%s"
"\n"
"%s"
"\n"
"%s",
- wireshark_gitversion, get_copyright_info(), comp_info_str->str,
+ get_ws_vcs_version_info(), get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
}
@@ -2253,12 +2254,12 @@ main(int argc, char *argv[])
get_runtime_version_info(runtime_info_str, get_gui_runtime_info);
#ifdef _WIN32
- ws_add_crash_info(PACKAGE " " VERSION "%s\n"
+ ws_add_crash_info(PACKAGE " %s\n"
"\n"
"%s"
"\n"
"%s",
- wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
+ get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
/* Start windows sockets */
WSAStartup( MAKEWORD( 1, 1 ), &wsaData );
diff --git a/ui/gtk/main_titlebar.c b/ui/gtk/main_titlebar.c
index b703f43cc7..caf70ece9f 100644
--- a/ui/gtk/main_titlebar.c
+++ b/ui/gtk/main_titlebar.c
@@ -33,7 +33,7 @@
#include "gui_utils.h"
#include "main_titlebar.h"
-#include "../version_info.h"
+#include <wsutil/ws_version_info.h>
/*
* Key to attach the "un-decorated" title to the window, so that if the
@@ -76,7 +76,7 @@ main_titlebar_update(void)
if ((prefs.gui_version_placement == version_title_only) ||
(prefs.gui_version_placement == version_both)) {
gchar *old_title = title;
- title = g_strdup_printf("%s [Wireshark %s %s]", title, VERSION, wireshark_gitversion);
+ title = g_strdup_printf("%s [Wireshark %s]", title, get_ws_vcs_version_info());
g_free(old_title);
}
gtk_window_set_title(GTK_WINDOW(top_level), title);
diff --git a/ui/gtk/main_welcome.c b/ui/gtk/main_welcome.c
index 674a63984b..ca34a12230 100644
--- a/ui/gtk/main_welcome.c
+++ b/ui/gtk/main_welcome.c
@@ -37,6 +37,7 @@
#include <wsutil/file_util.h>
#include <wsutil/str_util.h>
+#include <wsutil/ws_version_info.h>
#ifdef HAVE_LIBPCAP
#include "ui/iface_lists.h"
@@ -65,7 +66,6 @@
#include "ui/gtk/webbrowser.h"
#endif
#endif /* HAVE_LIBPCAP */
-#include "../version_info.h"
#ifdef _WIN32
#include <tchar.h>
@@ -335,8 +335,8 @@ welcome_header_set_message(gchar *msg) {
if ((prefs.gui_version_placement == version_welcome_only) ||
(prefs.gui_version_placement == version_both)) {
- g_string_append_printf(message, "</span>\n<span size=\"large\" foreground=\"white\">Version " VERSION "%s",
- wireshark_gitversion);
+ g_string_append_printf(message, "</span>\n<span size=\"large\" foreground=\"white\">Version %s",
+ get_ws_vcs_version_info());
}
}
diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c
index b01a62138e..ef53201528 100644
--- a/ui/gtk/summary_dlg.c
+++ b/ui/gtk/summary_dlg.c
@@ -31,11 +31,12 @@
#include <wiretap/wtap.h>
+#include <wsutil/ws_version_info.h>
+
#include "../globals.h"
#include "../file.h"
#include "../summary.h"
#include "../capture-pcap-util.h"
-#include "../version_info.h"
#ifdef HAVE_LIBPCAP
#include "../capture.h"
@@ -666,7 +667,7 @@ summary_to_texbuff(GtkTextBuffer *buffer)
#endif
/* Add Wireshark version*/
- g_snprintf(string_buff, SUM_STR_MAX, "Summary created by Wireshark %s\n\n", wireshark_gitversion);
+ g_snprintf(string_buff, SUM_STR_MAX, "Summary created by Wireshark %s\n\n", get_ws_vcs_version_info());
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);
/* Info about file */
diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp
index c0c3fb610c..231645ee4f 100644
--- a/ui/qt/about_dialog.cpp
+++ b/ui/qt/about_dialog.cpp
@@ -38,7 +38,6 @@
#endif
#include "../log.h"
-#include "../version_info.h"
#include "../register.h"
#include "ui/text_import_scanner.h"
@@ -51,6 +50,7 @@
#include "wsutil/tempfile.h"
#include "wsutil/plugins.h"
#include "wsutil/copyright_info.h"
+#include "wsutil/ws_version_info.h"
#include "qt_ui_utils.h"
@@ -136,7 +136,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
/* Construct the message string */
message = QString(
- "Version " VERSION "%1\n"
+ "Version %1\n"
"\n"
"%2"
"\n"
@@ -147,7 +147,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
"Wireshark is Open Source Software released under the GNU General Public License.\n"
"\n"
"Check the man page and http://www.wireshark.org for more information.")
- .arg(wireshark_gitversion).arg(get_copyright_info()).arg(comp_info_str->str)
+ .arg(get_ws_vcs_version_info()).arg(get_copyright_info()).arg(comp_info_str->str)
.arg(runtime_info_str->str);
ui->label_wireshark->setTextInteractionFlags(Qt::TextSelectableByMouse);
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index 20b06ae0c7..bcf4f62634 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -47,6 +47,7 @@
#include <wsutil/report_err.h>
#include <wsutil/u3.h>
#include <wsutil/copyright_info.h>
+#include <wsutil/ws_version_info.h>
#include <wiretap/merge.h>
@@ -206,12 +207,12 @@ print_usage(gboolean print_ver) {
if (print_ver) {
output = stdout;
- fprintf(output, "Wireshark " VERSION "%s\n"
+ fprintf(output, "Wireshark %s\n"
"Interactively dump and analyze network traffic.\n"
"See http://www.wireshark.org for more information.\n"
"\n"
"%s",
- wireshark_gitversion, get_copyright_info());
+ get_ws_vcs_version_info(), get_copyright_info());
} else {
output = stderr;
}
@@ -296,14 +297,14 @@ print_usage(gboolean print_ver) {
static void
show_version(void)
{
- printf(PACKAGE " " VERSION "%s\n"
+ printf(PACKAGE " %s\n"
"\n"
"%s"
"\n"
"%s"
"\n"
"%s",
- wireshark_gitversion, get_copyright_info(), comp_info_str->str,
+ get_ws_vcs_version_info(), get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
}
@@ -521,12 +522,12 @@ int main(int argc, char *argv[])
// xxx qtshark
get_runtime_version_info(runtime_info_str, get_gui_runtime_info);
- ws_add_crash_info(PACKAGE " " VERSION "%s\n"
+ ws_add_crash_info(PACKAGE " %s\n"
"\n"
"%s"
"\n"
"%s",
- wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
+ get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
/*
* Get credential information for later use, and drop privileges
diff --git a/ui/qt/summary_dialog.cpp b/ui/qt/summary_dialog.cpp
index 3913678903..bc6f73ff0e 100644
--- a/ui/qt/summary_dialog.cpp
+++ b/ui/qt/summary_dialog.cpp
@@ -26,6 +26,8 @@
#include "wireshark_application.h"
+#include <wsutil/ws_version_info.h>
+
#include <QtGui>
#include <QPushButton>
@@ -125,7 +127,7 @@ QString SummaryDialog::SummaryToString()
QString summaryStr;
QTextStream out(&summaryStr);
- out << tr("Summary created by Wireshark %1\n\n").arg(wireshark_gitversion);
+ out << tr("Summary created by Wireshark %1\n\n").arg(get_ws_vcs_version_info());
// File Section
out << tr("File: \n");
diff --git a/ui/qt/summary_dialog.h b/ui/qt/summary_dialog.h
index a670cda3c6..eb9bf689c2 100644
--- a/ui/qt/summary_dialog.h
+++ b/ui/qt/summary_dialog.h
@@ -38,8 +38,6 @@
#include "file.h"
#include "summary.h"
-#include "version_info.h"
-
#ifdef HAVE_LIBPCAP
#include "capture.h"
#include "ui/capture_globals.h"
diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c
index d12d5f4b0c..a981b7e37c 100644
--- a/ui/tap_export_pdu.c
+++ b/ui/tap_export_pdu.c
@@ -27,9 +27,9 @@
#include "globals.h"
#include "wtap.h"
#include "pcap-encap.h"
-#include "version_info.h"
#include "wsutil/tempfile.h"
#include "wsutil/os_version_info.h"
+#include "wsutil/ws_version_info.h"
#include <epan/tap.h>
#include <epan/exported_pdu.h>
@@ -102,7 +102,7 @@ exp_pdu_file_open(exp_pdu_t *exp_pdu_tap_data)
os_info_str = g_string_new("");
get_os_version_info(os_info_str);
- g_snprintf(appname, sizeof(appname), "Wireshark " VERSION "%s", wireshark_gitversion);
+ g_snprintf(appname, sizeof(appname), "Wireshark %s", get_ws_vcs_version_info());
shb_hdr = g_new(wtapng_section_t,1);
shb_hdr->section_length = -1;
diff --git a/version_info.c b/version_info.c
index 7ed06c511a..63adc39991 100644
--- a/version_info.c
+++ b/version_info.c
@@ -38,18 +38,10 @@
#include <wsutil/cpu_info.h>
#include <wsutil/mem_info.h>
-#include "version.h"
-
#ifdef HAVE_LIBCAP
# include <sys/capability.h>
#endif
-#ifdef GITVERSION
- const char *wireshark_gitversion = " (" GITVERSION " from " GITBRANCH ")";
-#else
- const char *wireshark_gitversion = "";
-#endif
-
/*
* If the string doesn't end with a newline, append one.
* Then word-wrap it to 80 columns.
diff --git a/version_info.h b/version_info.h
index 0389fda407..05a8b2fee0 100644
--- a/version_info.h
+++ b/version_info.h
@@ -29,11 +29,6 @@ extern "C" {
#endif /* __cplusplus */
/*
- * The Git version string or ""
- */
-extern const gchar *wireshark_gitversion;
-
-/*
* Get various library compile-time versions and append them to
* the specified GString.
*
diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt
index f392972a59..2c80a56c17 100644
--- a/wsutil/CMakeLists.txt
+++ b/wsutil/CMakeLists.txt
@@ -83,6 +83,7 @@ set(WSUTIL_FILES
unicode-utils.c
ws_mempbrk.c
ws_mempbrk_sse42.c
+ ws_version_info.c
nghttp2/nghttp2_buf.c
nghttp2/nghttp2_hd.c
nghttp2/nghttp2_hd_huffman.c
diff --git a/wsutil/Makefile.common b/wsutil/Makefile.common
index 0d5232bd0b..4bb8dea86b 100644
--- a/wsutil/Makefile.common
+++ b/wsutil/Makefile.common
@@ -69,7 +69,8 @@ LIBWSUTIL_SRC = \
type_util.c \
ws_mempbrk.c \
u3.c \
- unicode-utils.c
+ unicode-utils.c \
+ ws_version_info.c
# Header files that are not generated from other files
LIBWSUTIL_INCLUDES = \
@@ -119,8 +120,8 @@ LIBWSUTIL_INCLUDES = \
u3.h \
unicode-utils.h \
ws_cpuid.h \
- ws_mempbrk.h
-
+ ws_mempbrk.h \
+ ws_version_info.h
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html
diff --git a/wsutil/ws_version_info.c b/wsutil/ws_version_info.c
new file mode 100644
index 0000000000..c9a680eb83
--- /dev/null
+++ b/wsutil/ws_version_info.c
@@ -0,0 +1,44 @@
+/* ws_version_info.c
+ * Routines to report version information for Wireshark programs
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "version.h"
+
+#include <wsutil/ws_version_info.h>
+
+/*
+ * Return a version number string for Wireshark, including, for builds
+ * from a tree checked out from Wireshark's version control system,
+ * something identifying what version was checked out.
+ */
+const char *
+get_ws_vcs_version_info(void)
+{
+#ifdef GITVERSION
+ return VERSION " (" GITVERSION " from " GITBRANCH ")";
+#else
+ return VERSION;
+#endif
+}
diff --git a/wsutil/ws_version_info.h b/wsutil/ws_version_info.h
new file mode 100644
index 0000000000..e9e718e10e
--- /dev/null
+++ b/wsutil/ws_version_info.h
@@ -0,0 +1,44 @@
+/* ws_version_info.h
+ * Declarations of routines to report version information for Wireshark
+ * programs
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __WSUTIL_WS_VERSION_INFO_H__
+#define __WSUTIL_WS_VERSION_INFO_H__
+
+#include "ws_symbol_export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Return a version number string for Wireshark, including, for builds
+ * from a tree checked out from Wireshark's version control system,
+ * something identifying what version was checked out.
+ */
+WS_DLL_PUBLIC const char *get_ws_vcs_version_info(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __WSUTIL_WS_VERSION_INFO_H__ */