aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2007-05-25 06:46:47 +0000
committerJaap Keuter <jaap.keuter@xs4all.nl>2007-05-25 06:46:47 +0000
commit7ecc5880292daa358150fc80a44e927e8e6fd8af (patch)
treeee85acdc419120b53ae6888f94b2467ac4f799f4 /tshark.c
parent7178eb7aadbe8e6a127bac51fb7b61a04e06f6e3 (diff)
Fix for bug 1614:
Output preamble and finale on live capture. svn path=/trunk/; revision=21930
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c19
1 files changed, 16 insertions, 3 deletions
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: