summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2020-01-04 12:17:30 +0000
committerKatolaZ <katolaz@freaknet.org>2020-01-04 12:18:30 +0000
commit90c501f47d0a32cedca9a4ea27fbe27be9fb3be4 (patch)
tree9dd8237de2d75704b37617e34809e44c78437ea7
parent6b7046c7c6b7d269067b2586f676c81a0c531420 (diff)
print unclosed tags after EOF and rename print_no_cr
-rw-r--r--xml2tsv.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/xml2tsv.c b/xml2tsv.c
index 4f9f8eb..9ad033b 100644
--- 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;
}