From e6469d974881ed400decd7f7ecb49be9777a6cf2 Mon Sep 17 00:00:00 2001 From: Nicolas Dechesne Date: Fri, 17 Jan 2025 10:29:17 +0100 Subject: [PATCH] qdl: display version information * add --version CLI option * dislay version when running in --debug mode Signed-off-by: Nicolas Dechesne --- qdl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qdl.c b/qdl.c index 69a0098..6c60143 100644 --- a/qdl.c +++ b/qdl.c @@ -103,7 +103,7 @@ static void print_usage(void) { extern const char *__progname; fprintf(stderr, - "%s [--debug] [--allow-missing] [--storage ] [--finalize-provisioning] [--include ] [--serial ] [--out-chunk-size ] [ ...]\n", + "%s [--debug] [--version] [--allow-missing] [--storage ] [--finalize-provisioning] [--include ] [--serial ] [--out-chunk-size ] [ ...]\n", __progname); } @@ -125,6 +125,7 @@ int main(int argc, char **argv) static struct option options[] = { {"debug", no_argument, 0, 'd'}, + {"version", no_argument, 0, 'v'}, {"include", required_argument, 0, 'i'}, {"finalize-provisioning", no_argument, 0, 'l'}, {"out-chunk-size", required_argument, 0, OPT_OUT_CHUNK_SIZE }, @@ -134,11 +135,14 @@ int main(int argc, char **argv) {0, 0, 0, 0} }; - while ((opt = getopt_long(argc, argv, "dfi:S:", options, NULL )) != -1) { + while ((opt = getopt_long(argc, argv, "dvfi:S:", options, NULL )) != -1) { switch (opt) { case 'd': qdl_debug = true; break; + case 'v': + print_version(); + return 0; case 'f': allow_missing = true; break; @@ -172,6 +176,9 @@ int main(int argc, char **argv) ux_init(); + if (qdl_debug) + print_version(); + prog_mbn = argv[optind++]; do {