summaryrefslogtreecommitdiffstats
path: root/fdisk
diff options
context:
space:
mode:
authorFrancesco Cosoleto2011-02-28 12:16:40 +0100
committerKarel Zak2011-03-11 12:28:49 +0100
commitf3697ae954cc7755246bb1837d0b7c81c8f4db23 (patch)
treeef2647f2380b392e5e5dfae92d3b23fa44fc173a /fdisk
parentcfdisk: use keypad() in menu selection function (diff)
downloadkernel-qcow2-util-linux-f3697ae954cc7755246bb1837d0b7c81c8f4db23.tar.gz
kernel-qcow2-util-linux-f3697ae954cc7755246bb1837d0b7c81c8f4db23.tar.xz
kernel-qcow2-util-linux-f3697ae954cc7755246bb1837d0b7c81c8f4db23.zip
cfdisk: move "No more partition" warning to draw_cursor()
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Diffstat (limited to 'fdisk')
-rw-r--r--fdisk/cfdisk.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c
index 71ce9f662..f03064e54 100644
--- a/fdisk/cfdisk.c
+++ b/fdisk/cfdisk.c
@@ -2536,10 +2536,12 @@ draw_screen(void) {
free(line);
}
-static int
+static void
draw_cursor(int move) {
- if (move != 0 && (cur_part + move < 0 || cur_part + move >= num_parts))
- return -1;
+ if (move != 0 && (cur_part + move < 0 || cur_part + move >= num_parts)) {
+ print_warning(_("No more partitions"));
+ return;
+ }
if (arrow_cursor)
mvaddstr(DISK_TABLE_START + cur_part + 2
@@ -2561,8 +2563,6 @@ draw_cursor(int move) {
draw_partition(cur_part);
standend();
}
-
- return 0;
}
static void
@@ -2607,7 +2607,7 @@ do_curses_fdisk(void) {
while (!done) {
char *s;
- (void)draw_cursor(0);
+ draw_cursor(0);
if (p_info[cur_part].id == FREE_SPACE) {
s = ((opentype == O_RDWR) ? "hnpquW" : "hnpqu");
@@ -2712,16 +2712,10 @@ do_curses_fdisk(void) {
draw_screen();
break;
case MENU_UP : /* Up arrow */
- if (!draw_cursor(-1))
- command = 0;
- else
- print_warning(_("No more partitions"));
+ draw_cursor(-1);
break;
case MENU_DOWN : /* Down arrow */
- if (!draw_cursor(1))
- command = 0;
- else
- print_warning(_("No more partitions"));
+ draw_cursor(1);
break;
case REDRAWKEY:
clear();