integer:
{
char *ptr = ebuf + sizeof ebuf;
+ bool tempalt = uv ? alt : FALSE; /* Vectors can't change alt */
+ zeros = 0;
+
switch (base) {
unsigned dig;
case 16:
- if (!uv)
- alt = FALSE;
p = (char*)((c == 'X')
? "0123456789ABCDEF" : "0123456789abcdef");
do {
dig = uv & 15;
*--ptr = p[dig];
} while (uv >>= 4);
- if (alt) {
+ if (tempalt) {
esignbuf[esignlen++] = '0';
esignbuf[esignlen++] = c; /* 'x' or 'X' */
}
*--ptr = '0';
break;
case 2:
- if (!uv)
- alt = FALSE;
do {
dig = uv & 1;
*--ptr = '0' + dig;
} while (uv >>= 1);
- if (alt) {
+ if (tempalt) {
esignbuf[esignlen++] = '0';
esignbuf[esignlen++] = 'b';
}
>%v_< >''< >%v_ INVALID<
>%v#x< >''< >%v#x INVALID<
>%v02x< >"foo\012"< >66.6f.6f.0a<
+>%#v.8b< >"a\000b"< >0b01100001.00000000.0b01100010<
+>%#v.4o< >"a\000b"< >0141.0000.0142<
+>%#v.3i< >"a\000b"< >097.000.098<
+>%#v.2x< >"a\000b"< >0x61.00.0x62<
+>%#*v.8b< >["][", "a\000b"]< >0b01100001][00000000][0b01100010<
+>%#*v.4o< >["][", "a\000b"]< >0141][0000][0142<
+>%#*v.3i< >["][", "a\000b"]< >097][000][098<
+>%#*v.2x< >["][", "a\000b"]< >0x61][00][0x62<
+>%#v.8b< >"a\x{1e01}\000b\x{1e03}"< >0b01100001.0b1111000000001.00000000.0b01100010.0b1111000000011<
+>%#v.4o< >"a\x{1e01}\000b\x{1e03}"< >0141.017001.0000.0142.017003<
+>%#v.3i< >"a\x{1e01}\000b\x{1e03}"< >097.7681.000.098.7683<
+>%#v.2x< >"a\x{1e01}\000b\x{1e03}"< >0x61.0x1e01.00.0x62.0x1e03<
>%V-%s< >["Hello"]< >%V-Hello INVALID<
>%K %d %d< >[13, 29]< >%K 13 29 INVALID<
>%*.*K %d< >[13, 29, 76]< >%*.*K 13 INVALID<