From 828663767a0d35e9db56fb6b52bf57c82d75062b Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Fri, 17 May 2002 06:12:25 +0000 Subject: Add support for printing long doubles. PR: 36783 --- usr.bin/hexdump/display.c | 5 +++++ usr.bin/hexdump/hexdump.1 | 2 +- usr.bin/hexdump/parse.c | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'usr.bin/hexdump') diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c index fdfb1744a78a..9da5bf942bae 100644 --- a/usr.bin/hexdump/display.c +++ b/usr.bin/hexdump/display.c @@ -117,6 +117,7 @@ print(pr, bp) PR *pr; u_char *bp; { + long double ldbl; double f8; float f4; int16_t s2; @@ -149,6 +150,10 @@ print(pr, bp) bcopy(bp, &f8, sizeof(f8)); (void)printf(pr->fmt, f8); break; + case sizeof(long double): + bcopy(bp, &ldbl, sizeof(ldbl)); + (void)printf(pr->fmt, ldbl); + break; } break; case F_INT: diff --git a/usr.bin/hexdump/hexdump.1 b/usr.bin/hexdump/hexdump.1 index 84ae2f1576a4..a004c1d6737a 100644 --- a/usr.bin/hexdump/hexdump.1 +++ b/usr.bin/hexdump/hexdump.1 @@ -276,7 +276,7 @@ Four byte default, one, two and four byte counts supported. .Li \&%E , \&%e , \&%f , .Li \&%G , \&%g .Xc -Eight byte default, four byte counts supported. +Eight byte default, four and twelve byte counts supported. .El .Pp The amount of data interpreted by each format string is the sum of the diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c index bd96462776a2..da93e7bd670c 100644 --- a/usr.bin/hexdump/parse.c +++ b/usr.bin/hexdump/parse.c @@ -313,6 +313,12 @@ isint: cs[2] = '\0'; case 4: pr->bcnt = 4; break; + case sizeof(long double): + cs[2] = '\0'; + cs[1] = cs[0]; + cs[0] = 'L'; + pr->bcnt = sizeof(long double); + break; default: p1[1] = '\0'; badcnt(p1); -- cgit v1.2.3