The explicit LFCR sequence guarantees proper line by line formatting in the output. The '\n' character alone on some terminals is not automatically converted to LFCR.
Signed-off-by: Pawel Wieczorkiewicz <wipa...@amazon.de> --- Changed since v1: * Emit CRLF instead of LFCR common/libc/vsnprintf.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/libc/vsnprintf.c b/common/libc/vsnprintf.c index a49fd30..b9a4fab 100644 --- a/common/libc/vsnprintf.c +++ b/common/libc/vsnprintf.c @@ -284,7 +284,17 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) /* Put regular characters into the destination. */ if ( *fmt != '%' ) { + /* + * The '\n' character alone on some terminals is not automatically + * converted to CRLF. + * The explicit CRLF sequence guarantees proper line by line + * formatting in the output. + */ + if ( *fmt == '\n' && str < end ) + PUT('\r'); + PUT(*fmt); + continue; } -- 2.16.6 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879