From 7139b2556150f8a8f1fb49b275081e6c10ca0447 Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Fri, 17 May 2002 08:54:32 +0000 Subject: [PATCH] Make the output tidier when multiple integer formats are requested by attempting to line up values into columns. Obtained from: NetBSD (idea) --- usr.bin/hexdump/odsyntax.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/hexdump/odsyntax.c b/usr.bin/hexdump/odsyntax.c index 082a0a01fed9..c371f1ee1708 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);