Index: uspace/app/init/init.c
===================================================================
--- uspace/app/init/init.c	(revision 84afc7bf42bf4b5e22750a7f377f4bfc31636630)
+++ uspace/app/init/init.c	(revision 266daf5aa5865243097d6ed156a141a4df50764c)
@@ -45,4 +45,5 @@
 #include <malloc.h>
 #include <macros.h>
+#include <console.h>
 #include "init.h"
 #include "version.h"
Index: uspace/app/klog/klog.c
===================================================================
--- uspace/app/klog/klog.c	(revision 84afc7bf42bf4b5e22750a7f377f4bfc31636630)
+++ uspace/app/klog/klog.c	(revision 266daf5aa5865243097d6ed156a141a4df50764c)
@@ -42,4 +42,5 @@
 #include <sysinfo.h>
 #include <io/stream.h>
+#include <console.h>
 #include <errno.h>
 
Index: uspace/app/tetris/input.c
===================================================================
--- uspace/app/tetris/input.c	(revision 84afc7bf42bf4b5e22750a7f377f4bfc31636630)
+++ uspace/app/tetris/input.c	(revision 266daf5aa5865243097d6ed156a141a4df50764c)
@@ -59,4 +59,5 @@
 #include <async.h>
 #include <ipc/console.h>
+#include <console.h>
 #include <kbd/kbd.h>
 
