summaryrefslogtreecommitdiffstats
path: root/fdisks/fdisk.c
diff options
context:
space:
mode:
authorKarel Zak2013-05-21 15:06:11 +0200
committerKarel Zak2013-09-16 16:46:56 +0200
commita410f8df0f4dcbd32986890111397f0b9309cd51 (patch)
tree01a32d877455a49f4ce91a22e23cb53f1f3ef9c7 /fdisks/fdisk.c
parentfdisk: use remove read_int() usage from fdisk.c (diff)
downloadkernel-qcow2-util-linux-a410f8df0f4dcbd32986890111397f0b9309cd51.tar.gz
kernel-qcow2-util-linux-a410f8df0f4dcbd32986890111397f0b9309cd51.tar.xz
kernel-qcow2-util-linux-a410f8df0f4dcbd32986890111397f0b9309cd51.zip
fdisk: use new menu infrastructure to verify keys
- use generic function to ask for key - verify the key against the current menu - call menu callback if defined Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdisk.c')
-rw-r--r--fdisks/fdisk.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c
index 721799327..eba0026e9 100644
--- a/fdisks/fdisk.c
+++ b/fdisks/fdisk.c
@@ -731,8 +731,13 @@ expert_command_prompt(struct fdisk_context *cxt)
while(1) {
assert(cxt->label);
- putchar('\n');
- c = read_char(cxt, _("Expert command (m for help): "));
+ c = process_fdisk_menu(cxt);
+ if (c <= 0)
+ continue;
+
+ /* well, process_fdisk_menu() returns commands that
+ * are not yet implemented by menu callbacks. Let's
+ * perform the commands here */
switch (c) {
case 'a':
if (fdisk_is_disklabel(cxt, SUN))
@@ -829,9 +834,6 @@ expert_command_prompt(struct fdisk_context *cxt)
if (fdisk_is_disklabel(cxt, SUN))
fdisk_sun_set_pcylcount(cxt);
break;
- default:
- print_fdisk_menu(cxt);
- break;
}
}
}
@@ -938,11 +940,15 @@ static void command_prompt(struct fdisk_context *cxt)
}
while (1) {
-
assert(cxt->label);
- putchar('\n');
- c = read_char(cxt, _("Command (m for help): "));
+ c = process_fdisk_menu(cxt);
+ if (c <= 0)
+ continue;
+
+ /* well, process_fdisk_menu() returns commands that
+ * are not yet implemented by menu callbacks. Let's
+ * perform the commands here */
switch (c) {
case 'a':
if (fdisk_is_disklabel(cxt, DOS) &&
@@ -1005,9 +1011,6 @@ static void command_prompt(struct fdisk_context *cxt)
case 'l':
list_partition_types(cxt);
break;
- case 'm':
- print_fdisk_menu(cxt);
- break;
case 'n':
new_partition(cxt);
break;
@@ -1039,7 +1042,6 @@ static void command_prompt(struct fdisk_context *cxt)
break;
default:
unknown_command(c);
- print_fdisk_menu(cxt);
}
}
}