From 7ecc5880292daa358150fc80a44e927e8e6fd8af Mon Sep 17 00:00:00 2001 From: Jaap Keuter Date: Fri, 25 May 2007 06:46:47 +0000 Subject: Fix for bug 1614: Output preamble and finale on live capture. svn path=/trunk/; revision=21930 --- tshark.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'tshark.c') diff --git a/tshark.c b/tshark.c index d51e1b3c37..6d9d48ad2c 100644 --- a/tshark.c +++ b/tshark.c @@ -127,7 +127,7 @@ static gboolean print_packet_info; /* TRUE if we're to print packet information typedef enum { WRITE_TEXT, /* summary or detail text */ WRITE_XML, /* PDML or PSML */ - WRITE_FIELDS /* User defined list of fields */ + WRITE_FIELDS /* User defined list of fields */ /* Add CSV and the like here */ } output_action_e; static output_action_e output_action; @@ -1532,7 +1532,13 @@ main(int argc, char *argv[]) exit(status); } - if (!print_packet_info && !quiet) { + if (print_packet_info) { + if (!write_preamble(NULL)) { + err = errno; + show_print_file_io_error(err); + return err; + } + } else if (!quiet) { /* * We're not printing information for each packet, and the user * didn't ask us not to print a count of packets as they arrive, @@ -1554,6 +1560,13 @@ main(int argc, char *argv[]) if (capture_opts.multi_files_on) { ringbuf_free(); } + + if (print_packet_info) { + if (!write_finale()) { + err = errno; + show_print_file_io_error(err); + } + } #else /* No - complain. */ cmdarg_err("This version of TShark was not built with support for capturing packets."); @@ -2493,7 +2506,7 @@ write_preamble(capture_file *cf) switch (output_action) { case WRITE_TEXT: - return print_preamble(print_stream, cf->filename); + return print_preamble(print_stream, cf ? cf->filename : NULL); break; case WRITE_XML: -- cgit v1.2.3