From ca6f20f38453ffc8c396bbafadfae01e54916536 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Thu, 15 Aug 2013 22:58:26 +0200 Subject: [PATCH] implement uart0_puts properly --- native/drivers/native-uart0.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/native/drivers/native-uart0.c b/native/drivers/native-uart0.c index fc5eed29c3..419b043cc5 100644 --- a/native/drivers/native-uart0.c +++ b/native/drivers/native-uart0.c @@ -5,6 +5,7 @@ #include #include #include +#include #include @@ -19,7 +20,14 @@ fd_set _native_uart_rfds; inline int uart0_puts(char *astring, int length) { - return puts(astring); + _native_in_syscall = 1; + /* XXX: handle short writes: */ + if (write(_native_uart_out, astring, length) == -1) { + err(EXIT_FAILURE, "uart0_puts: write"); + return -1; + } + _native_in_syscall = 0; + return length; } void _native_handle_uart0_input()