printf improvements

This commit is contained in:
K. Lange 2018-02-28 16:22:44 +09:00 committed by Kevin Lange
parent fe7f798506
commit b6bdcc979e

View File

@ -13,7 +13,7 @@ static void print_dec(unsigned int value, unsigned int width, char * buf, int *
int printed = 0;
while (n_width + printed < width) {
buf[*ptr] = '0';
buf[*ptr] = ' ';
*ptr += 1;
printed += 1;
}
@ -77,6 +77,10 @@ size_t vasprintf(char * buf, const char * fmt, va_list args) {
align = 0;
++f;
}
if (*f == '*') {
arg_width = (char)va_arg(args, int);
++f;
}
while (*f >= '0' && *f <= '9') {
arg_width *= 10;
arg_width += *f - '0';