Commit 15f8220829f9a3e8911c81d1cdf662769987e37f
1 parent
5a84a5dd
Sanitize exit codes of help queries, this time for real.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3034 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
8 additions
and
8 deletions
vl.c
... | ... | @@ -6570,7 +6570,7 @@ int main_loop(void) |
6570 | 6570 | return ret; |
6571 | 6571 | } |
6572 | 6572 | |
6573 | -static void help(const char *optarg) | |
6573 | +static void help(int exitcode) | |
6574 | 6574 | { |
6575 | 6575 | printf("QEMU PC emulator version " QEMU_VERSION ", Copyright (c) 2003-2007 Fabrice Bellard\n" |
6576 | 6576 | "usage: %s [options] [disk_image]\n" |
... | ... | @@ -6712,7 +6712,7 @@ static void help(const char *optarg) |
6712 | 6712 | #endif |
6713 | 6713 | DEFAULT_GDBSTUB_PORT, |
6714 | 6714 | "/tmp/qemu.log"); |
6715 | - exit(strcmp(optarg, "?")); | |
6715 | + exit(exitcode); | |
6716 | 6716 | } |
6717 | 6717 | |
6718 | 6718 | #define HAS_ARG 0x0001 |
... | ... | @@ -7283,12 +7283,12 @@ int main(int argc, char **argv) |
7283 | 7283 | m->name, m->desc, |
7284 | 7284 | m == first_machine ? " (default)" : ""); |
7285 | 7285 | } |
7286 | - exit(1); | |
7286 | + exit(*optarg != '?'); | |
7287 | 7287 | } |
7288 | 7288 | break; |
7289 | 7289 | case QEMU_OPTION_cpu: |
7290 | 7290 | /* hw initialization will check this */ |
7291 | - if (optarg[0] == '?') { | |
7291 | + if (*optarg == '?') { | |
7292 | 7292 | #if defined(TARGET_PPC) |
7293 | 7293 | ppc_cpu_list(stdout, &fprintf); |
7294 | 7294 | #elif defined(TARGET_ARM) |
... | ... | @@ -7298,7 +7298,7 @@ int main(int argc, char **argv) |
7298 | 7298 | #elif defined(TARGET_SPARC) |
7299 | 7299 | sparc_cpu_list(stdout, &fprintf); |
7300 | 7300 | #endif |
7301 | - exit(1); | |
7301 | + exit(0); | |
7302 | 7302 | } else { |
7303 | 7303 | cpu_model = optarg; |
7304 | 7304 | } |
... | ... | @@ -7452,12 +7452,12 @@ int main(int argc, char **argv) |
7452 | 7452 | break; |
7453 | 7453 | #endif |
7454 | 7454 | case QEMU_OPTION_h: |
7455 | - help(optarg); | |
7455 | + help(0); | |
7456 | 7456 | break; |
7457 | 7457 | case QEMU_OPTION_m: |
7458 | 7458 | ram_size = atoi(optarg) * 1024 * 1024; |
7459 | 7459 | if (ram_size <= 0) |
7460 | - help(optarg); | |
7460 | + help(1); | |
7461 | 7461 | if (ram_size > PHYS_RAM_MAX_SIZE) { |
7462 | 7462 | fprintf(stderr, "qemu: at most %d MB RAM can be simulated\n", |
7463 | 7463 | PHYS_RAM_MAX_SIZE / (1024 * 1024)); |
... | ... | @@ -7743,7 +7743,7 @@ int main(int argc, char **argv) |
7743 | 7743 | hd_filename[0] == '\0' && |
7744 | 7744 | (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') && |
7745 | 7745 | fd_filename[0] == '\0') |
7746 | - help(""); | |
7746 | + help(1); | |
7747 | 7747 | |
7748 | 7748 | /* boot to floppy or the default cd if no hard disk defined yet */ |
7749 | 7749 | if (hd_filename[0] == '\0' && boot_device == 'c') { | ... | ... |