Skip to content

Commit

Permalink
lib/format.c: add some more escape sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
Duncaen committed Mar 10, 2023
1 parent aefb164 commit 28fe8de
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions lib/format.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,16 @@ nexttok(const char **pos, struct strbuf *buf)
return TVAR;
case '\\':
switch (*++p) {
case '\\':
r = strbuf_putc(buf, '\\');
break;
case 'n':
r = strbuf_putc(buf, '\n');
break;
case 't':
r = strbuf_putc(buf, '\t');
break;
case '0':
r = strbuf_putc(buf, '\0');
break;
case '{':
r = strbuf_putc(buf, '{');
break;
case '}':
r = strbuf_putc(buf, '}');
break;
case '\\': r = strbuf_putc(buf, '\\'); break;
case 'a': r = strbuf_putc(buf, '\a'); break;
case 'b': r = strbuf_putc(buf, '\b'); break;
case 'f': r = strbuf_putc(buf, '\f'); break;
case 'n': r = strbuf_putc(buf, '\n'); break;
case 'r': r = strbuf_putc(buf, '\r'); break;
case 't': r = strbuf_putc(buf, '\t'); break;
case '0': r = strbuf_putc(buf, '\0'); break;
case '{': r = strbuf_putc(buf, '{'); break;
case '}': r = strbuf_putc(buf, '}'); break;
default:
r = strbuf_putc(buf, '\\');
if (r < 0)
Expand Down

0 comments on commit 28fe8de

Please sign in to comment.