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".
This commit is contained in:
phantom 2001-12-13 21:05:27 +00:00
parent 0b8ccb9292
commit ff35ef7b3f

View File

@ -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;
/*