qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 05/26] QemuOpt: add qemu_opt_print_help()


From: Leandro Dorileo
Subject: [Qemu-devel] [PATCH 05/26] QemuOpt: add qemu_opt_print_help()
Date: Thu, 20 Mar 2014 21:13:12 -0300

Analogous to print_option_help(QEMUOptionParameter *list) this function
displays the available key and help for each described QemuOptDesc in
QemuOptList.

Signed-off-by: Leandro Dorileo <address@hidden>
---
 include/qemu/option.h |  1 +
 util/qemu-option.c    | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/qemu/option.h b/include/qemu/option.h
index 3f4976d..62eacf3 100644
--- a/include/qemu/option.h
+++ b/include/qemu/option.h
@@ -177,6 +177,7 @@ void qemu_opts_absorb_qdict(QemuOpts *opts, QDict *qdict, 
Error **errp);
 
 typedef int (*qemu_opts_loopfunc)(QemuOpts *opts, void *opaque);
 void qemu_opts_print(QemuOpts *opts);
+void qemu_opts_print_help(QemuOpts *opts);
 int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void 
*opaque,
                       int abort_on_failure);
 
diff --git a/util/qemu-option.c b/util/qemu-option.c
index 026d2ff..6fac370 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -1022,6 +1022,18 @@ void qemu_opts_print(QemuOpts *opts)
     }
 }
 
+void qemu_opts_print_help(QemuOpts *opts)
+{
+    QemuOptDesc *desc = opts->list->desc;
+
+    printf("Supported options:\n");
+
+    for (; desc && desc->name; desc++) {
+        printf("%-16s %s\n", desc->name, desc->help ?
+               desc->help : "No description available");
+    }
+}
+
 static int opts_do_parse(QemuOpts *opts, const char *params,
                          const char *firstname, bool prepend)
 {
-- 
1.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]