From 2d76b0b011d451eac6dd08645e5958a25c4b8944 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 31 Mar 2015 15:56:34 +0200 Subject: 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 --- netsniff-ng.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.3-54-g00ecf