Index: uspace/app/hdisk/Makefile
===================================================================
--- uspace/app/hdisk/Makefile	(revision 700f89ec90c0d82b5e2a3bfa99e10cdac6785fec)
+++ uspace/app/hdisk/Makefile	(revision f6c8fca598545918033eeed9f8e4e8b40bb4ce19)
@@ -37,7 +37,8 @@
 SOURCES = \
 	hdisk.c \
+	input.c \
+	func_none.c \
 	func_mbr.c \
-	func_gpt.c \
-	input.c
+	func_gpt.c
 
 include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/hdisk/func_gpt.c
===================================================================
--- uspace/app/hdisk/func_gpt.c	(revision 700f89ec90c0d82b5e2a3bfa99e10cdac6785fec)
+++ uspace/app/hdisk/func_gpt.c	(revision f6c8fca598545918033eeed9f8e4e8b40bb4ce19)
@@ -71,4 +71,5 @@
 	data->gpt.gpt = gpt_alloc_gpt_header();
 	data->gpt.parts = gpt_alloc_partitions();
+	return EOK;
 }
 
@@ -115,4 +116,5 @@
 int extra_gpt_funcs(tinput_t * in, service_id_t dev_handle, union table_data * data)
 {
+	printf("Not implemented.\n");
 	return EOK;
 }
Index: uspace/app/hdisk/func_mbr.c
===================================================================
--- uspace/app/hdisk/func_mbr.c	(revision 700f89ec90c0d82b5e2a3bfa99e10cdac6785fec)
+++ uspace/app/hdisk/func_mbr.c	(revision f6c8fca598545918033eeed9f8e4e8b40bb4ce19)
@@ -68,5 +68,8 @@
 	printf("Number of the partition to delete (counted from 0): ");
 	idx = get_input_size_t(in);
-
+	
+	if (idx == 0 && errno != EOK)
+		return errno;
+	
 	rc = mbr_remove_partition(data->mbr.parts, idx);
 	if(rc != EOK) {
@@ -81,4 +84,5 @@
 	data->mbr.mbr = mbr_alloc_mbr();
 	data->mbr.parts = mbr_alloc_partitions();
+	return EOK;
 }
 
@@ -103,5 +107,5 @@
 			printf(" ");
 
-		printf("\t%10u %10u %10u %7x\n", it->start_addr, it->start_addr + it->length, it->length, it->type);
+		printf("\t%10u %10u %10u %7u\n", it->start_addr, it->start_addr + it->length, it->length, it->type);
 
 		++num;
@@ -109,5 +113,4 @@
 
 	printf("%d partitions found.\n", num);
-	printf("DEBUG: primary: %hhu, logical: %u\n", data->mbr.parts->n_primary, data->mbr.parts->n_logical);
 	
 	return EOK;
@@ -126,4 +129,5 @@
 int extra_mbr_funcs(tinput_t * in, service_id_t dev_handle, union table_data * data)
 {
+	printf("Not implemented.\n");
 	return EOK;
 }
@@ -152,4 +156,6 @@
 	printf("Set type (0-255): ");
 	type = get_input_uint8(in);
+	if (type == 0 && errno != EOK)
+		return errno;
 
 	///TODO: there can only be one bootable partition; let's do it just like fdisk
@@ -168,7 +174,11 @@
 	printf("Set starting address (number): ");
 	sa = get_input_uint32(in);
+	if (sa == 0 && errno != EOK)
+		return errno;
 
 	printf("Set end addres (number): ");
 	ea = get_input_uint32(in);