@@ -115,5 +116,5 @@
 again:
 		if (!getchar_inprog) {
-			cons_phone = get_console_phone();
+			cons_phone = console_phone_get();
 			getchar_inprog = async_send_2(cons_phone,
 			    CONSOLE_GETKEY, 0, 0, &charcall);
Index: uspace/lib/libc/generic/console.c
===================================================================
--- uspace/lib/libc/generic/console.c	(revision 84afc7bf42bf4b5e22750a7f377f4bfc31636630)
+++ uspace/lib/libc/generic/console.c	(revision 266daf5aa5865243097d6ed156a141a4df50764c)
@@ -1,3 +1,5 @@
 /*
+ * Copyright (c) 2006 Josef Cejka
+ * Copyright (c) 2006 Jakub Vana
  * Copyright (c) 2008 Jiri Svoboda
  * All rights reserved.
@@ -36,9 +38,44 @@
 #include <io/stream.h>
 #include <ipc/console.h>
+#include <ipc/services.h>
 #include <console.h>
+
+static int console_phone = -1;
+
+void console_open(void)
+{
+	if (console_phone < 0) {
+		int phone = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0, 0);
+		if (phone >= 0)
+			console_phone = phone;
+	}
+}
+
+void console_close(void)
+{
+	if (console_phone >= 0) {
+		if (ipc_hangup(console_phone) == 0) {
+			console_phone = -1;
+		}
+	}
+}
+
+int console_phone_get(void)
+{
+	if (console_phone < 0)
+		console_open();
+	
+	return console_phone;
+}
+
+void console_wait(void)
+{
+	while (console_phone < 0)
+		console_open();
+}
 
 void console_clear(void)
 {
-	int cons_phone = get_console_phone();
+	int cons_phone = console_phone_get();
 	async_msg_0(cons_phone, CONSOLE_CLEAR);
 }
@@ -46,11 +83,17 @@
 void console_goto(int row, int col)
 {
-	int cons_phone = get_console_phone();
+	int cons_phone = console_phone_get();
 	async_msg_2(cons_phone, CONSOLE_GOTO, row, col);
+}
+
+void console_putchar(int c)
+{
+	int cons_phone = console_phone_get();
+	async_msg_1(cons_phone, CONSOLE_PUTCHAR, c);
 }
 
 void console_flush(void)
 {
-	int cons_phone = get_console_phone();
+	int cons_phone = console_phone_get();
 	async_msg_0(cons_phone, CONSOLE_FLUSH);
 }
@@ -58,5 +101,5 @@
 int console_get_size(int *rows, int *cols)
 {
-	int cons_phone = get_console_phone();
+	int cons_phone = console_phone_get();
 	ipcarg_t r, c;
 	int rc;
@@ -72,5 +115,5 @@
 void console_set_style(int style)
 {
-	int cons_phone = get_console_phone();
+	int cons_phone = console_phone_get();
 	async_msg_1(cons_phone, CONSOLE_SET_STYLE, style);
 }
@@ -78,5 +121,5 @@
 void console_set_color(int fg_color, int bg_color, int flags)
 {
-	int cons_phone = get_console_phone();
+	int cons_phone = console_phone_get();
 	async_msg_3(cons_phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags);
 }
@@ -84,5 +127,5 @@
 void console_set_rgb_color(int fg_color, int bg_color)
 {
-	int cons_phone = get_console_phone();
+	int cons_phone = console_phone_get();
 	async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color);
 }
@@ -90,5 +133,5 @@
 void console_cursor_visibility(int show)
 {
-	int cons_phone = get_console_phone();
+	int cons_phone = console_phone_get();
 	async_msg_1(cons_phone, CONSOLE_CURSOR_VISIBILITY, show != 0);
 }
Index: uspace/lib/libc/generic/io/stream.c
===================================================================
--- uspace/lib/libc/generic/io/stream.c	(revision 84afc7bf42bf4b5e22750a7f377f4bfc31636630)
+++ uspace/lib/libc/generic/io/stream.c	(revision 266daf5aa5865243097d6ed156a141a4df50764c)
@@ -44,10 +44,9 @@
 #include <ipc/services.h>
 #include <ipc/console.h>
+#include <console.h>
 #include <kbd/kbd.h>
 #include <unistd.h>
 #include <async.h>
 #include <sys/types.h>
-
-static int console_phone = -1;
 
 ssize_t write_stderr(const void *buf, size_t count)
@@ -58,6 +57,7 @@
 ssize_t read_stdin(void *buf, size_t count)
 {
-	open_console();
-	if (console_phone >= 0) {
+	int cons_phone = console_phone_get();
+
+	if (cons_phone >= 0) {
 		kbd_event_t ev;
 		int rc;
@@ -80,33 +80,15 @@
 ssize_t write_stdout(const void *buf, size_t count)
 {
-	open_console();
-	if (console_phone >= 0) {
+	int cons_phone = console_phone_get();
+
+	if (cons_phone >= 0) {
 		int i;
-	
+
 		for (i = 0; i < count; i++)
-			async_msg_1(console_phone, CONSOLE_PUTCHAR,
-			    ((const char *) buf)[i]);
-		
+			console_putchar(((const char *) buf)[i]);
+
 		return count;
 	} else
 		return __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, count);
-}
-
-void open_console(void)
-{
-	if (console_phone < 0) {
-		int phone = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0, 0);
-		if (phone >= 0)
-			console_phone = phone;
-	}
-}
-
-void close_console(void)
-{
-	if (console_phone >= 0) {
-		if (ipc_hangup(console_phone) == 0) {
-			console_phone = -1;
-		}
-	}
 }
 
@@ -116,18 +98,4 @@
 }
 
-int get_console_phone(void)
-{
-	if (console_phone < 0)
-		console_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_CONSOLE, 0, 0);
-	
-	return console_phone;
-}
-
-void console_wait(void)
-{
-	while (console_phone < 0)
-		get_console_phone();
-}
-
 /** @}
  */
Index: uspace/lib/libc/generic/kbd.c
===================================================================
--- uspace/lib/libc/generic/kbd.c	(revision 84afc7bf42bf4b5e22750a7f377f4bfc31636630)
+++ uspace/lib/libc/generic/kbd.c	(revision 266daf5aa5865243097d6ed156a141a4df50764c)
@@ -38,13 +38,17 @@
 #include <ipc/ipc.h>
 #include <ipc/console.h>
+#include <console.h>
 #include <async.h>
 
 int kbd_get_event(kbd_event_t *ev)
 {
-	int console_phone = get_console_phone();
+	int cons_phone = console_phone_get();
 	ipcarg_t r0, r1, r2, r3;
 	int rc;
 
-	rc = async_req_0_4(console_phone, CONSOLE_GETKEY, &r0, &r1, &r2, &r3);
+	if (cons_phone < 0)
+		return -1;
+
+	rc = async_req_0_4(cons_phone, CONSOLE_GETKEY, &r0, &r1, &r2, &r3);
 	if (rc < 0)
 		return -1;
Index: uspace/lib/libc/include/console.h
===================================================================
--- uspace/lib/libc/include/console.h	(revision 84afc7bf42bf4b5e22750a7f377f4bfc31636630)
+++ uspace/lib/libc/include/console.h	(revision 266daf5aa5865243097d6ed156a141a4df50764c)
@@ -39,7 +39,15 @@
 #include <console/color.h>
 
+extern void console_open(void);
+extern void console_close(void);
+
+extern int console_phone_get(void);
+extern void console_wait(void);
+
 extern void console_clear(void);
 extern void console_goto(int, int);
+extern void console_putchar(int);
 extern void console_flush(void);
+
 extern int console_get_size(int *, int *);
 extern void console_set_style(int);
Index: uspace/lib/libc/include/io/stream.h
===================================================================
--- uspace/lib/libc/include/io/stream.h	(revision 84afc7bf42bf4b5e22750a7f377f4bfc31636630)
+++ uspace/lib/libc/include/io/stream.h	(revision 266daf5aa5865243097d6ed156a141a4df50764c)
@@ -40,6 +40,4 @@
 #define EMFILE -17
 
-extern void open_console(void);
-extern void close_console(void);
 extern void klog_update(void);
 
@@ -48,7 +46,4 @@
 extern ssize_t write_stderr(const void *, size_t);
 
-extern int get_console_phone(void);
-extern void console_wait(void);
-
 #endif
 
Index: uspace/srv/loader/main.c
===================================================================
--- uspace/srv/loader/main.c	(revision 84afc7bf42bf4b5e22750a7f377f4bfc31636630)
+++ uspace/srv/loader/main.c	(revision 266daf5aa5865243097d6ed156a141a4df50764c)
@@ -54,4 +54,5 @@
 #include <ipc/loader.h>
 #include <loader/pcb.h>
+#include <console.h>
 #include <errno.h>
 #include <async.h>
@@ -283,5 +284,5 @@
 		DPRINTF("Run ELF interpreter.\n");
 		DPRINTF("Entry point: 0x%lx\n", interp_info.entry);
-		close_console();
+		console_close();
 		
 		ipc_answer_0(rid, EOK);
@@ -289,5 +290,5 @@
 	} else {
 		/* Statically linked program */
-		close_console();
+		console_close();
 		ipc_answer_0(rid, EOK);
 		elf_run(&prog_info, &pcb);
