From c46329c27b8c31729d2d51dc4f69da9b3923de04 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 21 Jun 2014 18:02:27 -0700 Subject: 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 --- ui/gtk/about_dlg.c | 6 +++--- ui/gtk/file_import_dlg.c | 4 ++-- ui/gtk/follow_stream.c | 5 ++--- ui/gtk/main.c | 13 +++++++------ ui/gtk/main_titlebar.c | 4 ++-- ui/gtk/main_welcome.c | 6 +++--- ui/gtk/summary_dlg.c | 5 +++-- ui/qt/about_dialog.cpp | 6 +++--- ui/qt/main.cpp | 13 +++++++------ ui/qt/summary_dialog.cpp | 4 +++- ui/qt/summary_dialog.h | 2 -- ui/tap_export_pdu.c | 4 ++-- 12 files changed, 37 insertions(+), 35 deletions(-) (limited to 'ui') 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 #include #include +#include #ifdef HAVE_LIBSMI #include #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 #include +#include #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 #include #include +#include #include @@ -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 /* * 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 #include +#include #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 @@ -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, "\nVersion " VERSION "%s", - wireshark_gitversion); + g_string_append_printf(message, "\nVersion %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 +#include + #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 #include #include +#include #include @@ -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 + #include #include @@ -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 #include @@ -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; -- cgit v1.2.3