]> git.ozlabs.org Git - petitboot/blobdiff - ui/twin/main-generic.c
ncurses/nc-cui: musl libc fixes
[petitboot] / ui / twin / main-generic.c
index 8ed46b72c41d113a120de88847e770321606cc95..8ddec9ef2cd790044754196508114d08bf919e4b 100644 (file)
@@ -21,7 +21,6 @@
 #include "config.h"
 #endif
 
-#define _GNU_SOURCE
 #include <assert.h>
 #include <errno.h>
 #include <getopt.h>
@@ -58,7 +57,7 @@ static int edit_preferences_cb(struct pbt_item *item)
 
        (void)client;
 
-       pb_log("%s: TODO\n", __func__);
+       pb_debug("%s: TODO\n", __func__);
 
        return 0;
 }
@@ -199,25 +198,12 @@ fail_menu:
        return NULL;
 }
 
-static int kexec_cb(struct pbt_client *client, struct pb_opt_data *opt_data)
-{
-       int result;
-
-       assert(opt_data);
-
-       pb_log("%s: %s\n", __func__, opt_data->name);
-
-       result = pb_run_kexec(opt_data->kd, client->dry_run);
-
-       return result;
-}
-
 static int run(struct pbt_client *client)
 {
        while (1) {
                int result = waiter_poll(client->waitset);
 
-               if (result < 0 && errno != EINTR) {
+               if (result < 0) {
                        pb_log("%s: poll: %s\n", __func__, strerror(errno));
                        break;
                }
@@ -225,8 +211,6 @@ static int run(struct pbt_client *client)
                if (client->signal_data.abort)
                        break;
 
-               ui_timer_process_sig(&client->signal_data.timer);
-
                while (client->signal_data.resize) {
                        client->signal_data.resize = 0;
                        pbt_client_resize(client);
@@ -258,9 +242,6 @@ static void sig_handler(int signum)
                return;
 
        switch (signum) {
-       case SIGALRM:
-               ui_timer_sigalrm(&sd->timer);
-               break;
        case SIGWINCH:
                sd->resize = 1;
                break;
@@ -286,6 +267,7 @@ int main(int argc, char *argv[])
        int result;
        int ui_result;
        struct pbt_client *client;
+       FILE *log;
 
        result = pbt_opts_parse(&opts, argc, argv);
 
@@ -304,17 +286,13 @@ int main(int argc, char *argv[])
                return EXIT_SUCCESS;
        }
 
+       log = stderr;
        if (strcmp(opts.log_file, "-")) {
                FILE *log = fopen(opts.log_file, "a");
-
-               assert(log);
-               pb_log_set_stream(log);
-       } else
-               pb_log_set_stream(stderr);
-
-#if defined(DEBUG)
-       pb_log_always_flush(1);
-#endif
+               if (!log)
+                       log = stderr;
+       }
+       pb_log_init(log);
 
        pb_log("--- petitboot-twin ---\n");
 
@@ -330,8 +308,7 @@ int main(int argc, char *argv[])
                return EXIT_FAILURE;
        }
 
-       client = pbt_client_init(opts.backend, 1024, 640, kexec_cb,
-               opts.start_daemon, opts.dry_run);
+       client = pbt_client_init(opts.backend, 1024, 640, opts.start_daemon);
 
        if (!client) {
                ui_result = EXIT_FAILURE;