+	if (ea == 0 && errno != EOK)
+		return errno;
 	
 	if(ea < sa) {
Index: uspace/app/hdisk/func_none.c
===================================================================
--- uspace/app/hdisk/func_none.c	(revision 700f89ec90c0d82b5e2a3bfa99e10cdac6785fec)
+++ uspace/app/hdisk/func_none.c	(revision f6c8fca598545918033eeed9f8e4e8b40bb4ce19)
@@ -34,12 +34,9 @@
 
 
-#include <loc.h>
-#include <tinput.h>
-#include <libmbr.h>
+#include <errno.h>
 
-#include "common.h"
 #include "func_none.h"
 
-static void not_implemented();
+static void not_implemented(void);
 
 int add_none_part(tinput_t * in, union table_data * data)
Index: uspace/app/hdisk/func_none.h
===================================================================
--- uspace/app/hdisk/func_none.h	(revision 700f89ec90c0d82b5e2a3bfa99e10cdac6785fec)
+++ uspace/app/hdisk/func_none.h	(revision f6c8fca598545918033eeed9f8e4e8b40bb4ce19)
@@ -33,10 +33,9 @@
  */
 
-#ifndef __FUNC_MBR_H__
-#define	__FUNC_MBR_H__
+#ifndef __FUNC_NONE_H__
+#define	__FUNC_NONE_H__
 
 #include <loc.h>
 #include <tinput.h>
-#include <libmbr.h>
 
 #include "common.h"
Index: uspace/app/hdisk/hdisk.c
===================================================================
--- uspace/app/hdisk/hdisk.c	(revision 700f89ec90c0d82b5e2a3bfa99e10cdac6785fec)
+++ uspace/app/hdisk/hdisk.c	(revision f6c8fca598545918033eeed9f8e4e8b40bb4ce19)
@@ -48,10 +48,12 @@
 
 #include "hdisk.h"
+#include "input.h"
+#include "func_gpt.h"
 #include "func_mbr.h"
-#include "func_gpt.h"
+#include "func_none.h"
 
 int interact(service_id_t dev_handle);
 void print_help(void);
-void select_table_format(void);
+void select_table_format(tinput_t * in);
 void fill_table_funcs(void);
 void free_table(void);
@@ -167,5 +169,5 @@
 			case 'n':
 				free_table();
-				table.new_table(in);
+				table.new_table(in, &table.data);
 				break;
 			case 'p':
Index: uspace/app/hdisk/input.c
===================================================================
--- uspace/app/hdisk/input.c	(revision 700f89ec90c0d82b5e2a3bfa99e10cdac6785fec)
+++ uspace/app/hdisk/input.c	(revision f6c8fca598545918033eeed9f8e4e8b40bb4ce19)
@@ -66,4 +66,5 @@
 uint8_t get_input_uint8(tinput_t * in)
 {
+	int rc;
 	uint32_t val;
 	/*char * str;
@@ -83,5 +84,9 @@
 	free(str);*/
 	
-	convert(in, (conv_f) str_uint8_t, &val);
+	rc = convert(in, (conv_f) str_uint8_t, &val);
+	if (rc != EOK) {
+		errno = rc;
+		return 0;
+	}
 	
 	return val;
@@ -90,4 +95,5 @@
 uint32_t get_input_uint32(tinput_t * in)
 {
+	int rc;
 	uint32_t val;
 	/*char * str;
@@ -107,5 +113,9 @@
 	free(str);*/
 	
-	convert(in, (conv_f) str_uint32_t, &val);
+	rc = convert(in, (conv_f) str_uint32_t, &val);
+	if (rc != EOK) {
+		errno = rc;
+		return 0;
+	}
 	
 	return val;
@@ -114,4 +124,5 @@
 uint64_t get_input_uint64(tinput_t * in)
 {
+	int rc;
 	uint64_t val;
 	/*char * str;
@@ -131,5 +142,9 @@
 	free(str);*/
 	
-	convert(in, (conv_f) str_uint64_t, &val);
+	rc = convert(in, (conv_f) str_uint64_t, &val);
+	if (rc != EOK) {
+		errno = rc;
+		return 0;
+	}
 	
 	return val;
@@ -141,5 +156,5 @@
 	size_t val;
 	
-	char * str;
+	/*char * str;
 	rc = get_input_line(in, &str);
 	if (rc != EOK) {
@@ -153,11 +168,12 @@
 		return 0;
 	}
-	free(str);
-	/*
+	free(str);*/
+	
 	rc = convert(in, (conv_f) str_size_t, &val);
 	if (rc != EOK) {
-		return -1;
-	}
-	*/
+		errno = rc;
+		return 0;
+	}
+	
 	errno = EOK;
 	return val;
Index: uspace/lib/gpt/libgpt.c
===================================================================
--- uspace/lib/gpt/libgpt.c	(revision 700f89ec90c0d82b5e2a3bfa99e10cdac6785fec)
+++ uspace/lib/gpt/libgpt.c	(revision f6c8fca598545918033eeed9f8e4e8b40bb4ce19)
@@ -59,5 +59,5 @@
 
 /** Allocate memory for gpt header */
-gpt_t * gpt_alloc_gpt_header()
+gpt_t * gpt_alloc_gpt_header(void)
 {
 	return malloc(sizeof(gpt_t));
Index: uspace/lib/gpt/libgpt.h
===================================================================
--- uspace/lib/gpt/libgpt.h	(revision 700f89ec90c0d82b5e2a3bfa99e10cdac6785fec)
+++ uspace/lib/gpt/libgpt.h	(revision f6c8fca598545918033eeed9f8e4e8b40bb4ce19)
@@ -139,9 +139,9 @@
 
 
-extern gpt_t * gpt_alloc_gpt_header();
+extern gpt_t * gpt_alloc_gpt_header(void);
 extern gpt_t * gpt_read_gpt_header(service_id_t dev_handle);
 extern int gpt_write_gpt_header(gpt_t * header, service_id_t dev_handle);
 
-extern gpt_partitions_t *	gpt_alloc_partitions();
+extern gpt_partitions_t *	gpt_alloc_partitions(void);
 extern gpt_partitions_t *	gpt_read_partitions	(gpt_t * gpt);
 extern int 					gpt_write_partitions	(gpt_partitions_t * parts, gpt_t * header, service_id_t dev_handle);
Index: uspace/lib/mbr/libmbr.c
===================================================================
--- uspace/lib/mbr/libmbr.c	(revision 700f89ec90c0d82b5e2a3bfa99e10cdac6785fec)
+++ uspace/lib/mbr/libmbr.c	(revision f6c8fca598545918033eeed9f8e4e8b40bb4ce19)
@@ -54,7 +54,7 @@
 
 /** Allocate memory for mbr_t */
-mbr_t * mbr_alloc_mbr()
-{
-	return alloc_br();
+mbr_t * mbr_alloc_mbr(void)
+{
+	return malloc(sizeof(mbr_t));
 }
 
@@ -405,5 +405,5 @@
 		
 		// if it's extended, is there any other one?
-		if (p->type == PT_EXTENDED && parts->l_extended != NULL) {
+		if ((p->type == PT_EXTENDED || p->type == PT_EXTENDED_LBA) && parts->l_extended != NULL) {
 			return ERR_EXTENDED_PRESENT;
 		}
@@ -425,4 +425,7 @@
 		}
 		parts->n_primary += 1;
+		
+		if (p->type == PT_EXTENDED || p->type == PT_EXTENDED_LBA)
+			parts->l_extended = &(p->link);
 	}
 
Index: uspace/lib/mbr/libmbr.h
===================================================================
--- uspace/lib/mbr/libmbr.h	(revision 700f89ec90c0d82b5e2a3bfa99e10cdac6785fec)
+++ uspace/lib/mbr/libmbr.h	(revision f6c8fca598545918033eeed9f8e4e8b40bb4ce19)
@@ -188,5 +188,5 @@
  * then partitions. The MBR headers' raw_data is NOT updated to follow
  * partition changes. */
-extern mbr_t * mbr_alloc_mbr();
+extern mbr_t * mbr_alloc_mbr(void);
 extern mbr_t * mbr_read_mbr(service_id_t dev_handle);
 extern int mbr_write_mbr(mbr_t * mbr, service_id_t dev_handle);
