mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 15:15:46 +00:00
monitor: Move monitor_putc() next to monitor_puts & external linkage
monitor_putc() will soon be used from more than one .c file. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20230124121946.1139465-28-armbru@redhat.com>
This commit is contained in:
@ -260,6 +260,33 @@ int monitor_printf(Monitor *mon, const char *fmt, ...)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void monitor_printc(Monitor *mon, int c)
|
||||
{
|
||||
monitor_printf(mon, "'");
|
||||
switch(c) {
|
||||
case '\'':
|
||||
monitor_printf(mon, "\\'");
|
||||
break;
|
||||
case '\\':
|
||||
monitor_printf(mon, "\\\\");
|
||||
break;
|
||||
case '\n':
|
||||
monitor_printf(mon, "\\n");
|
||||
break;
|
||||
case '\r':
|
||||
monitor_printf(mon, "\\r");
|
||||
break;
|
||||
default:
|
||||
if (c >= 32 && c <= 126) {
|
||||
monitor_printf(mon, "%c", c);
|
||||
} else {
|
||||
monitor_printf(mon, "\\x%02x", c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
monitor_printf(mon, "'");
|
||||
}
|
||||
|
||||
/*
|
||||
* Print to current monitor if we have one, else to stderr.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user