Browse Source

vfwprintf: honor field width with 'c' format type

A. Wilcox 6 years ago
parent
commit
9cdaf1a86b
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/stdio/vfwprintf.c

+ 4 - 1
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);