1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Support field widths in %c printf conversion.

This commit is contained in:
Jonas 'Sortie' Termansen 2013-03-18 14:22:48 +01:00
parent 4e46b40b4c
commit 8180797aa7

View file

@ -23,7 +23,7 @@
*******************************************************************************/ *******************************************************************************/
// Number of bugs seemingly unrelated bugs that have been traced to here: // Number of bugs seemingly unrelated bugs that have been traced to here:
// Countless + 1 // Countless + 2
#include <errno.h> #include <errno.h>
#include <stdint.h> #include <stdint.h>
@ -510,8 +510,12 @@ extern "C" size_t vprintf_callback(size_t (*callback)(void*, const char*, size_t
case CHARACTER: case CHARACTER:
{ {
int c = va_arg(parameters, int); int c = va_arg(parameters, int);
size_t len = 1;
size_t chars = len;
if ( prepend_chars && chars < field_width ) { REPEAT_BLANKS(field_width - chars); }
if ( READY_SIZE <= readylen ) { READY_FLUSH(); } if ( READY_SIZE <= readylen ) { READY_FLUSH(); }
ready[readylen++] = c; ready[readylen++] = c;
if ( append_chars && chars < field_width ) { REPEAT_BLANKS(field_width - chars); }
break; break;
} }
} }