options/ansi: Implement printf %n terminator

This commit is contained in:
Alexander van der Grinten 2019-01-09 20:29:26 +01:00
parent e02e1f4cc7
commit 8480b21eae

View file

@ -44,7 +44,15 @@ struct PrintfAgent {
__ensure(!opts.precision);
_formatter->append(strerror(errno));
break;
case 'n': {
__ensure(szmod == frg::printf_size_mod::default_size);
auto p = va_arg(_vsp->args, int *);
*p = _formatter->count;
break;
}
default:
mlibc::infoLogger() << "\e[31mmlibc: Unknown printf terminator '"
<< t << "'\e[39m" << frg::endlog;
__ensure(!"Illegal printf terminator");
}
}