summaryrefslogtreecommitdiff
path: root/netsniff-ng.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-03-31 15:56:34 +0200
committerTobias Klauser <tklauser@distanz.ch>2015-03-31 17:22:55 +0200
commit2d76b0b011d451eac6dd08645e5958a25c4b8944 (patch)
tree56d314f8eddf8156640793785db329078825df26 /netsniff-ng.c
parent55774d8218cb4f63d664f705cb1d93571aba10b7 (diff)
netsniff-ng: No trailing whitespaces in generated trafgen config files
Make sure we don't print any unnecessary trailing whitespaces to the trafgen config file when converting from pcap. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'netsniff-ng.c')
-rw-r--r--netsniff-ng.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/netsniff-ng.c b/netsniff-ng.c
index a2067d3..8c7a105 100644
--- a/netsniff-ng.c
+++ b/netsniff-ng.c
@@ -494,7 +494,7 @@ static void translate_pcap_to_txf(int fdo, uint8_t *out, size_t len)
write_or_die(fdo, bout, strlen(bout));
while (bytes_done < len) {
- slprintf(bout, sizeof(bout), "0x%02x, ", out[bytes_done]);
+ slprintf(bout, sizeof(bout), "0x%02x,", out[bytes_done]);
write_or_die(fdo, bout, strlen(bout));
bytes_done++;
@@ -507,6 +507,9 @@ static void translate_pcap_to_txf(int fdo, uint8_t *out, size_t len)
slprintf(bout, sizeof(bout), " ");
write_or_die(fdo, bout, strlen(bout));
}
+ } else if (bytes_done < len) {
+ slprintf(bout, sizeof(bout), " ");
+ write_or_die(fdo, bout, strlen(bout));
}
}
if (bytes_done % 10 != 0) {