diff options
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | Makefile.common | 23 | ||||
-rw-r--r-- | Makefile.nmake | 4 | ||||
-rw-r--r-- | capinfos.c | 2 | ||||
-rw-r--r-- | captype.c | 2 | ||||
-rw-r--r-- | dumpcap.c | 1 | ||||
-rw-r--r-- | echld/echld-int.h | 1 | ||||
-rw-r--r-- | editcap.c | 2 | ||||
-rw-r--r-- | epan/print.c | 3 | ||||
-rw-r--r-- | mergecap.c | 2 | ||||
-rw-r--r-- | rawshark.c | 1 | ||||
-rw-r--r-- | reordercap.c | 2 | ||||
-rw-r--r-- | text2pcap.c | 1 | ||||
-rw-r--r-- | tfshark.c | 1 | ||||
-rw-r--r-- | tshark.c | 1 | ||||
-rw-r--r-- | ui/decode_as_utils.c | 3 | ||||
-rw-r--r-- | ui/gtk/main.c | 1 | ||||
-rw-r--r-- | ui/qt/follow_stream_dialog.cpp | 3 | ||||
-rw-r--r-- | ui/qt/main.cpp | 1 | ||||
-rw-r--r-- | ui/qt/main_welcome.cpp | 2 | ||||
-rw-r--r-- | version_info.c | 156 | ||||
-rw-r--r-- | version_info.h | 71 | ||||
-rw-r--r-- | wsutil/ws_version_info.c | 113 | ||||
-rw-r--r-- | wsutil/ws_version_info.h | 23 |
24 files changed, 148 insertions, 279 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f6eb913fb5..1554fb4e5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -996,7 +996,6 @@ set(SHARK_COMMON_SRC cfile.c frame_tvbuff.c sync_pipe_write.c - version_info.c ) # sources for external capture interfaces @@ -1471,7 +1470,6 @@ if(BUILD_text2pcap) set(text2pcap_CLEAN_FILES text2pcap.c pcapio.c - version_info.c ) set(text2pcap_FILES ${text2pcap_CLEAN_FILES} @@ -1494,7 +1492,6 @@ if(BUILD_mergecap) ) set(mergecap_FILES mergecap.c - version_info.c image/mergecap.rc ) add_executable(mergecap ${mergecap_FILES}) @@ -1511,7 +1508,6 @@ if(BUILD_reordercap) ) set(reordercap_FILES reordercap.c - version_info.c image/reordercap.rc ) add_executable(reordercap ${reordercap_FILES}) @@ -1530,7 +1526,6 @@ if(BUILD_capinfos) ) set(capinfos_FILES capinfos.c - version_info.c image/capinfos.rc ) add_executable(capinfos ${capinfos_FILES}) @@ -1548,7 +1543,6 @@ if(BUILD_captype) ) set(captype_FILES captype.c - version_info.c image/captype.rc ) add_executable(captype ${captype_FILES}) @@ -1565,7 +1559,6 @@ if(BUILD_editcap) ) set(editcap_FILES editcap.c - version_info.c image/editcap.rc ) add_executable(editcap ${editcap_FILES}) @@ -1597,7 +1590,6 @@ if(BUILD_dumpcap AND PCAP_FOUND) pcapio.c ringbuffer.c sync_pipe_write.c - version_info.c image/dumpcap.rc ) add_executable(dumpcap ${dumpcap_FILES}) diff --git a/Makefile.common b/Makefile.common index 1a24af0433..6eef1de2c4 100644 --- a/Makefile.common +++ b/Makefile.common @@ -44,7 +44,6 @@ SHARK_COMMON_SRC = \ cfile.c \ frame_tvbuff.c \ sync_pipe_write.c \ - version_info.c \ extcap.c \ extcap_parser.c @@ -58,7 +57,6 @@ SHARK_COMMON_INCLUDES = \ fileset.h \ frame_tvbuff.h \ register.h \ - version_info.h \ ws_symbol_export.h # wireshark specifics @@ -101,8 +99,7 @@ rawshark_SOURCES = \ text2pcap_SOURCES = \ pcapio.c \ text2pcap.c \ - text2pcap-scanner.l \ - version_info.c + text2pcap-scanner.l text2pcap_INCLUDES = \ pcapio.h \ @@ -110,28 +107,23 @@ text2pcap_INCLUDES = \ # mergecap specifics mergecap_SOURCES = \ - mergecap.c \ - version_info.c + mergecap.c # editcap specifics editcap_SOURCES = \ - editcap.c \ - version_info.c + editcap.c # reordercap specifics reordercap_SOURCES = \ - reordercap.c \ - version_info.c + reordercap.c # capinfos specifics capinfos_SOURCES = \ - capinfos.c \ - version_info.c + capinfos.c # captype specifics captype_SOURCES = \ - captype.c \ - version_info.c + captype.c # dftest specifics dftest_SOURCES = \ @@ -149,8 +141,7 @@ dumpcap_SOURCES = \ dumpcap.c \ pcapio.c \ ringbuffer.c \ - sync_pipe_write.c \ - version_info.c + sync_pipe_write.c # corresponding headers dumpcap_INCLUDES = \ diff --git a/Makefile.nmake b/Makefile.nmake index 63f8cc6123..484ae83e2a 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -397,10 +397,10 @@ reordercap.exe : $(LIBS_CHECK) config.h $(reordercap_OBJECTS) wsutil\libwsutil. mt.exe -nologo -manifest "reordercap.exe.manifest" -outputresource:reordercap.exe;1 !ENDIF -text2pcap.exe : $(LIBS_CHECK) config.h text2pcap.obj text2pcap-scanner.obj pcapio.obj version_info.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\text2pcap.res +text2pcap.exe : $(LIBS_CHECK) config.h text2pcap.obj text2pcap-scanner.obj pcapio.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\text2pcap.res @echo Linking $@ $(LINK) @<< - /OUT:text2pcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) text2pcap.obj text2pcap-scanner.obj pcapio.obj version_info.obj $(text2pcap_LIBS) image\text2pcap.res + /OUT:text2pcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) text2pcap.obj text2pcap-scanner.obj pcapio.obj $(text2pcap_LIBS) image\text2pcap.res << !IFDEF MANIFEST_INFO_REQUIRED mt.exe -nologo -manifest "text2pcap.exe.manifest" -outputresource:text2pcap.exe;1 diff --git a/capinfos.c b/capinfos.c index e246b8f2ee..b5a2104847 100644 --- a/capinfos.c +++ b/capinfos.c @@ -107,8 +107,6 @@ #include <wsutil/unicode-utils.h> #endif /* _WIN32 */ -#include "version_info.h" - /* * By default capinfos now continues processing * the next filename if and when wiretap detects @@ -72,8 +72,6 @@ #include "wsutil/wsgetopt.h" #endif -#include "version_info.h" - static void print_usage(FILE *output) { @@ -88,7 +88,6 @@ #endif #include "ringbuffer.h" -#include "version_info.h" #include "caputils/capture_ifinfo.h" #include "caputils/capture-pcap-util.h" diff --git a/echld/echld-int.h b/echld/echld-int.h index a002fb88bf..29b0ae7b7d 100644 --- a/echld/echld-int.h +++ b/echld/echld-int.h @@ -64,7 +64,6 @@ #include <capchild/capture_session.h> #include <caputils/capture_ifinfo.h> #include <capchild/capture_sync.h> -#include "version_info.h" #include "cfile.h" #include "wsutil/crash_info.h" #include "wsutil/privileges.h" @@ -90,8 +90,6 @@ #include <wsutil/crash_info.h> #include <wsutil/ws_version_info.h> -#include "version_info.h" - #include "ringbuffer.h" /* For RINGBUFFER_MAX_NUM_FILES */ /* diff --git a/epan/print.c b/epan/print.c index 0ff4d091d5..2b9ec0cb97 100644 --- a/epan/print.c +++ b/epan/print.c @@ -38,10 +38,9 @@ #include <epan/dissectors/packet-data.h> #include <epan/dissectors/packet-frame.h> #include <wsutil/filesystem.h> +#include <wsutil/ws_version_info.h> #include <ftypes/ftypes-int.h> -#include "version_info.h" - #define PDML_VERSION "0" #define PSML_VERSION "0" diff --git a/mergecap.c b/mergecap.c index 0d31e4ed4c..7036c91851 100644 --- a/mergecap.c +++ b/mergecap.c @@ -62,8 +62,6 @@ #include <wiretap/merge.h> -#include "version_info.h" - #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif diff --git a/rawshark.c b/rawshark.c index 78f2e633c2..5b6363f881 100644 --- a/rawshark.c +++ b/rawshark.c @@ -90,7 +90,6 @@ #include "ui/capture_ui_utils.h" #endif #include "ui/util.h" -#include "version_info.h" #include "register.h" #include "conditions.h" #include "capture_stop_conditions.h" diff --git a/reordercap.c b/reordercap.c index 5248662d2e..9f7e459251 100644 --- a/reordercap.c +++ b/reordercap.c @@ -50,8 +50,6 @@ #include <wsutil/crash_info.h> #include <wsutil/ws_version_info.h> -#include "version_info.h" - /* Show command-line usage */ static void print_usage(FILE *output) diff --git a/text2pcap.c b/text2pcap.c index 7cd67e44fb..fae7b14532 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -142,7 +142,6 @@ #include "pcapio.h" #include "text2pcap.h" -#include "version_info.h" #ifdef _WIN32 #include <wsutil/unicode-utils.h> @@ -86,7 +86,6 @@ #include <epan/print.h> #include <epan/addr_resolv.h> #include "ui/util.h" -#include "version_info.h" #include "register.h" #include <epan/epan_dissect.h> #include <epan/tap.h> @@ -96,7 +96,6 @@ #include "ui/util.h" #include "ui/ui_util.h" #include "ui/cli/tshark-tap.h" -#include "version_info.h" #include "register.h" #include <epan/epan_dissect.h> #include <epan/tap.h> diff --git a/ui/decode_as_utils.c b/ui/decode_as_utils.c index 8db4f2dff3..3cc1943738 100644 --- a/ui/decode_as_utils.c +++ b/ui/decode_as_utils.c @@ -38,8 +38,7 @@ #include "wsutil/file_util.h" #include "wsutil/filesystem.h" - -#include "version_info.h" +#include "wsutil/ws_version_info.h" /* XXX - We might want to switch this to a UAT */ diff --git a/ui/gtk/main.c b/ui/gtk/main.c index a7c53c3e2a..1a3632adde 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -101,7 +101,6 @@ #include "../color_filters.h" #include "../register.h" #include "../ringbuffer.h" -#include "../version_info.h" #include "../log.h" #include "gtk_iface_monitor.h" diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp index 7533a37862..6c98db6029 100644 --- a/ui/qt/follow_stream_dialog.cpp +++ b/ui/qt/follow_stream_dialog.cpp @@ -41,13 +41,12 @@ #include "wsutil/tempfile.h" #include "wsutil/file_util.h" #include "wsutil/str_util.h" +#include "wsutil/ws_version_info.h" #include "ws_symbol_export.h" #include "color_utils.h" -#include "version_info.h" - #include "ui/follow.h" #include "qt_ui_utils.h" diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp index 017296a33f..4449a0aa98 100644 --- a/ui/qt/main.cpp +++ b/ui/qt/main.cpp @@ -91,7 +91,6 @@ #include "register.h" #include "ringbuffer.h" #include "ui/util.h" -#include "version_info.h" #include "log.h" #include "ui/alert_box.h" diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp index 7aa41fe7c0..2a556ee6cf 100644 --- a/ui/qt/main_welcome.cpp +++ b/ui/qt/main_welcome.cpp @@ -25,7 +25,7 @@ #include <epan/prefs.h> -#include "version_info.h" +#include "wsutil/ws_version_info.h" #include "main_welcome.h" #include "ui_main_welcome.h" diff --git a/version_info.c b/version_info.c deleted file mode 100644 index e9168ab0a9..0000000000 --- a/version_info.c +++ /dev/null @@ -1,156 +0,0 @@ -/* version_info.c - * Routines to report version information for stuff used by Wireshark - * - * 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 <stdlib.h> -#include <string.h> - -#ifdef HAVE_LIBZ -#include <zlib.h> /* to get the libz version number */ -#endif - -#include "version_info.h" -#include <wsutil/glib_version_info.h> -#include <wsutil/os_version_info.h> -#include <wsutil/compiler_info.h> -#include <wsutil/cpu_info.h> -#include <wsutil/mem_info.h> - -/* - * If the string doesn't end with a newline, append one. - * Then word-wrap it to 80 columns. - */ -static void -end_string(GString *str) -{ - size_t point; - char *p, *q; - - point = str->len; - if (point == 0 || str->str[point - 1] != '\n') - g_string_append(str, "\n"); - p = str->str; - while (*p != '\0') { - q = strchr(p, '\n'); - if (q - p > 80) { - /* - * Break at or before this point. - */ - q = p + 80; - while (q > p && *q != ' ') - q--; - if (q != p) - *q = '\n'; - } - p = q + 1; - } -} - -/* - * Get various library compile-time versions and append them to - * the specified GString. - * - * "additional_info" is called at the end to append any additional - * information; this is required in order to, for example, put the - * Portaudio information at the end of the string, as we currently - * don't use Portaudio in TShark. - */ -void -get_compiled_version_info(GString *str, void (*prepend_info)(GString *), - void (*append_info)(GString *)) -{ - if (sizeof(str) == 4) - g_string_append(str, "(32-bit) "); - else - g_string_append(str, "(64-bit) "); - - if (prepend_info) { - (*prepend_info)(str); - g_string_append(str, ", "); - } - - get_glib_version_info(str); - - /* Additional application-dependent information */ - if (append_info) - (*append_info)(str); - g_string_append(str, "."); - - end_string(str); -} - -/* - * Get various library run-time versions, and the OS version, and append - * them to the specified GString. - */ -void -get_runtime_version_info(GString *str, void (*additional_info)(GString *)) -{ -#ifndef _WIN32 - gchar *lang; -#endif - - g_string_append(str, "on "); - - get_os_version_info(str); - -#ifndef _WIN32 - /* Locale */ - if ((lang = getenv ("LANG")) != NULL) - g_string_append_printf(str, ", with locale %s", lang); - else - g_string_append(str, ", with default locale"); -#endif - - /* Additional application-dependent information */ - if (additional_info) - (*additional_info)(str); - - g_string_append(str, "."); - - /* CPU Info */ - get_cpu_info(str); - - /* Get info about installed memory Windows only */ - get_mem_info(str); - - /* Compiler info */ - get_compiler_info(str); - - end_string(str); -} - -/* - * Editor modelines - * - * Local Variables: - * c-basic-offset: 8 - * tab-width: 8 - * indent-tabs-mode: t - * End: - * - * ex: set shiftwidth=8 tabstop=8 noexpandtab: - * :indentSize=8:tabSize=8:noTabs=false: - */ diff --git a/version_info.h b/version_info.h deleted file mode 100644 index 6d01b90050..0000000000 --- a/version_info.h +++ /dev/null @@ -1,71 +0,0 @@ -/* version_info.h - * Declarations of outines to report version information for stuff used - * by Wireshark - * - * 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 __VERSION_INFO_H__ -#define __VERSION_INFO_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* - * Get various library compile-time versions and append them to - * the specified GString. - * - * "prepend_info" is called at the start to prepend any additional - * information. - * - * "append_info" is called at the end to append any additional - * information; this is required in order to, for example, put the - * Portaudio information at the end of the string, as we currently - * don't use Portaudio in TShark. - */ -void get_compiled_version_info(GString *str, - void (*prepend_info)(GString *), - void (*append_info)(GString *)); - -/* - * Get various library run-time versions, and the OS version, and append - * them to the specified GString. - */ -void get_runtime_version_info(GString *str, - void (*additional_info)(GString *)); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __VERSION_INFO_H__ */ - -/* - * Editor modelines - http://www.wireshark.org/tools/modelines.html - * - * Local variables: - * c-basic-offset: 4 - * tab-width: 8 - * indent-tabs-mode: nil - * End: - * - * vi: set shiftwidth=4 tabstop=8 expandtab: - * :indentSize=4:tabSize=8:noTabs=true: - */ diff --git a/wsutil/ws_version_info.c b/wsutil/ws_version_info.c index 49af7acfad..c0e83ae467 100644 --- a/wsutil/ws_version_info.c +++ b/wsutil/ws_version_info.c @@ -23,12 +23,123 @@ #include "config.h" #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <glib.h> - #include <wsutil/ws_version_info.h> + #include <wsutil/copyright_info.h> +#include <wsutil/glib_version_info.h> +#include <wsutil/os_version_info.h> +#include <wsutil/compiler_info.h> +#include <wsutil/cpu_info.h> +#include <wsutil/mem_info.h> + +/* + * If the string doesn't end with a newline, append one. + * Then word-wrap it to 80 columns. + */ +static void +end_string(GString *str) +{ + size_t point; + char *p, *q; + + point = str->len; + if (point == 0 || str->str[point - 1] != '\n') + g_string_append(str, "\n"); + p = str->str; + while (*p != '\0') { + q = strchr(p, '\n'); + if (q - p > 80) { + /* + * Break at or before this point. + */ + q = p + 80; + while (q > p && *q != ' ') + q--; + if (q != p) + *q = '\n'; + } + p = q + 1; + } +} + +/* + * Get various library compile-time versions and append them to + * the specified GString. + * + * "additional_info" is called at the end to append any additional + * information; this is required in order to, for example, put the + * Portaudio information at the end of the string, as we currently + * don't use Portaudio in TShark. + */ +void +get_compiled_version_info(GString *str, void (*prepend_info)(GString *), + void (*append_info)(GString *)) +{ + if (sizeof(str) == 4) + g_string_append(str, "(32-bit) "); + else + g_string_append(str, "(64-bit) "); + + if (prepend_info) { + (*prepend_info)(str); + g_string_append(str, ", "); + } + + get_glib_version_info(str); + + /* Additional application-dependent information */ + if (append_info) + (*append_info)(str); + g_string_append(str, "."); + + end_string(str); +} + +/* + * Get various library run-time versions, and the OS version, and append + * them to the specified GString. + */ +void +get_runtime_version_info(GString *str, void (*additional_info)(GString *)) +{ +#ifndef _WIN32 + gchar *lang; +#endif + + g_string_append(str, "on "); + + get_os_version_info(str); + +#ifndef _WIN32 + /* Locale */ + if ((lang = getenv ("LANG")) != NULL) + g_string_append_printf(str, ", with locale %s", lang); + else + g_string_append(str, ", with default locale"); +#endif + + /* Additional application-dependent information */ + if (additional_info) + (*additional_info)(str); + + g_string_append(str, "."); + + /* CPU Info */ + get_cpu_info(str); + + /* Get info about installed memory Windows only */ + get_mem_info(str); + + /* Compiler info */ + get_compiler_info(str); + + end_string(str); +} void show_version(const gchar *prog_name_str, GString *comp_info_str, diff --git a/wsutil/ws_version_info.h b/wsutil/ws_version_info.h index 6d573e2105..03f57fc92d 100644 --- a/wsutil/ws_version_info.h +++ b/wsutil/ws_version_info.h @@ -30,6 +30,29 @@ extern "C" { #endif /* __cplusplus */ +/* + * Get various library compile-time versions and append them to + * the specified GString. + * + * "prepend_info" is called at the start to prepend any additional + * information. + * + * "append_info" is called at the end to append any additional + * information; this is required in order to, for example, put the + * Portaudio information at the end of the string, as we currently + * don't use Portaudio in TShark. + */ +WS_DLL_PUBLIC void get_compiled_version_info(GString *str, + void (*prepend_info)(GString *), + void (*append_info)(GString *)); + +/* + * Get various library run-time versions, and the OS version, and append + * them to the specified GString. + */ +WS_DLL_PUBLIC void get_runtime_version_info(GString *str, + void (*additional_info)(GString *)); + WS_DLL_PUBLIC void show_version(const gchar *prog_name, GString *comp_info_str, GString *runtime_info_str); /* |