2 * Routines to report version information for Wireshark programs
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 #include <wsutil/ws_version_info.h>
33 #include <wsutil/copyright_info.h>
34 #include <wsutil/glib_version_info.h>
35 #include <wsutil/os_version_info.h>
36 #include <wsutil/compiler_info.h>
37 #include <wsutil/cpu_info.h>
38 #include <wsutil/mem_info.h>
41 * If the string doesn't end with a newline, append one.
42 * Then word-wrap it to 80 columns.
45 end_string(GString *str)
51 if (point == 0 || str->str[point - 1] != '\n')
52 g_string_append(str, "\n");
58 * Break at or before this point.
61 while (q > p && *q != ' ')
71 * Get various library compile-time versions, put them in a GString,
72 * and return the GString.
74 * "prepend_info" is called at the start to prepend any additional
75 * information before the standard library information.
77 * "append_info" is called at the end to append any additional
78 * information after the standard library information. This is
79 * required in order to, for example, put the Portaudio information
80 * at the end of the string, as we currently don't use Portaudio in
84 get_compiled_version_info(void (*prepend_info)(GString *),
85 void (*append_info)(GString *))
89 str = g_string_new("Compiled ");
92 g_string_append(str, "(32-bit) ");
94 g_string_append(str, "(64-bit) ");
98 g_string_append(str, ", ");
101 get_glib_version_info(str);
103 /* Additional application-dependent information */
106 g_string_append(str, ".");
114 * Get various library run-time versions, and the OS version, and append
115 * them to the specified GString.
117 * "additional_info" is called at the end to append any additional
118 * information; this is required in order to, for example, put the
119 * Portaudio information at the end of the string, as we currently
120 * don't use Portaudio in TShark.
123 get_runtime_version_info(void (*additional_info)(GString *))
130 str = g_string_new("Running on ");
132 get_os_version_info(str);
136 if ((lang = getenv ("LANG")) != NULL)
137 g_string_append_printf(str, ", with locale %s", lang);
139 g_string_append(str, ", with default locale");
142 /* Additional application-dependent information */
144 (*additional_info)(str);
146 g_string_append(str, ".");
151 /* Get info about installed memory Windows only */
155 get_compiler_info(str);
163 show_version(const gchar *prog_name_str, GString *comp_info_str,
164 GString *runtime_info_str)
173 prog_name_str, get_ws_vcs_version_info(), get_copyright_info(),
174 comp_info_str->str, runtime_info_str->str);
178 * Return a version number string for Wireshark, including, for builds
179 * from a tree checked out from Wireshark's version control system,
180 * something identifying what version was checked out.
183 get_ws_vcs_version_info(void)
186 return VERSION " (" GITVERSION " from " GITBRANCH ")";
193 * Editor modelines - http://www.wireshark.org/tools/modelines.html
198 * indent-tabs-mode: t
201 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
202 * :indentSize=8:tabSize=8:noTabs=false: