diff options
author | Markus Armbruster <armbru@redhat.com> | 2010-02-18 20:13:51 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2010-03-16 16:58:32 +0100 |
commit | 0f0bc3f1d526924ef4a75ad25dd0ec3771a66496 (patch) | |
tree | 130684a948ba840c06ea12c31e0dfbd24b2e3027 /vl.c | |
parent | ef82516d8fb41cbae9703d07516641f6bdf91a77 (diff) |
error: Track locations on command line
New LOC_CMDLINE. Use it for tracking option with argument in
lookup_opt(). We now report errors like this
qemu: -device smbus-eeprom: Did not find I2C bus for smbus-eeprom
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -4796,6 +4796,7 @@ static const QEMUOption *lookup_opt(int argc, char **argv, char *r = argv[optind]; const char *optarg; + loc_set_cmdline(argv, optind, 1); optind++; /* Treat --foo the same as -foo. */ if (r[1] == '-') @@ -4803,8 +4804,7 @@ static const QEMUOption *lookup_opt(int argc, char **argv, popt = qemu_options; for(;;) { if (!popt->name) { - fprintf(stderr, "%s: invalid option -- '%s'\n", - argv[0], r); + error_report("invalid option"); exit(1); } if (!strcmp(popt->name, r + 1)) @@ -4813,11 +4813,11 @@ static const QEMUOption *lookup_opt(int argc, char **argv, } if (popt->flags & HAS_ARG) { if (optind >= argc) { - fprintf(stderr, "%s: option '%s' requires an argument\n", - argv[0], r); + error_report("requires an argument"); exit(1); } optarg = argv[optind++]; + loc_set_cmdline(argv, optind - 2, 2); } else { optarg = NULL; } @@ -5662,6 +5662,7 @@ int main(int argc, char **argv, char **envp) } } } + loc_set_none(); /* If no data_dir is specified then try to find it relative to the executable path. */ |