]> git.ozlabs.org Git - petitboot/blobdiff - ui/ncurses/nc-cui.c
ui/ncurses: move getch() out of process_key callbacks
[petitboot] / ui / ncurses / nc-cui.c
index 342b60342ad5adc5b39f540ce89f79e096782240..3f8995eba809c92b46417e2c70be529dbab2fdc5 100644 (file)
@@ -109,6 +109,11 @@ static int cui_boot(struct pmenu_item *item)
        assert(cui->current == &cui->main->scr);
 
        pb_log("%s: %s\n", __func__, cod->name);
+       if (!cod->opt) {
+               pb_log("%s: missing opt?\n", __func__);
+               return -1;
+       }
+
        nc_scr_status_printf(cui->current, "Booting %s...", cod->name);
 
        def_prog_mode();
@@ -205,7 +210,14 @@ static int cui_process_key(void *arg)
        assert(cui->current);
 
        ui_timer_disable(&cui->timer);
-       cui->current->process_key(cui->current);
+       for (;;) {
+               int c = getch();
+
+               if (c == ERR)
+                       break;
+
+               cui->current->process_key(cui->current, c);
+       }
 
        return 0;
 }