Index: init/init.c
===================================================================
--- init/init.c	(revision 53daee361575b2635473e4ab80984e0ae9d1a61f)
+++ init/init.c	(revision 24089699428d6b6e0446e1ca5e9cf13c60d10578)
@@ -28,290 +28,5 @@
 
 #include "version.h"
-#include <ipc/ipc.h>
-#include <ipc/services.h>
-#include <ipc/ns.h>
 #include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <thread.h>
-#include <task.h>
-#include <psthread.h>
-#include <futex.h>
-#include <as.h>
-#include <ddi.h>
-#include <string.h>
-#include <errno.h>
-#include <kbd.h>
-#include <ipc/fb.h>
-#include <async.h>
-#include <sys/time.h>
-
-int a;
-atomic_t ftx;
-
-int __thread stage;
-
-extern void utest(void *arg);
-void utest(void *arg)
-{
-	printf("Uspace thread started.\n");
-	if (futex_down(&ftx) < 0)
-		printf("Futex failed.\n");
-	if (futex_up(&ftx) < 0)
-		printf("Futex failed.\n");
-		
-	printf("%s in good condition.\n", __FUNCTION__);
-	
-	for (;;)
-		;
-}
-
-/* test different parameters types and modifiers */
-static void test_printf(void)
-{
-	printf("Simple text.\n");
-	printf("Now insert '%s' string.\n","this");
-	printf("Signed formats on uns. numbers: '%d', '%+d', '% d', '%u' (,+, ,u)\n", 321, 321, 321, 321);
-	printf("Signed formats on sig. numbers: '%d', '%+d', '% d', '%u' (,+, ,u)\n", -321, -321, -321, -321);
-	printf("Signed with different sized: '%hhd', '%hd', '%d', '%ld', %lld;\n", -3, -32, -321, -32101l, -3210123ll);
-	printf("And now... '%hhd' byte! '%hd' word! '%d' int! \n", 11, 11111, 1111111111);
-	printf("Different bases: %#hx, %#hu, %#ho and %#hb\n", 123, 123, 123, 123);
-	printf("Different bases signed: %#hx, %#hu, %#ho and %#hb\n", -123, -123, -123, -123);
-	printf("'%llX' llX! Another '%llx' llx! \n", 0x1234567887654321ll, 0x1234567887654321ll);
-	printf("'%llX' with 64bit value and '%x' with 32 bit value. \n", 0x1234567887654321ll, 0x12345678 );
-	printf("'%llx' 64bit, '%x' 32bit, '%hhx' 8bit, '%hx' 16bit, '%llX' 64bit and '%s' string.\n", 0x1234567887654321ll, 0x12345678, 0x12, 0x1234, 0x1234567887654321ull, "Lovely string" );
-	
-	printf("Thats all, folks!\n");
-}
-
-/* test width and precision modifiers */
-static void test_printf2(void)
-{
-	printf(" text 10.8s %*.*s \n", 5, 3, "text");
-	printf(" very long text 10.8s %10.8s \n", "very long text");
-	printf(" text 8.10s %8.10s \n", "text");
-	printf(" very long text 8.10s %8.10s \n", "very long text");
-
-	printf(" char: c '%c', 3.2c '%3.2c', -3.2c '%-3.2c', 2.3c '%2.3c', -2.3c '%-2.3c' \n",'a', 'b', 'c', 'd', 'e' );
-	printf(" int: d '%d', 3.2d '%3.2d', -3.2d '%-3.2d', 2.3d '%2.3d', -2.3d '%-2.3d' \n",1, 1, 1, 1, 1 );
-	printf(" -int: d '%d', 3.2d '%3.2d', -3.2d '%-3.2d', 2.3d '%2.3d', -2.3d '%-2.3d' \n",-1, -1, -1, -1, -1 );
-	printf(" 0xint: x '%x', 5.3x '%#5.3x', -5.3x '%#-5.3x', 3.5x '%#3.5x', -3.5x '%#-3.5x' \n",17, 17, 17, 17, 17 );
-
-}
-
-extern char _heap;
-static void test_mremap(void)
-{
-	printf("Writing to good memory\n");
-	as_area_resize(&_heap, 120000, 0);
-	printf("%P\n", ((char *)&_heap));
-	printf("%P\n", ((char *)&_heap) + 80000);
-	*(((char *)&_heap) + 80000) = 10;
-	printf("Making small\n");
-	as_area_resize(&_heap, 16000, 0);
-	printf("Failing..\n");
-	*((&_heap) + 80000) = 10;
-
-	printf("memory done\n");
-}
-/*
-static void test_sbrk(void)
-{
-	printf("Writing to good memory\n");
-	printf("Got: %P\n", sbrk(120000));
-	printf("%P\n", ((char *)&_heap));
-	printf("%P\n", ((char *)&_heap) + 80000);
-	*(((char *)&_heap) + 80000) = 10;
-	printf("Making small, got: %P\n",sbrk(-120000));
-	printf("Testing access to heap\n");
-	_heap = 10;
-	printf("Failing..\n");
-	*((&_heap) + 80000) = 10;
-
-	printf("memory done\n");
-}
-*/
-/*
-static void test_malloc(void)
-{
-	char *data;
-
-	data = malloc(10);
-	printf("Heap: %P, data: %P\n", &_heap, data);
-	data[0] = 'a';
-	free(data);
-}
-*/
-
-
-static void test_ping(void)
-{
-	ipcarg_t result;
-	int retval;
-
-	printf("Pinging\n");
-	retval = ipc_call_sync(PHONE_NS, NS_PING, 0xbeef,&result);
-	printf("Retval: %d - received: %P\n", retval, result);
-}
-
-static void got_answer(void *private, int retval, ipc_call_t *data)
-{
-	printf("Retval: %d...%s...%zX, %zX\n", retval, private,
-	       IPC_GET_ARG1(*data), IPC_GET_ARG2(*data));
-}
-
-
-static void got_answer_2(void *private, int retval, ipc_call_t *data)
-{
-	printf("Pong\n");
-}
-
-static void test_connection_ipc(void)
-{
-	int res;
-	ipcarg_t result;
-	int phoneid;
-
-	printf("Starting connect...\n");
-	res = ipc_connect_me_to(PHONE_NS, 10, 20);
-	printf("Connected: %d\n", res);
-	printf("pinging.\n");
-	res = ipc_call_sync(res, NS_PING, 0xbeef,&result);
-	printf("Retval: %d - received: %X\n", res, result);
-	
-}
-
-static int ptest(void *arg)
-{
-	stage = 1;
-	printf("Pseudo thread stage%d.\n", stage);
-	stage++;
-	psthread_schedule_next();
-	printf("Pseudo thread stage%d.\n", stage);
-	stage++;
-	psthread_schedule_next();
-	printf("Pseudo thread stage%d.\n", stage);
-	psthread_schedule_next();
-	stage++;
-	printf("Pseudo thread stage%d.\n", stage);
-	psthread_schedule_next();
-	printf("Pseudo thread exiting.\n");
-	return 0;	
-}
-
-static void test_kbd()
-{
-	int res;
-	ipcarg_t result;
-	int phoneid;
-
-	printf("Test: Starting connect...\n");
-	while ((phoneid = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0)) < 0) {
-	};
-	
-	printf("Test: Connected: %d\n", res);
-	printf("Test: pinging.\n");
-/*	while (1) {
-		
-		res = ipc_call_sync(phoneid, KBD_GETCHAR, 0xbeef,&result);
-//		printf("Test: Retval: %d - received: %c\n", res, result);
-		printf("%c", result);
-	}
-*/	
-	printf("Test: Hangin up\n");
-	ipc_hangup(phoneid);
-}
-
-static void test_async_kbd()
-{
-	int res;
-	ipcarg_t result;
-	ipc_call_t kbddata;
-	int phoneid;
-	aid_t aid;
-
-	printf("Test: Starting connect...\n");
-	while ((phoneid = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0)) < 0) {
-	};
-	
-	printf("Test: Connected: %d\n", res);
-	printf("Test: pinging.\n");
-
-
-	while (1) {
-	}
-	
-	printf("Test: Hangin up\n");
-	ipc_hangup(phoneid);
-}
-
-static void test_pci()
-{
-	int phone;
-	while ((phone = ipc_connect_me_to(PHONE_NS, SERVICE_PCI, 0)) < 0)
-		;
-	printf("Connected to PCI service through phone %d.\n", phone);
-}
-
-static int test_as_area_send()
-{
-	char *as_area;
-	int retval;
-	ipcarg_t result;
-
-	as_area = as_area_create((void *)(1024*1024), 16384, AS_AREA_READ | AS_AREA_WRITE);
-	if (!as_area) {
-		printf("Error creating as_area.\n");
-		return 0;
-	}
-
-	memcpy(as_area, "Hello world.\n", 14);
-
-	retval = ipc_call_sync_3(PHONE_NS, IPC_M_AS_AREA_SEND, (sysarg_t) as_area, 0, AS_AREA_READ,
-		NULL, NULL, NULL);
-	if (retval) {
-		printf("AS_AREA_SEND failed.\n");
-		return 0;
-	}
-	printf("Done\n");
-}
-
-static void test_fb()
-{
-	int res;
-	ipcarg_t result;
-	int phoneid;
-	int vp;
-
-//	printf("Test: Starting connect...\n");
-
-	while ((phoneid = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0)) < 0) {
-		volatile int a;
-		for(a=0;a<1048576;a++);
-	};
-	
-	usleep(100000);
-	vp = ipc_call_sync_3(phoneid, FB_VIEWPORT_CREATE, (200 << 16) | 300, (200 << 16) | 150,0,NULL,NULL,NULL);
-	if (! ipc_call_sync(phoneid, FB_VIEWPORT_SWITCH, vp, NULL)) {
-		ipc_call_sync_2(phoneid, FB_SET_STYLE, 0, 0xffffff, NULL, NULL);
-		ipc_call_sync(phoneid, FB_CLEAR, 0, NULL);
-		ipc_call_sync_3(phoneid, FB_PUTCHAR, 'X', 0,0, NULL, NULL, NULL);
-	}
-
-	ipc_hangup(phoneid);
-}
-
-static void test_time(void)
-{
-	int rc;
-	struct timeval tv;
-	struct timezone tz;
-
-	while (1) {
-		rc = gettimeofday(&tv, &tz);
-		printf("Rc: %d, Secs: %d, Usecs: %d\n", rc, tv.tv_sec,
-		       tv.tv_usec);
-	}
-}
 
 static void test_console(void)
