summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xml2tsv.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/xml2tsv.c b/xml2tsv.c
index 7363ce6..4f9f8eb 100644
--- a/xml2tsv.c
+++ b/xml2tsv.c
@@ -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)