+static unsigned char printable(unsigned char a)
+{
+ if(a<32 || a==127) return '.';
+ else return a;
+}
+
+static void hexdumpMem(unsigned char*data, int len)
+{
+ int t;
+ char ascii[32];
+ for(t=0;t<len;t++) {
+ printf("%02x ", data[t]);
+ ascii[t&15] = printable(data[t]);
+ if((t && ((t&15)==15)) || (t==len-1))
+ {
+ int s,p=((t)&15)+1;
+ ascii[p] = 0;
+ for(s=p-1;s<16;s++) {
+ printf(" ");
+ }
+ printf(" %s\n", ascii);
+ }
+ }
+}
+