@@ -323,77 +38,14 @@
 }
 
-
 int main(int argc, char *argv[])
 {
-	pstid_t ptid;
-	int tid;
-	
-//	version_print();
+	version_print();
 
 	printf("Hello\nThis is Init\n");
 	
-//	test_printf();
-//	test_printf2();
-//	test_ping();
-//	test_async_ipc();
-//	test_advanced_ipc();
-//	test_connection_ipc();
-//	test_hangup();
-//	test_slam();
-//	test_as_area_send();
-//	test_pci();
-//	test_kbd();
-//	test_time();
-//	test_async_kbd();
-//	test_fb();
 	test_console();
 
 	printf("\nBye.\n");
 
-/*	
-	printf("Userspace task, taskid=%llX\n", task_get_id());
-
-	futex_initialize(&ftx, 1);
-	if (futex_down(&ftx) < 0)
-		printf("Futex failed.\n");
-	if (futex_up(&ftx) < 0)
-		printf("Futex failed.\n");
-
-	if (futex_down(&ftx) < 0)
-		printf("Futex failed.\n");
-
-	if ((tid = thread_create(utest, NULL, "utest")) != -1) {
-		printf("Created thread tid=%d\n", tid);
-	}
-
-	if ((tid = thread_create(utest, NULL, "utest")) != -1) {
-		printf("Created thread tid=%d\n", tid);
-	}
-
-	int i;
-
-	for (i = 0; i < 50000000; i++)
-		;
-		
-	if (futex_up(&ftx) < 0)
-		printf("Futex failed.\n");
-
-
-	printf("Creating pseudo thread.\n");
-	stage = 1;
-	ptid = psthread_create(ptest, NULL);
-	printf("Main thread stage%d.\n", stage);
-	stage++;
-	psthread_schedule_next();;
-	printf("Main thread stage%d.\n", stage);
-	stage++;
-	psthread_schedule_next();;
-	printf("Main thread stage%d.\n", stage);
-
-	psthread_join(ptid);
-
-	printf("Main thread exiting.\n");
-*/
-
 	return 0;
 }
