forked from osmocom/wireshark
Do the full string in get_{compiled,runtime}_version_info().
Have them start the string with "Compiled" or "Running on", and return the string when done. Change-Id: Ic4d290c963621fa0385dc5aab766fd4ad31d3810 Reviewed-on: https://code.wireshark.org/review/6155 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
84110d2981
commit
27be466c9b
10
capinfos.c
10
capinfos.c
|
@ -1135,13 +1135,11 @@ main(int argc, char *argv[])
|
|||
size_t hash_bytes;
|
||||
#endif
|
||||
|
||||
/* Assemble the compile-time version information string */
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
get_compiled_version_info(comp_info_str, NULL, get_capinfos_compiled_info);
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, get_capinfos_compiled_info);
|
||||
|
||||
/* Assemble the run-time version information string */
|
||||
runtime_info_str = g_string_new("Running ");
|
||||
get_runtime_version_info(runtime_info_str, get_capinfos_runtime_info);
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_capinfos_runtime_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Capinfos (Wireshark) %s\n"
|
||||
|
|
10
captype.c
10
captype.c
|
@ -139,13 +139,11 @@ main(int argc, char *argv[])
|
|||
char *init_progfile_dir_error;
|
||||
#endif
|
||||
|
||||
/* Assemble the compile-time version information string */
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
get_compiled_version_info(comp_info_str, NULL, get_captype_compiled_info);
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, get_captype_compiled_info);
|
||||
|
||||
/* Assemble the run-time version information string */
|
||||
runtime_info_str = g_string_new("Running ");
|
||||
get_runtime_version_info(runtime_info_str, get_captype_runtime_info);
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_captype_runtime_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Captype (Wireshark) %s\n"
|
||||
|
|
10
dumpcap.c
10
dumpcap.c
|
@ -4249,13 +4249,11 @@ main(int argc, char *argv[])
|
|||
|
||||
cmdarg_err_init(dumpcap_cmdarg_err, dumpcap_cmdarg_err_cont);
|
||||
|
||||
/* Assemble the compile-time version information string */
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
get_compiled_version_info(comp_info_str, NULL, get_dumpcap_compiled_info);
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, get_dumpcap_compiled_info);
|
||||
|
||||
/* Assemble the run-time version information string */
|
||||
runtime_info_str = g_string_new("Running ");
|
||||
get_runtime_version_info(runtime_info_str, get_dumpcap_runtime_info);
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_dumpcap_runtime_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Dumpcap (Wireshark) %s\n"
|
||||
|
|
|
@ -482,11 +482,9 @@ static void preinit_epan(char* argv0, int (*main)(int, char **)) {
|
|||
|
||||
error = init_progfile_dir(argv0, main);
|
||||
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
get_compiled_version_info(comp_info_str, NULL, epan_get_compiled_version_info);
|
||||
comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info);
|
||||
|
||||
runtime_info_str = g_string_new("Running ");
|
||||
get_runtime_version_info(runtime_info_str, NULL);
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
|
||||
version_long_str = g_strdup_printf("Echld %s\n%s\n%s\n%s",
|
||||
get_ws_vcs_version_info(), get_copyright_info(),
|
||||
|
|
10
editcap.c
10
editcap.c
|
@ -922,13 +922,11 @@ main(int argc, char *argv[])
|
|||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* Assemble the compile-time version information string */
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
get_compiled_version_info(comp_info_str, NULL, get_editcap_compiled_info);
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, get_editcap_compiled_info);
|
||||
|
||||
/* Assemble the run-time version information string */
|
||||
runtime_info_str = g_string_new("Running ");
|
||||
get_runtime_version_info(runtime_info_str, get_editcap_runtime_info);
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_editcap_runtime_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Editcap (Wireshark) %s\n"
|
||||
|
|
10
mergecap.c
10
mergecap.c
|
@ -249,13 +249,11 @@ main(int argc, char *argv[])
|
|||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* Assemble the compile-time version information string */
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
get_compiled_version_info(comp_info_str, NULL, get_mergecap_compiled_info);
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, get_mergecap_compiled_info);
|
||||
|
||||
/* Assemble the run-time version information string */
|
||||
runtime_info_str = g_string_new("Running ");
|
||||
get_runtime_version_info(runtime_info_str, get_mergecap_runtime_info);
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_mergecap_runtime_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Mergecap (Wireshark) %s\n"
|
||||
|
|
10
rawshark.c
10
rawshark.c
|
@ -454,13 +454,11 @@ main(int argc, char *argv[])
|
|||
|
||||
cmdarg_err_init(rawshark_cmdarg_err, rawshark_cmdarg_err_cont);
|
||||
|
||||
/* Assemble the compile-time version information string */
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
get_compiled_version_info(comp_info_str, NULL, epan_get_compiled_version_info);
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info);
|
||||
|
||||
/* Assemble the run-time version information string */
|
||||
runtime_info_str = g_string_new("Running ");
|
||||
get_runtime_version_info(runtime_info_str, NULL);
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(NULL);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Rawshark (Wireshark) %s\n"
|
||||
|
|
10
reordercap.c
10
reordercap.c
|
@ -206,13 +206,11 @@ main(int argc, char *argv[])
|
|||
char *infile;
|
||||
char *outfile;
|
||||
|
||||
/* Assemble the compile-time version information string */
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
get_compiled_version_info(comp_info_str, NULL, get_reordercap_compiled_info);
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, get_reordercap_compiled_info);
|
||||
|
||||
/* Assemble the run-time version information string */
|
||||
runtime_info_str = g_string_new("Running ");
|
||||
get_runtime_version_info(runtime_info_str, get_reordercap_runtime_info);
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_reordercap_runtime_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Reordercap (Wireshark) %s\n"
|
||||
|
|
10
text2pcap.c
10
text2pcap.c
|
@ -1546,13 +1546,11 @@ parse_options (int argc, char *argv[])
|
|||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* Assemble the compile-time version information string */
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
get_compiled_version_info(comp_info_str, NULL, get_text2pcap_compiled_info);
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, get_text2pcap_compiled_info);
|
||||
|
||||
/* Assemble the run-time version information string */
|
||||
runtime_info_str = g_string_new("Running ");
|
||||
get_runtime_version_info(runtime_info_str, get_text2pcap_runtime_info);
|
||||
/* get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_text2pcap_runtime_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Text2pcap (Wireshark) %s\n"
|
||||
|
|
12
tfshark.c
12
tfshark.c
|
@ -846,14 +846,12 @@ main(int argc, char *argv[])
|
|||
|
||||
initialize_funnel_ops();
|
||||
|
||||
/* Assemble the compile-time version information string */
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
get_compiled_version_info(comp_info_str, get_tfshark_compiled_version_info,
|
||||
epan_get_compiled_version_info);
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(get_tfshark_compiled_version_info,
|
||||
epan_get_compiled_version_info);
|
||||
|
||||
/* Assemble the run-time version information string */
|
||||
runtime_info_str = g_string_new("Running ");
|
||||
get_runtime_version_info(runtime_info_str, get_tfshark_runtime_version_info);
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(tfshark_runtime_version_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("TFShark (Wireshark) %s\n"
|
||||
|
|
12
tshark.c
12
tshark.c
|
@ -1055,14 +1055,12 @@ main(int argc, char *argv[])
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Assemble the compile-time version information string */
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
get_compiled_version_info(comp_info_str, get_tshark_compiled_version_info,
|
||||
epan_get_compiled_version_info);
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(get_tshark_compiled_version_info,
|
||||
epan_get_compiled_version_info);
|
||||
|
||||
/* Assemble the run-time version information string */
|
||||
runtime_info_str = g_string_new("Running ");
|
||||
get_runtime_version_info(runtime_info_str, get_tshark_runtime_version_info);
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_tshark_runtime_version_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("TShark (Wireshark) %s\n"
|
||||
|
|
|
@ -2257,15 +2257,12 @@ main(int argc, char *argv[])
|
|||
#endif /* HAVE_AIRPCAP */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* Assemble the compile-time version information string */
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(get_wireshark_gtk_compiled_info,
|
||||
get_gui_compiled_info);
|
||||
|
||||
get_compiled_version_info(comp_info_str, get_wireshark_gtk_compiled_info,
|
||||
get_gui_compiled_info);
|
||||
|
||||
/* Assemble the run-time version information string */
|
||||
runtime_info_str = g_string_new("Running ");
|
||||
get_runtime_version_info(runtime_info_str, get_wireshark_runtime_info);
|
||||
/* Get the run-time version information string */
|
||||
runtime_info_str = get_runtime_version_info(get_wireshark_runtime_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Wireshark %s\n"
|
||||
|
|
|
@ -571,17 +571,14 @@ int main(int argc, char *argv[])
|
|||
};
|
||||
static const char optstring[] = OPTSTRING;
|
||||
|
||||
/* Assemble the compile-time version information string */
|
||||
comp_info_str = g_string_new("Compiled ");
|
||||
|
||||
// xxx qtshark
|
||||
get_compiled_version_info(comp_info_str, get_wireshark_qt_compiled_info,
|
||||
get_gui_compiled_info);
|
||||
/* Get the compile-time version information string */
|
||||
// XXX qtshark
|
||||
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 = g_string_new("Running ");
|
||||
// xxx qtshark
|
||||
get_runtime_version_info(runtime_info_str, get_wireshark_runtime_info);
|
||||
runtime_info_str = get_runtime_version_info(get_wireshark_runtime_info);
|
||||
|
||||
/* Add it to the information to be reported on a crash. */
|
||||
ws_add_crash_info("Wireshark %s\n"
|
||||
|
|
|
@ -68,18 +68,26 @@ end_string(GString *str)
|
|||
}
|
||||
|
||||
/*
|
||||
* Get various library compile-time versions and append them to
|
||||
* the specified GString.
|
||||
* Get various library compile-time versions, put them in a GString,
|
||||
* and return the 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.
|
||||
* "prepend_info" is called at the start to prepend any additional
|
||||
* information before the standard library information.
|
||||
*
|
||||
* "append_info" is called at the end to append any additional
|
||||
* information after the standard library 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 *),
|
||||
GString *
|
||||
get_compiled_version_info(void (*prepend_info)(GString *),
|
||||
void (*append_info)(GString *))
|
||||
{
|
||||
GString *str;
|
||||
|
||||
str = g_string_new("Compiled ");
|
||||
|
||||
if (sizeof(str) == 4)
|
||||
g_string_append(str, "(32-bit) ");
|
||||
else
|
||||
|
@ -98,20 +106,28 @@ get_compiled_version_info(GString *str, void (*prepend_info)(GString *),
|
|||
g_string_append(str, ".");
|
||||
|
||||
end_string(str);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get various library run-time versions, and the OS version, 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_runtime_version_info(GString *str, void (*additional_info)(GString *))
|
||||
GString *
|
||||
get_runtime_version_info(void (*additional_info)(GString *))
|
||||
{
|
||||
GString *str;
|
||||
#ifndef _WIN32
|
||||
gchar *lang;
|
||||
#endif
|
||||
|
||||
g_string_append(str, "on ");
|
||||
str = g_string_new("Running on ");
|
||||
|
||||
get_os_version_info(str);
|
||||
|
||||
|
@ -139,6 +155,8 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *))
|
|||
get_compiler_info(str);
|
||||
|
||||
end_string(str);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -31,27 +31,31 @@ extern "C" {
|
|||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Get various library compile-time versions and append them to
|
||||
* the specified GString.
|
||||
* Get various library compile-time versions, put them in a GString,
|
||||
* and return the GString.
|
||||
*
|
||||
* "prepend_info" is called at the start to prepend any additional
|
||||
* information.
|
||||
* information before the standard library information.
|
||||
*
|
||||
* "append_info" is called at the end to append any additional
|
||||
* information after the standard library 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 GString *get_compiled_version_info(void (*prepend_info)(GString *),
|
||||
void (*append_info)(GString *));
|
||||
|
||||
/*
|
||||
* Get various library run-time versions, and the OS version, put them in
|
||||
* a GString, and return the 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.
|
||||
*/
|
||||
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 GString *get_runtime_version_info(void (*additional_info)(GString *));
|
||||
|
||||
WS_DLL_PUBLIC void show_version(const gchar *prog_name, GString *comp_info_str, GString *runtime_info_str);
|
||||
|
||||
|
|
Loading…
Reference in New Issue