mirror of https://github.com/proxmox/mirror_qemu
linux-user: Fix broken "-version" option
Fix the "-version" option, which was accidentally broken in commit fc9c541: * exit after printing version information rather than proceeding blithely onward (and likely printing the full usage message) * correct the cut-n-paste error in the usage message for it * don't insist on the presence of a following argument for options which don't take an argument (this was preventing 'qemu-arm -version' from working) * remove a spurious argc check from the beginning of main() which meant 'QEMU_VERSION=1 qemu-arm' didn't work. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>master
parent
c2e2343e1f
commit
1386d4c0f5
|
@ -3084,6 +3084,7 @@ static void handle_arg_version(const char *arg)
|
||||||
{
|
{
|
||||||
printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION
|
printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION
|
||||||
", Copyright (c) 2003-2008 Fabrice Bellard\n");
|
", Copyright (c) 2003-2008 Fabrice Bellard\n");
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct qemu_argument {
|
struct qemu_argument {
|
||||||
|
@ -3129,7 +3130,7 @@ struct qemu_argument arg_table[] = {
|
||||||
{"strace", "QEMU_STRACE", false, handle_arg_strace,
|
{"strace", "QEMU_STRACE", false, handle_arg_strace,
|
||||||
"", "log system calls"},
|
"", "log system calls"},
|
||||||
{"version", "QEMU_VERSION", false, handle_arg_version,
|
{"version", "QEMU_VERSION", false, handle_arg_version,
|
||||||
"", "log system calls"},
|
"", "display version information and exit"},
|
||||||
{NULL, NULL, false, NULL, NULL, NULL}
|
{NULL, NULL, false, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3231,16 +3232,15 @@ static int parse_args(int argc, char **argv)
|
||||||
|
|
||||||
for (arginfo = arg_table; arginfo->handle_opt != NULL; arginfo++) {
|
for (arginfo = arg_table; arginfo->handle_opt != NULL; arginfo++) {
|
||||||
if (!strcmp(r, arginfo->argv)) {
|
if (!strcmp(r, arginfo->argv)) {
|
||||||
if (optind >= argc) {
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
|
|
||||||
arginfo->handle_opt(argv[optind]);
|
|
||||||
|
|
||||||
if (arginfo->has_arg) {
|
if (arginfo->has_arg) {
|
||||||
|
if (optind >= argc) {
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
arginfo->handle_opt(argv[optind]);
|
||||||
optind++;
|
optind++;
|
||||||
|
} else {
|
||||||
|
arginfo->handle_opt(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3276,9 +3276,6 @@ int main(int argc, char **argv, char **envp)
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (argc <= 1)
|
|
||||||
usage();
|
|
||||||
|
|
||||||
qemu_cache_utils_init(envp);
|
qemu_cache_utils_init(envp);
|
||||||
|
|
||||||
if ((envlist = envlist_create()) == NULL) {
|
if ((envlist = envlist_create()) == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue