summaryrefslogtreecommitdiff
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
parent53a43fb5416417474e32120e8fcd8694ec496f4c (diff)
downloadgpsd-bc6f155c379b3851076c778ec66b367e0552d49e.tar.gz
In gpsmon, omit hexdumping trailing CR/LF when dumping textual packets.
-rw-r--r--gpsmon.c6
-rw-r--r--gpsmon.xml9
2 files changed, 11 insertions, 4 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);
}
diff --git a/gpsmon.xml b/gpsmon.xml
index 58198e7b..876b486f 100644
--- a/gpsmon.xml
+++ b/gpsmon.xml
@@ -156,10 +156,11 @@ the contents of several especially interesting packet types. The
second and the system clock at that time.</para>
<para>The bottom half of the screen is a scrolling hex dump of all
-packets the GPS is issuing. Dump lines beginning &gt;&gt;&gt;
-represent control packets sent to the GPS. Lines consisting of "PPS"
-surrounded by dashes, if present, indicate 1PPS and the start of the
-reporting cycle.</para>
+packets the GPS is issuing. If the packet type is textual, any
+trailing CR/LF is omitted. Dump lines beginning &gt;&gt;&gt; represent
+control packets sent to the GPS. Lines consisting of "PPS" surrounded
+by dashes, if present, indicate 1PPS and the start of the reporting
+cycle.</para>
</refsect1>
<refsect1 id='commands'><title>COMMANDS</title>