qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: qemu-devel@nongnu.org
Cc: Michael Ellerman <michael@ellerman.id.au>
Subject: [Qemu-devel] [PATCH 3/3] In qemu -h output, only print options for the arch we are running as
Date: Mon, 12 Dec 2011 19:21:44 +1100	[thread overview]
Message-ID: <1323678104-30133-3-git-send-email-michael@ellerman.id.au> (raw)
In-Reply-To: <1323678104-30133-1-git-send-email-michael@ellerman.id.au>

Only print options in the help output that are accepted by our arch.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 vl.c |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/vl.c b/vl.c
index b492f8c..ba8e76d 100644
--- a/vl.c
+++ b/vl.c
@@ -1492,28 +1492,31 @@ static void version(void)
 
 static void help(int exitcode)
 {
-    const char *options_help =
-#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask)     \
-        opt_help
-#define DEFHEADING(text, arch_mask) stringify(text) "\n"
+    version();
+    printf("usage: qemu [options] [disk_image]\n"
+           "\n"
+           "'disk_image' is a raw hard disk image for IDE hard disk 0\n\n");
+
+#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask)    \
+    if ((arch_mask) & arch_type)                               \
+        fputs(opt_help, stdout);
+
+#define DEFHEADING(text, arch_mask) \
+    if ((arch_mask) & arch_type)    \
+        puts(stringify(text));
+
 #include "qemu-options.def"
 #undef DEF
 #undef DEFHEADING
 #undef GEN_DOCS
-        ;
-    version();
-    printf("usage: qemu [options] [disk_image]\n"
-           "\n"
-           "'disk_image' is a raw hard disk image for IDE hard disk 0\n"
-           "\n"
-           "%s\n"
-           "During emulation, the following keys are useful:\n"
+
+    printf("\nDuring emulation, the following keys are useful:\n"
            "ctrl-alt-f      toggle full screen\n"
            "ctrl-alt-n      switch to virtual console 'n'\n"
            "ctrl-alt        toggle mouse and keyboard grab\n"
            "\n"
-           "When using -nographic, press 'ctrl-a h' to get some help.\n",
-           options_help);
+           "When using -nographic, press 'ctrl-a h' to get some help.\n");
+
     exit(exitcode);
 }
 
-- 
1.7.7.3

      parent reply	other threads:[~2011-12-12  8:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12  8:14 [Qemu-devel] RFC: Only display help options that are accepted by the architecture Michael Ellerman
2011-12-12  8:21 ` [Qemu-devel] [PATCH 1/3] Add arch mask to headings but don't use it yet Michael Ellerman
2011-12-12  8:21   ` [Qemu-devel] [PATCH 2/3] vl.c: Fold constant string into printf rather than using %s Michael Ellerman
2011-12-12  9:40     ` Andreas Färber
2011-12-12  8:21   ` Michael Ellerman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1323678104-30133-3-git-send-email-michael@ellerman.id.au \
    --to=michael@ellerman.id.au \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).