Revision 0f0bc3f1 qemu-error.c
b/qemu-error.c | ||
---|---|---|
114 | 114 |
} |
115 | 115 |
|
116 | 116 |
/* |
117 |
* Change the current location to argument ARGV[IDX..IDX+CNT-1]. |
|
118 |
*/ |
|
119 |
void loc_set_cmdline(char **argv, int idx, int cnt) |
|
120 |
{ |
|
121 |
cur_loc->kind = LOC_CMDLINE; |
|
122 |
cur_loc->num = cnt; |
|
123 |
cur_loc->ptr = argv + idx; |
|
124 |
} |
|
125 |
|
|
126 |
/* |
|
117 | 127 |
* Change the current location to file FNAME, line LNO. |
118 | 128 |
*/ |
119 | 129 |
void loc_set_file(const char *fname, int lno) |
... | ... | |
143 | 153 |
void error_print_loc(void) |
144 | 154 |
{ |
145 | 155 |
const char *sep = ""; |
156 |
int i; |
|
157 |
const char *const *argp; |
|
146 | 158 |
|
147 | 159 |
if (!cur_mon) { |
148 | 160 |
fprintf(stderr, "%s:", progname); |
149 | 161 |
sep = " "; |
150 | 162 |
} |
151 | 163 |
switch (cur_loc->kind) { |
164 |
case LOC_CMDLINE: |
|
165 |
argp = cur_loc->ptr; |
|
166 |
for (i = 0; i < cur_loc->num; i++) { |
|
167 |
error_printf("%s%s", sep, argp[i]); |
|
168 |
sep = " "; |
|
169 |
} |
|
170 |
error_printf(": "); |
|
171 |
break; |
|
152 | 172 |
case LOC_FILE: |
153 | 173 |
error_printf("%s:", (const char *)cur_loc->ptr); |
154 | 174 |
if (cur_loc->num) { |
Also available in: Unified diff