mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00: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
|
@ -358,6 +358,11 @@ template<typename PutChFunc>
|
||||||
case 'p':
|
case 'p':
|
||||||
ret += print_hex(putch, bufptr, va_arg(ap, u32), *p == 'P', true, false, true, 8);
|
ret += print_hex(putch, bufptr, va_arg(ap, u32), *p == 'P', true, false, true, 8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'n':
|
||||||
|
*va_arg(ap, int*) = ret;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dbg() << "printf_internal: Unimplemented format specifier " << *p << " (fmt: " << fmt << ")";
|
dbg() << "printf_internal: Unimplemented format specifier " << *p << " (fmt: " << fmt << ")";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue