From dbf139003bd6c8c6ca03ae7f533aa74afd8060c6 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Thu, 7 Mar 2013 10:22:42 +0800 Subject: Move --dry-run option to discover server Now that the server does the booting, we should move the --dry-run argument to the server. Signed-off-by: Jeremy Kerr --- ui/ncurses/generic-main.c | 12 +++--------- ui/ncurses/nc-cui.c | 3 +-- ui/ncurses/nc-cui.h | 3 +-- ui/twin/main-generic.c | 3 +-- ui/twin/pbt-client.c | 4 +--- ui/twin/pbt-client.h | 4 +--- ui/twin/pbt-main.c | 6 +----- ui/twin/pbt-main.h | 1 - 8 files changed, 9 insertions(+), 27 deletions(-) (limited to 'ui') diff --git a/ui/ncurses/generic-main.c b/ui/ncurses/generic-main.c index ddf0de3..5d8debb 100644 --- a/ui/ncurses/generic-main.c +++ b/ui/ncurses/generic-main.c @@ -45,7 +45,7 @@ static void print_usage(void) { print_version(); printf( -"Usage: petitboot-nc [-d, --dry-run] [-h, --help] [-l, --log log-file]\n" +"Usage: petitboot-nc [-h, --help] [-l, --log log-file]\n" " [-s, --start-daemon] [-V, --version]\n"); } @@ -60,7 +60,6 @@ enum opt_value {opt_undef = 0, opt_yes, opt_no}; */ struct opts { - enum opt_value dry_run; enum opt_value show_help; const char *log_file; enum opt_value start_daemon; @@ -74,7 +73,6 @@ struct opts { static int opts_parse(struct opts *opts, int argc, char *argv[]) { static const struct option long_options[] = { - {"dry-run", no_argument, NULL, 'd'}, {"help", no_argument, NULL, 'h'}, {"log", required_argument, NULL, 'l'}, {"start-daemon", no_argument, NULL, 's'}, @@ -96,9 +94,6 @@ static int opts_parse(struct opts *opts, int argc, char *argv[]) break; switch (c) { - case 'd': - opts->dry_run = opt_yes; - break; case 'h': opts->show_help = opt_yes; break; @@ -151,8 +146,7 @@ static struct pmenu *pb_mm_init(struct pb_cui *pb_cui) m->on_open = cui_on_open; m->scr.frame.title = talloc_asprintf(m, - "Petitboot (" PACKAGE_VERSION ")%s", - (pb_cui->cui->dry_run ? " (dry-run)" : "")); + "Petitboot (" PACKAGE_VERSION ")"); m->scr.frame.help = talloc_strdup(m, "ESC=exit, Enter=accept, e=edit, o=open"); m->scr.frame.status = talloc_strdup(m, "Welcome to Petitboot"); @@ -260,7 +254,7 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } - pb.cui = cui_init(&pb, NULL, opts.start_daemon, opts.dry_run); + pb.cui = cui_init(&pb, NULL, opts.start_daemon); if (!pb.cui) return EXIT_FAILURE; diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c index fafa293..37ba1c4 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -520,7 +520,7 @@ static struct discover_client_ops cui_client_ops = { */ struct cui *cui_init(void* platform_info, - int (*js_map)(const struct js_event *e), int start_deamon, int dry_run) + int (*js_map)(const struct js_event *e), int start_deamon) { struct cui *cui; unsigned int i; @@ -536,7 +536,6 @@ struct cui *cui_init(void* platform_info, cui->c_sig = pb_cui_sig; cui->platform_info = platform_info; cui->timer.handle_timeout = cui_handle_timeout; - cui->dry_run = dry_run; cui->waitset = waitset_create(cui); /* Loop here for scripts that just started the server. */ diff --git a/ui/ncurses/nc-cui.h b/ui/ncurses/nc-cui.h index 33f2661..69c15d4 100644 --- a/ui/ncurses/nc-cui.h +++ b/ui/ncurses/nc-cui.h @@ -51,7 +51,6 @@ struct cui { enum pb_nc_sig c_sig; sig_atomic_t abort; sig_atomic_t resize; - int dry_run; struct nc_scr *current; struct pmenu *main; struct ui_timer timer; @@ -64,7 +63,7 @@ struct cui { }; struct cui *cui_init(void* platform_info, - int (*js_map)(const struct js_event *e), int start_deamon, int dry_run); + int (*js_map)(const struct js_event *e), int start_deamon); struct nc_scr *cui_set_current(struct cui *cui, struct nc_scr *scr); int cui_run(struct cui *cui, struct pmenu *main, unsigned int default_item); int cui_boot_editor_run(struct pmenu_item *item); diff --git a/ui/twin/main-generic.c b/ui/twin/main-generic.c index cc5140e..c9cb492 100644 --- a/ui/twin/main-generic.c +++ b/ui/twin/main-generic.c @@ -317,8 +317,7 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } - client = pbt_client_init(opts.backend, 1024, 640, - opts.start_daemon, opts.dry_run); + client = pbt_client_init(opts.backend, 1024, 640, opts.start_daemon); if (!client) { ui_result = EXIT_FAILURE; diff --git a/ui/twin/pbt-client.c b/ui/twin/pbt-client.c index c664740..875b408 100644 --- a/ui/twin/pbt-client.c +++ b/ui/twin/pbt-client.c @@ -261,8 +261,7 @@ static void pbt_client_destructor(struct pbt_client *client) } struct pbt_client *pbt_client_init(enum pbt_twin_backend backend, - unsigned int width, unsigned int height, - int start_deamon, int dry_run) + unsigned int width, unsigned int height, int start_deamon) { struct pbt_client *pbt_client; unsigned int i; @@ -280,7 +279,6 @@ struct pbt_client *pbt_client_init(enum pbt_twin_backend backend, pbt_client->waitset = waitset_create(pbt_client); pbt_client->sig = "pbt_client"; - pbt_client->dry_run = dry_run; pbt_client->frame.scr = pbt_scr_init(pbt_client, pbt_client->waitset, backend, width, height, NULL, NULL); diff --git a/ui/twin/pbt-client.h b/ui/twin/pbt-client.h index 2c96d48..7b9671f 100644 --- a/ui/twin/pbt-client.h +++ b/ui/twin/pbt-client.h @@ -42,7 +42,6 @@ void pbt_frame_status_printf(struct pbt_frame *frame, const char *format, ...); struct pbt_client { const char *sig; - int dry_run; struct pb_signal_data signal_data; void *client_data; struct pbt_frame frame; @@ -51,8 +50,7 @@ struct pbt_client { }; struct pbt_client *pbt_client_init(enum pbt_twin_backend backend, - unsigned int width, unsigned int height, - int start_deamon, int dry_run); + unsigned int width, unsigned int height, int start_deamon); void pbt_client_destroy(struct pbt_client *client); void pbt_client_resize(struct pbt_client *client); diff --git a/ui/twin/pbt-main.c b/ui/twin/pbt-main.c index 84e824e..542f949 100644 --- a/ui/twin/pbt-main.c +++ b/ui/twin/pbt-main.c @@ -34,7 +34,7 @@ void pbt_print_usage(void) { pbt_print_version(); printf( -"Usage: petitboot-twin [-d, --dry-run] [-h, --help] [-l, --log log-file]\n" +"Usage: petitboot-twin [-h, --help] [-l, --log log-file]\n" " [-r, --reset-defaults] [-s, --start-daemon]\n" " [-t, --timeout] [-V, --version]\n" " [[-f --fbdev] | [-x --x11]]\n"); @@ -47,7 +47,6 @@ void pbt_print_usage(void) int pbt_opts_parse(struct pbt_opts *opts, int argc, char *argv[]) { static const struct option long_options[] = { - {"dry-run", no_argument, NULL, 'd'}, {"fbdev", no_argument, NULL, 'f'}, {"help", no_argument, NULL, 'h'}, {"log", required_argument, NULL, 'l'}, @@ -74,9 +73,6 @@ int pbt_opts_parse(struct pbt_opts *opts, int argc, char *argv[]) break; switch (c) { - case 'd': - opts->dry_run = pbt_opt_yes; - break; case 'f': opts->backend = pbt_twin_fbdev; break; diff --git a/ui/twin/pbt-main.h b/ui/twin/pbt-main.h index e5af71a..b6821cf 100644 --- a/ui/twin/pbt-main.h +++ b/ui/twin/pbt-main.h @@ -32,7 +32,6 @@ enum pbt_opt_value {pbt_opt_undef = 0, pbt_opt_yes, pbt_opt_no}; struct pbt_opts { enum pbt_twin_backend backend; - enum pbt_opt_value dry_run; enum pbt_opt_value show_help; const char *log_file; enum pbt_opt_value reset_defaults; -- cgit v1.2.1