Index: libc/include/ipc/ns.h
===================================================================
--- libc/include/ipc/ns.h	(revision 53daee361575b2635473e4ab80984e0ae9d1a61f)
+++ libc/include/ipc/ns.h	(revision 24089699428d6b6e0446e1ca5e9cf13c60d10578)
@@ -30,7 +30,3 @@
 #define __LIBIPC__NS_H__
 
-#define NS_PING      1024
-#define NS_PING_SVC  1025
-#define NS_HANGUP    1026
-
 #endif
Index: libc/include/ipc/services.h
===================================================================
--- libc/include/ipc/services.h	(revision 53daee361575b2635473e4ab80984e0ae9d1a61f)
+++ libc/include/ipc/services.h	(revision 24089699428d6b6e0446e1ca5e9cf13c60d10578)
@@ -36,8 +36,7 @@
 
 #define SERVICE_PCI		1
-#define SERVICE_FRAME_BUFFER	2
-#define SERVICE_KEYBOARD	3
-#define SERVICE_VIDEO		4
-#define SERVICE_CONSOLE		5
+#define SERVICE_KEYBOARD	2
+#define SERVICE_VIDEO		3
+#define SERVICE_CONSOLE		4
 
 /* Memory area to be received from NS */
Index: ns/ns.c
===================================================================
--- ns/ns.c	(revision 53daee361575b2635473e4ab80984e0ae9d1a61f)
+++ ns/ns.c	(revision 24089699428d6b6e0446e1ca5e9cf13c60d10578)
@@ -102,8 +102,5 @@
 	ipcarg_t retval, arg1, arg2;
 
