AK: Implement %n printf specifier

This is a special specifier that does not output anything to the stream,
but saves the number of already output chars to the provided pointer.

This is apparently used by GNU Nano.
This commit is contained in:
Sergey Bugaev 2019-12-05 13:19:25 +03:00 committed by Andreas Kling
parent f686b5b51b
commit cf7910fc1e

View file

@ -358,6 +358,11 @@ template<typename PutChFunc>
case 'p':
ret += print_hex(putch, bufptr, va_arg(ap, u32), *p == 'P', true, false, true, 8);
break;
case 'n':
*va_arg(ap, int*) = ret;
break;
default:
dbg() << "printf_internal: Unimplemented format specifier " << *p << " (fmt: " << fmt << ")";
}