summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <slp@sunrisemicro.com>2014-10-27 13:05:29 -0400
committerSolomon Peachy <slp@sunrisemicro.com>2014-10-27 13:05:29 -0400
commit0d8967f3172fa535735ba7c1e04723283fc3aab9 (patch)
tree3b258bd7be6e8590649d3f8a4def913111cb0cac
parentd8d860c4587a0ce6138ca49a1e73c9e542be95fc (diff)
downloadsobredirect-0d8967f3172fa535735ba7c1e04723283fc3aab9.tar.gz
sobredirect-0d8967f3172fa535735ba7c1e04723283fc3aab9.tar.bz2
sobredirect-0d8967f3172fa535735ba7c1e04723283fc3aab9.zip
Only print printable characters.HEADmaster
-rw-r--r--passthru.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/passthru.c b/passthru.c
index 1124a03..a40fb9e 100644
--- a/passthru.c
+++ b/passthru.c
@@ -37,6 +37,7 @@
#include <string.h>
#include <syslog.h>
+#include <ctype.h>
struct sob_config {
uint32_t baud;
@@ -341,7 +342,7 @@ int main (int argc, char **argv)
while ((i = read(ser_fd1, &c, sizeof(c))) > 0) {
char buf[20];
write(ser_fd2, &c, sizeof(c));
- sprintf(buf, "1> 0x%02x \n", c);
+ sprintf(buf, "1> 0x%02x '%c'\n", c, isprint(c)? c : '.' );
write(fileno(stdout), buf, strlen(buf));
}
}
@@ -351,7 +352,7 @@ int main (int argc, char **argv)
while ((i = read(ser_fd2, &c, sizeof(c))) > 0) {
char buf[20];
write(ser_fd1, &c, sizeof(c));
- sprintf(buf, "2> 0x%02x \n", c);
+ sprintf(buf, "2> 0x%02x '%c'\n", c, isprint(c)? c : '.' );
write(fileno(stdout), buf, strlen(buf));
}
}