From a7081629f053d631629408698eeb39952e28ab55 Mon Sep 17 00:00:00 2001 From: Kovarththanan Rajaratnam Date: Sun, 20 Sep 2009 16:16:15 +0000 Subject: [PATCH] Move verbose banner output to show_version() and tighten scope of some variables svn path=/trunk/; revision=30017 --- tshark.c | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/tshark.c b/tshark.c index ee7a53ad05..c3f6a03658 100644 --- a/tshark.c +++ b/tshark.c @@ -108,9 +108,8 @@ static const gchar decode_as_arg_template[] = "==,str, + runtime_info_str->str); +} int main(int argc, char *argv[]) @@ -992,14 +1003,6 @@ main(int argc, char *argv[]) init_cap_file(&cfile); - /* Assemble the compile-time version information string */ - comp_info_str = g_string_new("Compiled "); - get_compiled_version_info(comp_info_str, get_epan_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); - /* Print format defaults to this. */ print_format = PR_FMT_TEXT; @@ -1185,18 +1188,23 @@ main(int argc, char *argv[]) exit(1); } break; - case 'v': /* Show version and exit */ - printf("TShark " VERSION "%s\n" - "\n" - "%s" - "\n" - "%s" - "\n" - "%s", - wireshark_svnversion, get_copyright_info(), comp_info_str->str, - runtime_info_str->str); + case 'v': /* Show version and exit */ + { + GString *comp_info_str; + GString *runtime_info_str; + /* Assemble the compile-time version information string */ + comp_info_str = g_string_new("Compiled "); + get_compiled_version_info(comp_info_str, get_epan_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); + show_version(comp_info_str, runtime_info_str); + g_string_free(comp_info_str, TRUE); + g_string_free(runtime_info_str, TRUE); exit(0); break; + } case 'V': /* Verbose */ verbose = TRUE; break;