print unclosed tags after EOF and rename print_no_cr - xml2tsv - a simple xml-to-tsv converter, based on xmlparser DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 90c501f47d0a32cedca9a4ea27fbe27be9fb3be4 DIR parent 6b7046c7c6b7d269067b2586f676c81a0c531420 HTML Author: KatolaZ <katolaz@freaknet.org> Date: Sat, 4 Jan 2020 12:17:30 +0000 print unclosed tags after EOF and rename print_no_cr Diffstat: M xml2tsv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- DIR diff --git a/xml2tsv.c b/xml2tsv.c @@ -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; }