diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2018-08-23 08:06:12 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-08-28 21:31:05 -0400 |
commit | 9cdaf1a86bf7790c8dec749118392ee78101ee37 (patch) | |
tree | 48a05467b320616e27ec0d3c0c5213c037f4b8d6 | |
parent | d41cdef9198e635270d30e82be939d4ea0cbce82 (diff) | |
download | musl-9cdaf1a86bf7790c8dec749118392ee78101ee37.tar.gz musl-9cdaf1a86bf7790c8dec749118392ee78101ee37.tar.xz musl-9cdaf1a86bf7790c8dec749118392ee78101ee37.zip |
vfwprintf: honor field width with 'c' format type
-rw-r--r-- | src/stdio/vfwprintf.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); |