diff options
-rw-r--r-- | xml2tsv.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -62,7 +62,7 @@ void print_no_cr(FILE *f, const char *s){ const char *tmp = s; size_t len; while (*tmp != '\0'){ - len = strcspn(tmp, "\n\t"); + len = strcspn(tmp, "\\\n\t"); fwrite(tmp, 1, len, f); tmp += len; if (*tmp == '\n'){ @@ -75,6 +75,10 @@ void print_no_cr(FILE *f, const char *s){ fprintf(f, "\\t"); tmp ++; } + else if (*tmp == '\\'){ + fprintf(f, "\\\\"); + tmp ++; + } } } @@ -103,7 +107,7 @@ void xmlattrentity(XMLParser *x, const char *t, size_t tl, const char *a, size_t al, const char *v, size_t vl) { - static char buf[16]; + char buf[16]; int n; if ((n = xml_entitytostr(v, buf, sizeof(buf))) > 0) |