Skip to content

Commit 6672b0b

Browse files
pm215Riku Voipio
authored andcommitted
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 <[email protected]> Signed-off-by: Riku Voipio <[email protected]>
1 parent c0c1dc9 commit 6672b0b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

linux-user/main.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,14 +2624,21 @@ void cpu_loop (CPUState *env)
26242624
}
26252625
#endif /* TARGET_ALPHA */
26262626

2627+
static void version(void)
2628+
{
2629+
printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION
2630+
", Copyright (c) 2003-2008 Fabrice Bellard\n");
2631+
}
2632+
26272633
static void usage(void)
26282634
{
2629-
printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n"
2630-
"usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n"
2635+
version();
2636+
printf("usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n"
26312637
"Linux CPU emulator (compiled for %s emulation)\n"
26322638
"\n"
26332639
"Standard options:\n"
26342640
"-h print this help\n"
2641+
"-version display version information and exit\n"
26352642
"-g port wait gdb connection to port\n"
26362643
"-L path set the elf interpreter prefix (default=%s)\n"
26372644
"-s size set the stack size in bytes (default=%ld)\n"
@@ -2886,8 +2893,10 @@ int main(int argc, char **argv, char **envp)
28862893
singlestep = 1;
28872894
} else if (!strcmp(r, "strace")) {
28882895
do_strace = 1;
2889-
} else
2890-
{
2896+
} else if (!strcmp(r, "version")) {
2897+
version();
2898+
exit(0);
2899+
} else {
28912900
usage();
28922901
}
28932902
}

0 commit comments

Comments
 (0)