-//	printf("%s: Naming service started.\n", NAME);
-	
 	if (!hash_table_create(&ns_hash_table, NS_HASH_TABLE_CHAINS, 3, &ns_hash_table_ops)) {
-//		printf("%s: cannot create hash table\n", NAME);
 		return ENOMEM;
 	}
@@ -111,21 +108,8 @@
 	while (1) {
 		callid = ipc_wait_for_call(&call);
-//		printf("NS: Call in_phone_hash=%lX...", call.in_phone_hash);
 		switch (IPC_GET_METHOD(call)) {
-		case IPC_M_AS_AREA_SEND:
-			as_area = (char *)IPC_GET_ARG1(call);
-//			printf("Received as_area: %P, size:%d\n", as_area, IPC_GET_ARG2(call));
-			retval = ipc_answer_fast(callid, 0,(sysarg_t)(1024*1024), 0);
-			if (!retval) {
-//				printf("Reading shared memory...");
-//				printf("Text: %s", as_area);
-			} else
-//				printf("Failed answer: %d\n", retval);
-			continue;
 		case IPC_M_AS_AREA_RECV:
 			get_realtime_as(callid, &call);
 			continue;
-		case IPC_M_INTERRUPT:
-			break;
 		case IPC_M_PHONE_HUNGUP:
 			retval = 0;
@@ -136,5 +120,4 @@
 			 */
 			retval = register_service(IPC_GET_ARG1(call), IPC_GET_ARG3(call), &call);
-			ping_phone = IPC_GET_ARG3(call);
 			break;
 		case IPC_M_CONNECT_ME_TO:
@@ -144,27 +127,9 @@
 			retval = connect_to_service(IPC_GET_ARG1(call), &call, callid);
 			break;
-		case NS_HANGUP:
-//			printf("Closing connection.\n");
-			retval = EHANGUP;
-			break;
-		case NS_PING:
-//			printf("Ping...%P %P\n", IPC_GET_ARG1(call),
-//			       IPC_GET_ARG2(call));
-			retval = 0;
-			arg1 = 0xdead;
-			arg2 = 0xbeef;
-			break;
-		case NS_PING_SVC:
-//			printf("NS:Pinging service %d\n", ping_phone);
-			ipc_call_sync(ping_phone, NS_PING, 0xbeef, 0);
-//			printf("NS:Got pong\n");
-			break;
 		default:
-//			printf("Unknown method: %zd\n", IPC_GET_METHOD(call));
 			retval = ENOENT;
 			break;
 		}
 		if (! (callid & IPC_CALLID_NOTIFICATION)) {
-//			printf("Answering.\n");
 			ipc_answer_fast(callid, retval, arg1, arg2);
 		}
@@ -185,8 +150,5 @@
 	hashed_service_t *hs;
 			
-//	printf("Registering service %d on phone %d...", service, phone);
-
 	if (hash_table_find(&ns_hash_table, keys)) {
-//		printf("Service %d already registered.\n", service);
 		return EEXISTS;
 	}
@@ -194,5 +156,4 @@
 	hs = (hashed_service_t *) malloc(sizeof(hashed_service_t));
 	if (!hs) {
-//		printf("Failed to register service %d.\n", service);
 		return ENOMEM;
 	}
@@ -223,9 +184,7 @@
 	hlp = hash_table_find(&ns_hash_table, keys);
 	if (!hlp) {
-//		printf("Service %d not registered.\n", service);
 		return ENOENT;
 	}
 	hs = hash_table_get_instance(hlp, hashed_service_t, link);
-//	printf("Connecting in_phone_hash=%lX to service at phone %d...", call->in_phone_hash, hs->phone);
 	return ipc_forward_fast(callid, hs->phone, 0, 0);
 }
