Add %m support to vprintf_callback(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2014-01-16 21:07:29 +01:00
parent 9f34e60cbc
commit af9ea5df04
1 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,6 @@
/******************************************************************************* /*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013. Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014.
This file is part of the Sortix C Library. This file is part of the Sortix C Library.
@ -393,10 +393,14 @@ size_t vprintf_callback(size_t (*callback)(void*, const char*, size_t),
else else
written++; written++;
} }
else if ( *format == 's' && (format++, true) ) else if ( *format == 'm' || *format == 's' )
{ {
char conversion = *format++;
const char* string; const char* string;
if ( length == LENGTH_DEFAULT ) if ( conversion == 'm' )
string = strerror(errno), conversion = 's';
else if ( length == LENGTH_DEFAULT )
string = va_arg(parameters, const char*); string = va_arg(parameters, const char*);
else if ( length == LENGTH_LONG ) else if ( length == LENGTH_LONG )
{ {