From be3968abf0cada6cc1740b775e9a00136fba6981 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 6 Oct 2015 23:24:40 +1100 Subject: [PATCH] stdout: Bring back auto-CRLF behaviour as discussed --- core/newlib_syscalls.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/newlib_syscalls.c b/core/newlib_syscalls.c index a3212c2..ae15aff 100644 --- a/core/newlib_syscalls.c +++ b/core/newlib_syscalls.c @@ -41,6 +41,11 @@ long _write_r(struct _reent *r, int fd, const char *ptr, int len ) return -1; } for(int i = 0; i < len; i++) { + /* Auto convert CR to CRLF, ignore other LFs (compatible with Espressif SDK behaviour) */ + if(ptr[i] == '\r') + continue; + if(ptr[i] == '\n') + uart_putc(0, '\r'); uart_putc(0, ptr[i]); } return len;