summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfprintf.c
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2003-04-19 23:53:19 +0000
committerdas <das@FreeBSD.org>2003-04-19 23:53:19 +0000
commit30c051657aa8331d42378a009a8371c2102a33eb (patch)
tree519d7da30b0d8498849fc8af728bb292a52e27a9 /lib/libc/stdio/vfprintf.c
parentdc48d3db81e4e6fe22622e0d7918174a41a9e4e8 (diff)
downloadFreeBSD-src-30c051657aa8331d42378a009a8371c2102a33eb.zip
FreeBSD-src-30c051657aa8331d42378a009a8371c2102a33eb.tar.gz
%E-like %g and %G conversions should remove trailing zeroes unless
the # flag is present. Implement this behavior and add a comment describing it. Noticed by: Enache Adrian <enache@rdslink.ro> Pointy hat to: das
Diffstat (limited to 'lib/libc/stdio/vfprintf.c')
-rw-r--r--lib/libc/stdio/vfprintf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index 0f0cf52..6125db3 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -920,6 +920,13 @@ fp_begin:
prec = ndig - expt;
if (prec < 0)
prec = 0;
+ } else {
+ /*
+ * Make %[gG] smell like %[eE], but
+ * trim trailing zeroes if no # flag.
+ */
+ if (!(flags & ALT))
+ prec = ndig;
}
}
if (expchar) {
OpenPOWER on IntegriCloud