diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-12-22 14:11:32 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-12-22 14:11:32 +0000 |
commit | fef3074347c02ed0c2fd9d1918402c966b909466 (patch) | |
tree | 1ca2beb79f94e3cc852dde85e49a4d5e49d7b430 /monitor.c | |
parent | bd491d6a4ecc57144ffa55c0daf97b43bc1648ce (diff) |
Escape filname printout properly, by Anthony Liguori and Julian Seward.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2263 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -106,6 +106,33 @@ void term_printf(const char *fmt, ...) va_end(ap); } +void term_print_filename(const char *filename) +{ + int i; + + for (i = 0; filename[i]; i++) { + switch (filename[i]) { + case ' ': + case '"': + case '\\': + term_printf("\\%c", filename[i]); + break; + case '\t': + term_printf("\\t"); + break; + case '\r': + term_printf("\\r"); + break; + case '\n': + term_printf("\\n"); + break; + default: + term_printf("%c", filename[i]); + break; + } + } +} + static int monitor_fprintf(FILE *stream, const char *fmt, ...) { va_list ap; |