diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2017-12-15 12:17:50 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2017-12-15 12:17:50 +0000 |
commit | 3d1120af1044c7e5b9818944bd648fbaaf7c71eb (patch) | |
tree | 775b2eab256387ac15b40db826003237db74c173 /usr.bin/jot | |
parent | df4a57541fd2fb75d0bd3cb71930cb0a783f8ffd (diff) |
Make sure the double is cast to a long if the format string is %D, %O, %U.
Fixes output of e.g. 'jot -w %D 11 -5'.
ok martijn
Diffstat (limited to 'usr.bin/jot')
-rw-r--r-- | usr.bin/jot/jot.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/jot/jot.c b/usr.bin/jot/jot.c index 0de3a510136..63c77bbb6fb 100644 --- a/usr.bin/jot/jot.c +++ b/usr.bin/jot/jot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: jot.c,v 1.36 2016/09/02 14:23:09 tb Exp $ */ +/* $OpenBSD: jot.c,v 1.37 2017/12/15 12:17:49 tb Exp $ */ /* $NetBSD: jot.c,v 1.3 1994/12/02 20:29:43 pk Exp $ */ /*- @@ -420,12 +420,16 @@ getformat(void) intdata = true; break; case 'D': + /* %lD is undefined */ if (!longdata) { + longdata = true; /* %D behaves as %ld */ intdata = true; break; } case 'O': case 'U': + /* %lO and %lU are undefined */ if (!longdata) { + longdata = true; /* %O, %U behave as %lo, %lu */ intdata = nosign = true; break; } |