genode/repos/os/src/app/cli_monitor/terminal_util.h
Norman Feske ca971bbfd8 Move repositories to 'repos/' subdirectory
This patch changes the top-level directory layout as a preparatory
step for improving the tools for managing 3rd-party source codes.
The rationale is described in the issue referenced below.

Issue #1082
2014-05-14 16:08:00 +02:00

37 lines
687 B
C++

/*
* \brief Convenience functions for operating on a terminal session
* \author Norman Feske
* \date 2013-03-19
*/
#ifndef _TERMINAL_UTIL_H_
#define _TERMINAL_UTIL_H_
/* Genode includes */
#include <terminal_session/terminal_session.h>
#include <base/snprintf.h>
namespace Terminal {
static inline void tprintf(Session &terminal, const char *format_args, ...)
{
using namespace Genode;
enum { MAX_LEN = 256 };
char buf[MAX_LEN];
/* process format string */
va_list list;
va_start(list, format_args);
String_console sc(buf, MAX_LEN);
sc.vprintf(format_args, list);
va_end(list);
terminal.write(buf, strlen(buf));
}
}
#endif /* _TERMINAL_UTIL_H_ */