summary refs log tree commit diff stats
path: root/linux-user/main.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2011-01-20 03:28:02 +0000
committerRiku Voipio <riku.voipio@nokia.com>2011-02-09 10:33:53 +0200
commit6672b0b22a8ab92ad3a07889c2220a7568a3da30 (patch)
tree6ccc40ad3602a1bf9d9369f8df24d16df41603fe /linux-user/main.c
parentc0c1dc992584b8ccbae0e8f8b09124b76662633b (diff)
downloadfocaccia-qemu-6672b0b22a8ab92ad3a07889c2220a7568a3da30.tar.gz
focaccia-qemu-6672b0b22a8ab92ad3a07889c2220a7568a3da30.zip
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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
Diffstat (limited to 'linux-user/main.c')
-rw-r--r--linux-user/main.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 0d627d68dd..e651bfdad8 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -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();
         }
     }