mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 01:32:14 -05:00
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:
parent
f686b5b51b
commit
cf7910fc1e
Notes:
sideshowbarker
2024-07-19 10:58:02 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/cf7910fc1e8 Pull-request: https://github.com/SerenityOS/serenity/pull/852
1 changed files with 5 additions and 0 deletions
|
@ -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 << ")";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue