diff options
author | Leah Rowe <leah@libreboot.org> | 2025-01-03 00:36:17 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-01-03 00:36:17 +0000 |
commit | 874317c4e591bc5485ac2b248b4e82b8f7646027 (patch) | |
tree | 81e4528cfbabc5a7d5469c76f9a36201af06c855 | |
parent | a338e585eed0ab8589909925582dc29d885665b9 (diff) |
util/nvmutil: nicer hexdump display
make it look like hexdump -C, where individual bytes are
spaced, and there is an additional space after 8 bytes,
per row.
i won't bother with a character display, since that is
meaningless on gbe nvm words.
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r-- | util/nvmutil/nvmutil.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 6c4ebcd6..33cea8e6 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -219,10 +219,12 @@ void hexdump(int partnum) { for (int row = 0; row < 8; row++) { - printf("%07x", row << 4); + printf("%08x ", row << 4); for (int c = 0; c < 8; c++) { uint16_t val16 = word((row << 3) + c, partnum); - printf(" %02x%02x", val16 & 0xff, val16 >> 8); + if (c == 4) + printf(" "); + printf(" %02x %02x", val16 & 0xff, val16 >> 8); } printf("\n"); } } |