*/
ch_flag = _NOLIBC_PF_FLAG(ch);
if (((ch >= 'a' && ch <= 'z') || ch == 'X') &&
- _NOLIBC_PF_FLAGS_CONTAIN(ch_flag, 'c', 'd', 'i', 'u', 'x', 'p')) {
- /* 'long' is needed for pointer conversions and ltz lengths.
+ _NOLIBC_PF_FLAGS_CONTAIN(ch_flag, 'c', 'd', 'i', 'u', 'x', 'p', 's')) {
+ /* 'long' is needed for pointer/string conversions and ltz lengths.
* A single test can be used provided 'p' (the same bit as '0')
* is masked from flags.
*/
if (_NOLIBC_PF_FLAGS_CONTAIN(ch_flag | (flags & ~_NOLIBC_PF_FLAG('p')),
- 'p', 'l', 't', 'z')) {
+ 'p', 's', 'l', 't', 'z')) {
v = va_arg(args, unsigned long);
signed_v = (long)v;
} else if (_NOLIBC_PF_FLAGS_CONTAIN(flags, 'j', 'q')) {
goto do_output;
}
+ if (ch == 's') {
+ /* "%s" - character string. */
+ outstr = (const char *)(uintptr_t)v;
+ if (!outstr)
+ outstr = "(null)";
+ goto do_strlen_output;
+ }
+
out = outbuf;
if (_NOLIBC_PF_FLAGS_CONTAIN(ch_flag, 'd', 'i')) {
goto do_strlen_output;
}
- if (ch == 's') {
- outstr = va_arg(args, char *);
- if (!outstr)
- outstr = "(null)";
- goto do_strlen_output;
- }
-
if (ch == 'm') {
#ifdef NOLIBC_IGNORE_ERRNO
outstr = "unknown error";