]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
cfdisk: move "No more partition" warning to draw_cursor()
authorFrancesco Cosoleto <cosoleto@gmail.com>
Mon, 28 Feb 2011 11:16:40 +0000 (12:16 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 11 Mar 2011 11:28:49 +0000 (12:28 +0100)
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
fdisk/cfdisk.c

index 71ce9f6625dfc4eed5d0dc7871b1c095ba7378c7..f03064e54b1cbdb786000b577ae189492cce993e 100644 (file)
@@ -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();