--- src/host/osmocon/osmocon.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c index b823b5b..4ad48e2 100644 --- a/src/host/osmocon/osmocon.c +++ b/src/host/osmocon/osmocon.c @@ -22,6 +22,7 @@ * */
+#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -418,11 +419,16 @@ int read_file(const char *filename)
static void hexdump(const uint8_t *data, unsigned int len) { - const uint8_t *bufptr = data; int n;
- for (n=0; n < len; n++, bufptr++) - printf("%02x ", *bufptr); + for (n=0; n < len; n++) + printf("%02x ", data[n]); + printf(" "); + for (n=0; n < len; n++) + if (isprint(data[n])) + putchar(data[n]); + else + putchar('.'); printf("\n"); }