summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfprintf.c
diff options
context:
space:
mode:
authorphantom <phantom@FreeBSD.org>2001-12-13 21:05:27 +0000
committerphantom <phantom@FreeBSD.org>2001-12-13 21:05:27 +0000
commit5122d8c93c28fc7008a4d8c9557bb4d76a9c03ad (patch)
tree822d714db12d9b83bd409dad471afb89f5aadce4 /lib/libc/stdio/vfprintf.c
parentdc4fed395a89caee0a44451bce8ea48301e985d2 (diff)
downloadFreeBSD-src-5122d8c93c28fc7008a4d8c9557bb4d76a9c03ad.zip
FreeBSD-src-5122d8c93c28fc7008a4d8c9557bb4d76a9c03ad.tar.gz
Also fix cases when thousands separator should be put before number. For
example before for grouping sequence "\003\003" number 123456 was formated as ",123,456", now "123,456".
Diffstat (limited to 'lib/libc/stdio/vfprintf.c')
-rw-r--r--lib/libc/stdio/vfprintf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index 8aa565c..a332c20 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -221,7 +221,8 @@ __ultoa(u_long val, char *endp, int base, int octzero, char *xdigs,
* If (*grp == CHAR_MAX) then no more grouping
* should be performed.
*/
- if (needgrp && ndig == *grp && *grp != CHAR_MAX) {
+ if (needgrp && ndig == *grp && *grp != CHAR_MAX
+ && sval > 9) {
*--cp = thousep;
ndig = 0;
/*
@@ -291,7 +292,8 @@ __ujtoa(uintmax_t val, char *endp, int base, int octzero, char *xdigs,
* If (*grp == CHAR_MAX) then no more grouping
* should be performed.
*/
- if (needgrp && *grp != CHAR_MAX && ndig == *grp) {
+ if (needgrp && *grp != CHAR_MAX && ndig == *grp
+ && sval > 9) {
*--cp = thousep;
ndig = 0;
/*
OpenPOWER on IntegriCloud