aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/hexdump
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2002-05-17 06:12:25 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2002-05-17 06:12:25 +0000
commit828663767a0d35e9db56fb6b52bf57c82d75062b (patch)
treead080efa6a24fc2c951ac60222c19b76b54e48c8 /usr.bin/hexdump
parentae3f633bae373644db1ecd18f88c2446274949e2 (diff)
downloadsrc-828663767a0d35e9db56fb6b52bf57c82d75062b.tar.gz
src-828663767a0d35e9db56fb6b52bf57c82d75062b.zip
Add support for printing long doubles.
PR: 36783
Notes
Notes: svn path=/head/; revision=96792
Diffstat (limited to 'usr.bin/hexdump')
-rw-r--r--usr.bin/hexdump/display.c5
-rw-r--r--usr.bin/hexdump/hexdump.12
-rw-r--r--usr.bin/hexdump/parse.c6
3 files changed, 12 insertions, 1 deletions
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);