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 /qemu-error.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 'qemu-error.c')
-rw-r--r-- | qemu-error.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/qemu-error.c b/qemu-error.c index 23176e16a8..5be6bea4c9 100644 --- a/qemu-error.c +++ b/qemu-error.c @@ -114,6 +114,16 @@ void loc_set_none(void) } /* + * Change the current location to argument ARGV[IDX..IDX+CNT-1]. + */ +void loc_set_cmdline(char **argv, int idx, int cnt) +{ + cur_loc->kind = LOC_CMDLINE; + cur_loc->num = cnt; + cur_loc->ptr = argv + idx; +} + +/* * Change the current location to file FNAME, line LNO. */ void loc_set_file(const char *fname, int lno) @@ -143,12 +153,22 @@ void error_set_progname(const char *argv0) void error_print_loc(void) { const char *sep = ""; + int i; + const char *const *argp; if (!cur_mon) { fprintf(stderr, "%s:", progname); sep = " "; } switch (cur_loc->kind) { + case LOC_CMDLINE: + argp = cur_loc->ptr; + for (i = 0; i < cur_loc->num; i++) { + error_printf("%s%s", sep, argp[i]); + sep = " "; + } + error_printf(": "); + break; case LOC_FILE: error_printf("%s:", (const char *)cur_loc->ptr); if (cur_loc->num) { |