diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-03-31 15:56:34 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-03-31 17:22:55 +0200 |
commit | 2d76b0b011d451eac6dd08645e5958a25c4b8944 (patch) | |
tree | 56d314f8eddf8156640793785db329078825df26 | |
parent | 55774d8218cb4f63d664f705cb1d93571aba10b7 (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>
-rw-r--r-- | netsniff-ng.c | 5 |
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) { |