]> git.ozlabs.org Git - petitboot/blobdiff - ui/ncurses/generic-main.c
discover: Maintain a backlog of status updates
[petitboot] / ui / ncurses / generic-main.c
index 669053c52aeb4f31f56a05897e26973245fce46c..70627966a78653da5a77e0ba35147740798530ed 100644 (file)
@@ -49,8 +49,8 @@ static void print_usage(void)
 {
        print_version();
        printf(
-"%s: petitboot-nc [-h, --help] [-l, --log log-file]\n"
-"                    [-s, --start-daemon] [-v, --verbose] [-V, --version]\n",
+"%s: petitboot-nc [-h, --help] [-l, --log log-file] [-s, --start-daemon]\n"
+"                    [-t, --timeout] [-v, --verbose] [-V, --version]\n",
                        _("Usage"));
 }
 
@@ -68,6 +68,7 @@ struct opts {
        enum opt_value show_help;
        const char *log_file;
        enum opt_value start_daemon;
+       enum opt_value timeout;
        enum opt_value verbose;
        enum opt_value show_version;
 };
@@ -82,11 +83,12 @@ static int opts_parse(struct opts *opts, int argc, char *argv[])
                {"help",         no_argument,       NULL, 'h'},
                {"log",          required_argument, NULL, 'l'},
                {"start-daemon", no_argument,       NULL, 's'},
+               {"timeout",      no_argument,       NULL, 't'},
                {"verbose",      no_argument,       NULL, 'v'},
                {"version",      no_argument,       NULL, 'V'},
                { NULL,          0,                 NULL, 0},
        };
-       static const char short_options[] = "dhl:svV";
+       static const char short_options[] = "dhl:stvV";
        static const struct opts default_values = { 0 };
 
        *opts = default_values;
@@ -108,6 +110,9 @@ static int opts_parse(struct opts *opts, int argc, char *argv[])
                case 's':
                        opts->start_daemon = opt_yes;
                        break;
+               case 't':
+                       opts->timeout = opt_yes;
+                       break;
                case 'v':
                        opts->verbose = opt_yes;
                        break;
@@ -149,7 +154,7 @@ static char *default_log_filename(void)
        return name;
 }
 
-struct cui *cui;
+static struct cui *cui;
 
 /*
  * struct pb_cui - Main cui program instance.
@@ -244,7 +249,7 @@ int main(int argc, char *argv[])
                return EXIT_FAILURE;
        }
 
-       cui = cui_init(NULL, NULL, opts.start_daemon);
+       cui = cui_init(NULL, NULL, opts.start_daemon, opts.timeout);
        if (!cui)
                return EXIT_FAILURE;