]> git.ozlabs.org Git - petitboot/commitdiff
Print ststus message when booting
authorJeremy Kerr <jk@ozlabs.org>
Tue, 8 Jan 2008 04:54:10 +0000 (15:54 +1100)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 8 Jan 2008 04:54:10 +0000 (15:54 +1100)
Add a couple of calls to pboot_message() to give some feedback when
an option (or gameos) is selected.

Also, convert pboot_message to varargs, to allow more flexible message
formats.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
devices.c
petitboot.c
petitboot.h

index 57c037e23c98121684cb76587f878bca009e6ecf..77860d0546a8dcc967da4a71a2e803f91db6f836 100644 (file)
--- a/devices.c
+++ b/devices.c
@@ -308,6 +308,6 @@ void pboot_exec_option(void *data)
        fflush(stdout);
 
        execv(kexec_opts[0], kexec_opts);
-
-       LOG("kexec failed: %s", strerror(errno));
+       pboot_message("kexec failed: %s", strerror(errno));
+       LOG("execv() failed: %s", strerror(errno));
 }
index 0b6828b55847e79d38a96c20ecf5a16393232844..6f2a386fe90cbc021fc4317b3d618eccb027add7 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,6 +795,7 @@ 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();
                }
@@ -920,11 +925,19 @@ 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,
index a77bfef7c864e2035e18f55824ce785ef94c7dd5..893be04605e9614ed846c5828cbc28f767c2e053 100644 (file)
@@ -1,5 +1,6 @@
 
 #include <libtwin/twin.h>
+#include <stdarg.h>
 
 #define LOG(fmt...)    printf(fmt)
 
@@ -14,4 +15,4 @@ int pboot_remove_device(const char *dev_id);
 
 int pboot_start_device_discovery(int udev_trigger);
 void pboot_exec_option(void *data);
-void pboot_message(const char *message);
+void pboot_message(const char *fmt, ...);