From: A. Wilcox Date: Thu, 23 Aug 2018 13:06:12 +0000 (-0500) Subject: vfwprintf: honor field width with 'c' format type X-Git-Tag: v1.1.20~12 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9cdaf1a86bf7790c8dec749118392ee78101ee37;p=oweals%2Fmusl.git vfwprintf: honor field width with 'c' format type --- diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c index e87ad42a..9d774fcc 100644 --- a/src/stdio/vfwprintf.c +++ b/src/stdio/vfwprintf.c @@ -255,8 +255,11 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ } continue; case 'c': + if (w<1) w=1; + if (w>1 && !(fl&LEFT_ADJ)) fprintf(f, "%*s", w-1, ""); fputwc(btowc(arg.i), f); - l = 1; + if (w>1 && (fl&LEFT_ADJ)) fprintf(f, "%*s", w-1, ""); + l = w; continue; case 'C': fputwc(arg.i, f);