stdout: Bring back auto-CRLF behaviour as discussed

This commit is contained in:
Angus Gratton 2015-10-06 23:24:40 +11:00
parent 7823a28ff8
commit be3968abf0

View file

@ -41,6 +41,11 @@ long _write_r(struct _reent *r, int fd, const char *ptr, int len )
return -1; return -1;
} }
for(int i = 0; i < len; i++) { 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]); uart_putc(0, ptr[i]);
} }
return len; return len;