Commit 49952996 authored by Bernhard Nortmann's avatar Bernhard Nortmann
Browse files

fel: Simplify hexdump() single character output, using putchar()


Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
parent 425278ac
...@@ -317,23 +317,19 @@ void hexdump(void *data, uint32_t offset, size_t size) ...@@ -317,23 +317,19 @@ void hexdump(void *data, uint32_t offset, size_t size)
size_t i; size_t i;
printf("%08lx: ",(long int)offset + j); printf("%08lx: ",(long int)offset + j);
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if ((j+i) < size) { if (j + i < size)
printf("%02x ", buf[j+i]); printf("%02x ", buf[j+i]);
} else { else
printf("__ "); printf("__ ");
} }
} putchar(' ');
printf(" ");
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if (j+i >= size) { if (j + i >= size)
printf("."); putchar('.');
} else if (isprint(buf[j+i])) { else
printf("%c", buf[j+i]); putchar(isprint(buf[j+i]) ? buf[j+i] : '.');
} else {
printf(".");
}
} }
printf("\n"); putchar('\n');
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment