Move verbose banner output to show_version() and tighten scope of some variables

svn path=/trunk/; revision=30017
This commit is contained in:
Kovarththanan Rajaratnam 2009-09-20 16:16:15 +00:00
parent 17b6592540
commit a7081629f0
1 changed files with 29 additions and 21 deletions

View File

@ -108,9 +108,8 @@ static const gchar decode_as_arg_template[] = "<layer_type>==<selector>,<decode_
static nstime_t first_ts;
static nstime_t prev_dis_ts;
static nstime_t prev_cap_ts;
static GString *comp_info_str, *runtime_info_str;
static gboolean print_packet_info; /* TRUE if we're to print packet information */
/*
* The way the packet decode is to be written.
*/
@ -733,7 +732,19 @@ check_capture_privs(void) {
#endif
}
static void
show_version(GString *comp_info_str, GString *runtime_info_str)
{
printf("TShark " VERSION "%s\n"
"\n"
"%s"
"\n"
"%s"
"\n"
"%s",
wireshark_svnversion, get_copyright_info(), comp_info_str->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;