printf: Support dynamic fill widths

The printf formatting mini-language actually allows you
to pass a '*' character in place of the fill width specification,
in which case it eats one of the passed in arguments and uses it
as width, so implement that.
This commit is contained in:
Sergey Bugaev 2019-08-09 23:24:53 +03:00 committed by Andreas Kling
parent cfe8fdd5aa
commit 79f867238a
Notes: sideshowbarker 2024-07-19 12:47:22 +09:00

View file

@ -222,6 +222,11 @@ template<typename PutChFunc>
if (*(p + 1))
goto one_more;
}
if (*p == '*') {
fieldWidth = va_arg(ap, int);
if (*(p + 1))
goto one_more;
}
if (*p == 'l') {
++long_qualifiers;
if (*(p + 1))