Revision 4a29a85d monitor.c
b/monitor.c | ||
---|---|---|
98 | 98 |
|
99 | 99 |
typedef struct MonitorControl { |
100 | 100 |
QObject *id; |
101 |
int print_enabled; |
|
101 | 102 |
JSONMessageParser parser; |
102 | 103 |
} MonitorControl; |
103 | 104 |
|
... | ... | |
186 | 187 |
|
187 | 188 |
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) |
188 | 189 |
{ |
189 |
char buf[4096]; |
|
190 |
vsnprintf(buf, sizeof(buf), fmt, ap); |
|
191 |
monitor_puts(mon, buf); |
|
190 |
if (mon->mc && !mon->mc->print_enabled) { |
|
191 |
qemu_error_new(QERR_UNDEFINED_ERROR); |
|
192 |
} else { |
|
193 |
char buf[4096]; |
|
194 |
vsnprintf(buf, sizeof(buf), fmt, ap); |
|
195 |
monitor_puts(mon, buf); |
|
196 |
} |
|
192 | 197 |
} |
193 | 198 |
|
194 | 199 |
void monitor_printf(Monitor *mon, const char *fmt, ...) |
... | ... | |
272 | 277 |
json = qobject_to_json(data); |
273 | 278 |
assert(json != NULL); |
274 | 279 |
|
280 |
mon->mc->print_enabled = 1; |
|
275 | 281 |
monitor_printf(mon, "%s\n", qstring_get_str(json)); |
282 |
mon->mc->print_enabled = 0; |
|
283 |
|
|
276 | 284 |
QDECREF(json); |
277 | 285 |
} |
278 | 286 |
|
Also available in: Unified diff