aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2019-12-13 09:45:34 +0100
committerLuca Deri <deri@ntop.org>2019-12-13 09:45:34 +0100
commit406aa12468bcab3850df74e28398780294094508 (patch)
tree8bc23a2ca890d3287eeb89f11af814fea7bb48d5
parent2c2bb11c9b704c5b13e9b45d93a16fbad6304cb0 (diff)
Fixed CSV output
-rw-r--r--example/ndpiReader.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 7f0ebda23..6fc7e7a07 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -694,8 +694,6 @@ static void parseOptions(int argc, char **argv) {
case 'C':
if((csv_fp = fopen(optarg, "w")) == NULL)
printf("Unable to write on CSV file %s\n", optarg);
- else
- printCSVHeader();
break;
case 's':
@@ -830,6 +828,9 @@ static void parseOptions(int argc, char **argv) {
if(_pcap_file[0] == NULL)
help(0);
+ if(csv_fp)
+ printCSVHeader();
+
#ifndef USE_DPDK
if(strchr(_pcap_file[0], ',')) { /* multiple ingress interfaces */
num_threads = 0; /* setting number of threads = number of interfaces */
@@ -1099,9 +1100,9 @@ static void printFlow(u_int16_t id, struct ndpi_flow_info *flow, u_int16_t threa
if((verbose != 1) && (verbose != 2)) {
if(csv_fp && enable_joy_stats) {
flowGetBDMeanandVariance(flow);
- fprintf(csv_fp, "\n");
}
-
+
+ fprintf(csv_fp, "\n");
return;
}