aboutsummaryrefslogtreecommitdiffstats
path: root/snprintf.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-12-08 21:44:33 +0000
committerGuy Harris <guy@alum.mit.edu>1999-12-08 21:44:33 +0000
commit06ba47b45b7135535e04af0feb2d16d797f79522 (patch)
treed02ef80abcadcad4e23a9fa731355c998b7eebbd /snprintf.c
parent870f8165bfc26b2817420b6fc36f96eb230a6792 (diff)
Put the "0[xX]" prefix for "%#[Xx]", and the "0" prefix for "%#o",
*before* any padding "0"s. svn path=/trunk/; revision=1245
Diffstat (limited to 'snprintf.c')
-rw-r--r--snprintf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/snprintf.c b/snprintf.c
index 1c27df7cef..7bf36f4deb 100644
--- a/snprintf.c
+++ b/snprintf.c
@@ -276,9 +276,9 @@ double d;
tmp = otoa(d);
p->width -= strlen(tmp);
- PAD_RIGHT(p);
if (p->square == FOUND) /* had prefix '0' for octal */
PUT_CHAR('0', p);
+ PAD_RIGHT(p);
while (*tmp) { /* octal */
PUT_CHAR(*tmp, p);
tmp++;
@@ -300,10 +300,10 @@ double d;
tmp = htoa(d);
p->width -= strlen(tmp);
- PAD_RIGHT(p);
if (p->square == FOUND) { /* prefix '0x' for hexa */
PUT_CHAR('0', p); PUT_CHAR(*p->pf, p);
}
+ PAD_RIGHT(p);
while (*tmp) { /* hexa */
PUT_CHAR((*p->pf == 'X' ? toupper(*tmp) : *tmp), p);
tmp++;