summaryrefslogtreecommitdiffstats
path: root/src/host/osmocon
diff options
context:
space:
mode:
authorJan Luebbe2010-05-16 17:31:21 +0200
committerHarald Welte2010-05-19 20:29:55 +0200
commitbcf3badc5b057c5651d15d11262afa757775cf47 (patch)
tree22243eb6800c8753258dd76a0e3a0d9c0ef929ed /src/host/osmocon
parentosmocon: change mtk load address for MT6223 romloader (diff)
downloadosmocom-bcf3badc5b057c5651d15d11262afa757775cf47.tar.gz
osmocom-bcf3badc5b057c5651d15d11262afa757775cf47.tar.xz
osmocom-bcf3badc5b057c5651d15d11262afa757775cf47.zip
osmocon: extend hexdump to show all printable characters
Diffstat (limited to 'src/host/osmocon')
-rw-r--r--src/host/osmocon/osmocon.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c
index ea23c0d..1f4d9ca 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>
@@ -443,11 +444,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");
}