From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQn67-0000ey-Bj for qemu-devel@nongnu.org; Thu, 20 Mar 2014 20:14:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQn61-0007Xx-Bs for qemu-devel@nongnu.org; Thu, 20 Mar 2014 20:14:07 -0400 Received: from mail-yh0-f41.google.com ([209.85.213.41]:57914) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQn61-0007Xm-7T for qemu-devel@nongnu.org; Thu, 20 Mar 2014 20:14:01 -0400 Received: by mail-yh0-f41.google.com with SMTP id v1so1706578yhn.14 for ; Thu, 20 Mar 2014 17:14:01 -0700 (PDT) From: Leandro Dorileo Date: Thu, 20 Mar 2014 21:13:12 -0300 Message-Id: <1395360813-2833-6-git-send-email-l@dorileo.org> In-Reply-To: <1395360813-2833-1-git-send-email-l@dorileo.org> References: <1395360813-2833-1-git-send-email-l@dorileo.org> Subject: [Qemu-devel] [PATCH 05/26] QemuOpt: add qemu_opt_print_help() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi , Liu Yuan , Jeff Cody , Markus Armbruster , Peter Lieven , "Richard W.M. Jones" , Luiz Capitulino , Leandro Dorileo , Ronnie Sahlberg , Josh Durgin , Anthony Liguori , Paolo Bonzini , Stefan Weil , Max Reitz , MORITA Kazutaka , Benoit Canet 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 --- 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