summaryrefslogtreecommitdiff
path: root/gpsmon.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-30 13:41:52 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-03-30 13:41:52 -0400
commitbc6f155c379b3851076c778ec66b367e0552d49e (patch)
tree33a30ca8a8623f2f7ff64cc2b8c13b906236dd3a /gpsmon.c
parent53a43fb5416417474e32120e8fcd8694ec496f4c (diff)
downloadgpsd-bc6f155c379b3851076c778ec66b367e0552d49e.tar.gz
In gpsmon, omit hexdumping trailing CR/LF when dumping textual packets.
Diffstat (limited to 'gpsmon.c')
-rw-r--r--gpsmon.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gpsmon.c b/gpsmon.c
index 59405d53..221a49de 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -204,6 +204,12 @@ static void cond_hexdump(/*@out@*/char *buf2, size_t len2,
buf2[j] = '\0';
}
else {
+ if (TEXTUAL_PACKET_TYPE(session.lexer.type)) {
+ if (i == len - 1 && buf[i] == '\n')
+ continue;
+ if (i == len - 2 && buf[i] == '\r')
+ continue;
+ }
(void)snprintf(&buf2[j], len2-strlen(buf2), "\\x%02x", (unsigned int)(buf[i] & 0xff));
j = strlen(buf2);
}