bionic: Have putchar() put \r if \n is printed
Since putchar() is only called by printf() (as opposed to the lower- level serial_putc()), we can have it nicely format the output by adding \r when \n is printed. To get the old behavior back, call serial_putc() directly. This fixes gcc's optimization when calling: printf("\n") As this will get silently turned into a call to putchar('\n') Signed-off-by: Sean Cross <xobs@kosagi.com>
This commit is contained in:
parent
1023337c61
commit
014b62ab26
1 changed files with 2 additions and 1 deletions
3
bionic.c
3
bionic.c
|
@ -345,13 +345,14 @@ void _msleep(uint32_t msecs)
|
|||
int puts(const char *str)
|
||||
{
|
||||
serial_puts(str);
|
||||
serial_putc('\r');
|
||||
serial_putc('\n');
|
||||
return 1;
|
||||
}
|
||||
|
||||
int putchar(int c)
|
||||
{
|
||||
if (c == '\n')
|
||||
serial_putc('\r');
|
||||
serial_putc(c);
|
||||
return c;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue