2011-12-31 Yaakov Selkowitz * libc/stdio/vfprintf.c (_VFPRINTF_R): Handle 'm' conversion specifier. * libc/stdio/vfwprintf.c (_VFWPRINTF_R): Ditto. Index: libc/stdio/vfprintf.c =================================================================== RCS file: /cvs/src/src/newlib/libc/stdio/vfprintf.c,v retrieving revision 1.79 diff -u -p -r1.79 vfprintf.c --- libc/stdio/vfprintf.c 15 Feb 2010 16:10:28 -0000 1.79 +++ libc/stdio/vfprintf.c 1 Jan 2012 02:14:32 -0000 @@ -1225,6 +1225,10 @@ reswitch: switch (ch) { sign = '-'; break; #endif /* FLOATING_POINT */ + case 'm': /* extension */ + cp = _strerror_r (data, data->_errno, 0, NULL); + flags &= ~LONGINT; + goto string; case 'n': #ifndef _NO_LONGLONG if (flags & QUADINT) @@ -1272,8 +1276,8 @@ reswitch: switch (ch) { #ifdef _WANT_IO_C99_FORMATS case 'S': #endif - sign = '\0'; cp = GET_ARG (N, ap, char_ptr_t); +string: sign = '\0'; #ifndef __OPTIMIZE_SIZE__ /* Behavior is undefined if the user passed a NULL string when precision is not 0. Index: libc/stdio/vfwprintf.c =================================================================== RCS file: /cvs/src/src/newlib/libc/stdio/vfwprintf.c,v retrieving revision 1.6 diff -u -p -r1.6 vfwprintf.c --- libc/stdio/vfwprintf.c 15 Jul 2011 17:20:16 -0000 1.6 +++ libc/stdio/vfwprintf.c 1 Jan 2012 02:14:33 -0000 @@ -1074,6 +1074,10 @@ reswitch: switch (ch) { sign = L'-'; break; #endif /* FLOATING_POINT */ + case L'm': /* GNU extension */ + cp = (wchar_t *) _strerror_r (data, data->_errno, 0, NULL); + flags &= ~LONGINT; + goto string; case L'n': #ifndef _NO_LONGLONG if (flags & QUADINT) @@ -1118,8 +1122,8 @@ reswitch: switch (ch) { #ifdef _WANT_IO_C99_FORMATS case L'S': /* POSIX extension */ #endif - sign = '\0'; cp = GET_ARG (N, ap, wchar_ptr_t); +string: sign = '\0'; #ifndef __OPTIMIZE_SIZE__ /* Behavior is undefined if the user passed a NULL string when precision is not 0. @@ -1132,7 +1136,7 @@ reswitch: switch (ch) { else #endif /* __OPTIMIZE_SIZE__ */ #ifdef _MB_CAPABLE - if (ch == L's' && !(flags & LONGINT)) { + if (ch != L'S' && !(flags & LONGINT)) { char *arg = (char *) cp; size_t insize = 0, nchars = 0, nconv = 0; mbstate_t ps;