Add cr after a lf is printed (configurable)

Formatting
This commit is contained in:
Jeroen Domburg
2016-08-23 15:02:27 +08:00
parent 49b2dfea1e
commit d579040e32
2 changed files with 18 additions and 2 deletions

View File

@@ -134,9 +134,14 @@ int _open_r(struct _reent *r, const char * path, int flags, int mode) {
}
ssize_t _write_r(struct _reent *r, int fd, const void * data, size_t size) {
const char* p = (const char*) data;
const char* p = (const char*) data;
if (fd == STDOUT_FILENO) {
while(size--) {
#if CONFIG_NEWLIB_STDOUT_ADDCR
if (*p=='\n') {
uart_tx_one_char('\r');
}
#endif
uart_tx_one_char(*p);
++p;
}