committed by
Norman Feske
parent
b9480c0b22
commit
02d5c36cc0
@@ -15,7 +15,6 @@
|
||||
#include <base/allocator.h>
|
||||
#include <base/allocator_avl.h>
|
||||
#include <base/log.h>
|
||||
#include <base/printf.h>
|
||||
#include <block_session/connection.h>
|
||||
#include <util/string.h>
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
/* Genode includes */
|
||||
#include <base/allocator.h>
|
||||
#include <base/log.h>
|
||||
#include <base/printf.h>
|
||||
#include <base/snprintf.h>
|
||||
#include <log_session/log_session.h>
|
||||
#include <util/string.h>
|
||||
|
||||
/* library includes */
|
||||
@@ -57,18 +58,27 @@ int fflush(FILE *)
|
||||
|
||||
int printf(char const *fmt, ...)
|
||||
{
|
||||
static char buffer[Genode::Log_session::MAX_STRING_LEN];
|
||||
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
Genode::vprintf(fmt, list);
|
||||
Genode::String_console sc(buffer, sizeof (buffer));
|
||||
sc.vprintf(fmt, list);
|
||||
va_end(list);
|
||||
|
||||
/* remove newline as Genode::log() will implicitly add one */
|
||||
size_t n = sc.len();
|
||||
if (n > 0 && buffer[n-1] == '\n') { n--; }
|
||||
|
||||
Genode::log(Genode::Cstring(buffer, n));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int puts(const char *s)
|
||||
{
|
||||
Genode::printf(s);
|
||||
printf("%s\n", s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user