Skip to contentSkip to conversation

linux-user: Add support for -version option

PATCH In review Peter Maydell 1 participant 2 messages Jan 20, 2011 – Feb 7, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Add support for -version option

Add support to the linux-user qemu for the -version command line option, bringing it into line with the system emulation qemu.

---
 linux-user/main.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
linux-user/main.c +13 -4
index 0d627d6..e651bfd 100644
@@ -2624,14 +2624,21 @@ void cpu_loop (CPUState *env)
 }
 #endif /* TARGET_ALPHA */
 
+static void version(void)
+{
+    printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION
+           ", Copyright (c) 2003-2008 Fabrice Bellard\n");
+}
+
 static void usage(void)
 {
-    printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n"
-           "usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n"
+    version();
+    printf("usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n"
            "Linux CPU emulator (compiled for %s emulation)\n"
            "\n"
            "Standard options:\n"
            "-h                print this help\n"
+           "-version          display version information and exit\n"
            "-g port           wait gdb connection to port\n"
            "-L path           set the elf interpreter prefix (default=%s)\n"
            "-s size           set the stack size in bytes (default=%ld)\n"
@@ -2886,8 +2893,10 @@ int main(int argc, char **argv, char **envp)
             singlestep = 1;
         } else if (!strcmp(r, "strace")) {
             do_strace = 1;
-        } else
-        {
+        } else if (!strcmp(r, "version")) {
+            version();
+            exit(0);
+        } else {
             usage();
         }
     }
Signature · 1 line
1.6.3.3
#1 lore raw

Ping?

Quoted 54 lines · Peter Maydell

Add support to the linux-user qemu for the -version command line option, bringing it into line with the system emulation qemu.

---
 linux-user/main.c |   17 +++++++++++++----

 1 files changed, 13 insertions(+), 4 deletions(-)
linux-user/main.c +8 -2
index 0d627d6..e651bfd 100644
@@ -2624,14 +2624,21 @@ void cpu_loop (CPUState *env)
  }
  #endif /* TARGET_ALPHA */
 
+static void version(void)
+{
+    printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION
+           ", Copyright (c) 2003-2008 Fabrice Bellard\n");
+}
+
  static void usage(void)
  {
-    printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n"
-           "usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n"
+    version();
+    printf("usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n"

           "Linux CPU emulator (compiled for %s emulation)\n" "\n"
           "Standard options:\n"
           "-h                print this help\n"
+           "-version          display version information and exit\n" "-g port           wait gdb connection to port\n"
           "-L path           set the elf interpreter prefix (default=%s)\n" "-s size           set the stack size in bytes (default=%ld)\n"

linux-user/main.c +4 -3
@@ -2886,8 +2893,10 @@ int main(int argc, char **argv, char **envp)
             singlestep = 1;
         } else if (!strcmp(r, "strace")) {
             do_strace = 1;
-        } else
-        {
+        } else if (!strcmp(r, "version")) {
+            version();
+            exit(0);
+        } else {
             usage();
         }
     }
--

1.6.3.3