diff options
author | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2010-09-01 20:54:41 +0000 |
---|---|---|
committer | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2010-09-01 20:54:41 +0000 |
commit | 9abcb3930ab3cb1199c80daa8b06651301dd9219 (patch) | |
tree | dc0382ed7a3d7ccf5452ad79301c6165997f8dba /print.c | |
parent | 8149b0b8d4587f19f96e36e78e0924a8c8d9f9f4 (diff) |
Ensure we always print the heading when dumping PSML and CSV.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@34039 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'print.c')
-rw-r--r-- | print.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -83,6 +83,8 @@ struct _output_fields { gchar quote; }; +static gboolean write_headers = FALSE; + static const gchar* get_field_hex_value(GSList* src_list, field_info *fi); static void proto_tree_print_node(proto_node *node, gpointer data); static void proto_tree_write_node_pdml(proto_node *node, gpointer data); @@ -571,16 +573,16 @@ write_psml_preamble(FILE *fh) fputs("<?xml version=\"1.0\"?>\n", fh); fputs("<psml version=\"" PSML_VERSION "\" ", fh); fprintf(fh, "creator=\"%s/%s\">\n", PACKAGE, VERSION); + write_headers = TRUE; } void proto_tree_write_psml(epan_dissect_t *edt, FILE *fh) { gint i; - static gboolean structure_written = FALSE; /* if this is the first packet, we have to create the PSML structure output */ - if(!structure_written) { + if(write_headers) { fprintf(fh, "<structure>\n"); for(i=0; i < edt->pi.cinfo->num_cols; i++) { @@ -591,7 +593,7 @@ proto_tree_write_psml(epan_dissect_t *edt, FILE *fh) fprintf(fh, "</structure>\n\n"); - structure_written = TRUE; + write_headers = FALSE; } fprintf(fh, "<packet>\n"); @@ -614,7 +616,7 @@ write_psml_finale(FILE *fh) void write_csv_preamble(FILE *fh _U_) { - + write_headers = TRUE; } void @@ -623,11 +625,13 @@ proto_tree_write_csv(epan_dissect_t *edt, FILE *fh) gint i; /* if this is the first packet, we have to write the CSV header */ - if(edt->pi.fd->num == 1) { + if(write_headers) { for(i=0; i < edt->pi.cinfo->num_cols - 1; i++) fprintf(fh, "\"%s\",", edt->pi.cinfo->col_title[i]); fprintf(fh, "\"%s\"\n", edt->pi.cinfo->col_title[i]); + + write_headers = FALSE; } for(i=0; i < edt->pi.cinfo->num_cols - 1; i++) |