diff options
author | KatolaZ <katolaz@freaknet.org> | 2020-01-04 12:17:30 +0000 |
---|---|---|
committer | KatolaZ <katolaz@freaknet.org> | 2020-01-04 12:18:30 +0000 |
commit | 90c501f47d0a32cedca9a4ea27fbe27be9fb3be4 (patch) | |
tree | 9dd8237de2d75704b37617e34809e44c78437ea7 /xml2tsv.c | |
parent | 6b7046c7c6b7d269067b2586f676c81a0c531420 (diff) |
print unclosed tags after EOF and rename print_no_cr
Diffstat (limited to 'xml2tsv.c')
-rw-r--r-- | xml2tsv.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -58,7 +58,7 @@ void stack_init(tstack_t *t){ /* utility functions */ -void print_no_cr(FILE *f, const char *s){ +void quote_print(FILE *f, const char *s){ const char *tmp = s; size_t len; while (*tmp != '\0'){ @@ -136,7 +136,7 @@ xmlcdatastart(XMLParser *x) void xmlcdata(XMLParser *x, const char *d, size_t dl) { - print_no_cr(stdout, d); + quote_print(stdout, d); } void @@ -162,7 +162,7 @@ xmlcommentend(XMLParser *x) void xmldata(XMLParser *x, const char *d, size_t dl) { - print_no_cr(stdout, d); + quote_print(stdout, d); } void @@ -251,5 +251,10 @@ main(void) xml_parse(&x); printf("\n"); + if (! stack_empty(&st)) { + fprintf(stderr, "Error: tags still open at EOF: "); + print_cur_str(stderr, &st); + fprintf(stderr, "\n"); + } return 0; } |