]> git.ozlabs.org Git - petitboot/blobdiff - petitboot.c
tests: add tests for assorted ydl and ubuntu configs
[petitboot] / petitboot.c
index 0b6828b55847e79d38a96c20ecf5a16393232844..ee6893032e6d033be6ddd9d6e8cac16c68a2695c 100644 (file)
@@ -1,3 +1,6 @@
+
+#define _GNU_SOURCE
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -457,6 +460,7 @@ static void pboot_choose_option(void)
        pboot_option_t *opt = &dev->options[pboot_rpane->focus_curindex];
 
        LOG("Selected device %s\n", opt->title);
+       pboot_message("booting %s...", opt->title);
 
        /* Give user feedback, make sure errors and panics will be seen */
        pboot_exec_option(opt->data);
@@ -791,8 +795,8 @@ twin_bool_t pboot_event_filter(twin_screen_t            *screen,
                /* Another gross hack for booting back to gameos */
                case KEY_BACKSPACE:
                case KEY_DELETE:
+                       pboot_message("booting to GameOS...");
                        system(BOOT_GAMEOS_BIN);
-                       pboot_quit();
                }
        case TwinEventKeyUp:
                twin_screen_set_cursor(pboot_screen, NULL, 0, 0);
@@ -920,16 +924,24 @@ static void pboot_spane_draw(twin_window_t *window)
        twin_path_destroy(path);
 }
 
-void pboot_message(const char *message)
+void pboot_message(const char *fmt, ...)
 {
+       va_list ap;
+       char *msg;
+
        if (pboot_spane->text)
                free(pboot_spane->text);
-       pboot_spane->text = strdup(message);
+
+       va_start(ap, fmt);
+       vasprintf(&msg, fmt, ap);
+       va_end(ap);
+
+       pboot_spane->text = msg;
        twin_window_damage(pboot_spane->window,
                           0, 0,
                           pboot_spane->window->pixmap->width,
                           pboot_spane->window->pixmap->height);
-       twin_window_queue_paint(pboot_spane->window);
+       twin_window_draw(pboot_spane->window);
 }
 
 static void pboot_create_spane(void)