vsprintf: Emit '\r' when printing '\n'
Since putc() doesn't automatically print '\r' when '\n' is printed, we must manually do this conversion ourselves. Signed-off-by: Sean Cross <xobs@kosagi.com>
This commit is contained in:
parent
0bfdbb314f
commit
7321bd91ad
1 changed files with 6 additions and 1 deletions
|
@ -532,7 +532,12 @@ static int vsnprintf_internal(char *buf, size_t size, const char *fmt,
|
|||
str = buf;
|
||||
|
||||
for (; *fmt ; ++fmt) {
|
||||
if (*fmt != '%') {
|
||||
if (*fmt == '\n') {
|
||||
ADDCH(str, '\r');
|
||||
ADDCH(str, '\n');
|
||||
continue;
|
||||
}
|
||||
else if (*fmt != '%') {
|
||||
ADDCH(str, *fmt);
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue