- printf("\t%c%c:", key[0], key[1]);
- if (type == 'A') { printf("A:%c", *s); ++s; }
- else if (type == 'C') { printf("i:%u", *s); ++s; }
- else if (type == 'c') { printf("i:%d", *s); ++s; }
- else if (type == 'S') { printf("i:%u", *(uint16_t*)s); s += 2; }
- else if (type == 's') { printf("i:%d", *(int16_t*)s); s += 2; }
- else if (type == 'I') { printf("i:%u", *(uint32_t*)s); s += 4; }
- else if (type == 'i') { printf("i:%d", *(int32_t*)s); s += 4; }
- else if (type == 'f') { printf("f:%g", *(float*)s); s += 4; }
- else if (type == 'Z' || type == 'H') { printf("%c:", type); while (*s) putchar(*s++); ++s; }
+ ksprintf(&str, "\t%c%c:", key[0], key[1]);
+ if (type == 'A') { ksprintf(&str, "A:%c", *s); ++s; }
+ else if (type == 'C') { ksprintf(&str, "i:%u", *s); ++s; }
+ else if (type == 'c') { ksprintf(&str, "i:%d", *s); ++s; }
+ else if (type == 'S') { ksprintf(&str, "i:%u", *(uint16_t*)s); s += 2; }
+ else if (type == 's') { ksprintf(&str, "i:%d", *(int16_t*)s); s += 2; }
+ else if (type == 'I') { ksprintf(&str, "i:%u", *(uint32_t*)s); s += 4; }
+ else if (type == 'i') { ksprintf(&str, "i:%d", *(int32_t*)s); s += 4; }
+ else if (type == 'f') { ksprintf(&str, "f:%g", *(float*)s); s += 4; }
+ else if (type == 'd') { ksprintf(&str, "d:%lg", *(double*)s); s += 8; }
+ else if (type == 'Z' || type == 'H') { ksprintf(&str, "%c:", type); while (*s) kputc(*s++, &str); ++s; }