summaryrefslogtreecommitdiffstats
path: root/usr.bin/hexdump
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-05-17 08:54:32 +0000
committertjr <tjr@FreeBSD.org>2002-05-17 08:54:32 +0000
commit5a5d149d29b88f2e6da594305480bce7511aa76e (patch)
tree2eb010afd5e7ca3e52f869c042147a6f384be7b0 /usr.bin/hexdump
parent7c4cad23235825f053d78e22c44306fc17d3c66f (diff)
downloadFreeBSD-src-5a5d149d29b88f2e6da594305480bce7511aa76e.zip
FreeBSD-src-5a5d149d29b88f2e6da594305480bce7511aa76e.tar.gz
Make the output tidier when multiple integer formats are requested by
attempting to line up values into columns. Obtained from: NetBSD (idea)
Diffstat (limited to 'usr.bin/hexdump')
-rw-r--r--usr.bin/hexdump/odsyntax.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/hexdump/odsyntax.c b/usr.bin/hexdump/odsyntax.c
index 082a0a0..c371f1e 100644
--- a/usr.bin/hexdump/odsyntax.c
+++ b/usr.bin/hexdump/odsyntax.c
@@ -423,9 +423,9 @@ odformatint(char fchar, const char *fmt)
}
if (fchar == 'd')
digits++;
- asprintf(&hdfmt, "%lu/%lu \"%%%s%d%c \" \"\\n\"",
- 16UL / (u_long)isize, (u_long)isize,
- (fchar == 'd' || fchar == 'u') ? "" : "0", digits, fchar);
+ asprintf(&hdfmt, "%lu/%lu \"%*s%%%s%d%c\" \"\\n\"",
+ 16UL / (u_long)isize, (u_long)isize, (int)(4 * isize - digits),
+ "", (fchar == 'd' || fchar == 'u') ? "" : "0", digits, fchar);
if (hdfmt == NULL)
err(1, NULL);
odadd(hdfmt);
OpenPOWER on IntegriCloud