diff options
Diffstat (limited to 'format.cc')
-rw-r--r-- | format.cc | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -53,7 +53,7 @@ element_t * format_t::parse_elements(const std::string& fmt) char * q = buf; for (const char * p = fmt.c_str(); *p; p++) { - if (*p != '%') { + if (*p != '%' && *p != '\\') { *q++ = *p; continue; } @@ -75,6 +75,20 @@ element_t * format_t::parse_elements(const std::string& fmt) current = current->next; } + if (*p == '\\') { + p++; + current->type = element_t::STRING; + switch (*p) { + case 'b': current->chars = "\b"; break; + case 'f': current->chars = "\f"; break; + case 'n': current->chars = "\n"; break; + case 'r': current->chars = "\r"; break; + case 't': current->chars = "\t"; break; + case 'v': current->chars = "\v"; break; + } + continue; + } + ++p; if (*p == '-') { current->align_left = true; |