mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-18 08:02:48 +00:00
4e71fe0a81
"0.000", trimming trailing non-zeros and adding back trailing zeros. Fix both the original bug, which was caused by walking off the beginning of the fractional part of the value and into the integer part, as well as the new bug, by terminating the trailing zero stripping when the first non-zero character is encountered. Also, correctly calculate the number number of trailing zeros that should potentially be removed if the format contains trailing text characters. Bump PORTREVISION. Reviewed by: send-pr@oldach.net (Helge Oldach)
29 lines
504 B
Plaintext
29 lines
504 B
Plaintext
--- format.c.orig Mon May 11 11:43:34 1992
|
|
+++ format.c Sun Jun 23 19:38:37 2002
|
|
@@ -256,14 +256,14 @@
|
|
|
|
case '#':
|
|
width++;
|
|
+ zero_pad++;
|
|
break;
|
|
|
|
case '0':
|
|
- zero_pad = ++width;
|
|
+ width++;
|
|
break;
|
|
}
|
|
}
|
|
- zero_pad = strlen(decimal) - zero_pad;
|
|
}
|
|
(void) sprintf(prtfmt, "%%.%dlf", width);
|
|
(void) sprintf(mantissa, prtfmt, val);
|
|
@@ -281,6 +281,8 @@
|
|
{
|
|
if (*cp == '0')
|
|
*cp = EOS;
|
|
+ else
|
|
+ break;
|
|
}
|
|
}
|
|
|