X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fpb-discover.c;h=e895f47653945fcef31fc888e2473d632cc21000;hp=713d99d3cee1cdcd1061164a017447df5bc5962e;hb=ae3c354e844698bdb4ed35a6845aa9dca1e9205f;hpb=3fa256bb478f2b3e6316c561169190457b21e616 diff --git a/discover/pb-discover.c b/discover/pb-discover.c index 713d99d..e895f47 100644 --- a/discover/pb-discover.c +++ b/discover/pb-discover.c @@ -29,7 +29,7 @@ static void print_usage(void) print_version(); printf( "Usage: pb-discover [-a, --no-autoboot] [-h, --help] [-l, --log log-file]\n" -" [-n, --dry-run] [-V, --version]\n"); +" [-n, --dry-run] [-v, --verbose] [-V, --version]\n"); } /** @@ -48,6 +48,7 @@ struct opts { const char *log_file; enum opt_value dry_run; enum opt_value show_version; + enum opt_value verbose; }; /** @@ -61,14 +62,16 @@ static int opts_parse(struct opts *opts, int argc, char *argv[]) {"help", no_argument, NULL, 'h'}, {"log", required_argument, NULL, 'l'}, {"dry-run", no_argument, NULL, 'n'}, + {"verbose", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, { NULL, 0, NULL, 0}, }; - static const char short_options[] = "ahl:nV"; + static const char short_options[] = "ahl:nvV"; static const struct opts default_values = { .no_autoboot = opt_no, .log_file = "/var/log/petitboot/pb-discover.log", .dry_run = opt_no, + .verbose = opt_no, }; *opts = default_values; @@ -93,6 +96,9 @@ static int opts_parse(struct opts *opts, int argc, char *argv[]) case 'n': opts->dry_run = opt_yes; break; + case 'v': + opts->verbose = opt_yes; + break; case 'V': opts->show_version = opt_yes; break; @@ -147,6 +153,9 @@ int main(int argc, char *argv[]) } pb_log_init(log); + if (opts.verbose) + pb_log_set_debug(true); + pb_log("--- pb-discover ---\n"); /* we look for closed sockets when we write, so ignore SIGPIPE */