From 95fc4e37f1b0b3ae9ce9ec440927f668aee61a6c Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 20 Jul 2003 13:19:08 +0000 Subject: [PATCH] Fix some bugs... --- .cvsignore | 13 ++++++++++--- Makefile.in | 8 ++++---- mxml-file.c | 23 ++++++++++++++++------- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/.cvsignore b/.cvsignore index 6b75a6a..9b8b1f3 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,8 +1,15 @@ +*.bck +*.bak +Makefile +autom4te*.cache config.cache config.log config.status -Makefile libmxml.a +mxml.0 +mxml.3 +mxml.list +mxmldoc +mxmldoc.0 +mxmldoc.1 testmxml -*.bck -*.bak diff --git a/Makefile.in b/Makefile.in index 92cb24e..303382a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,5 @@ # -# "$Id: Makefile.in,v 1.8 2003/06/15 01:29:02 mike Exp $" +# "$Id: Makefile.in,v 1.9 2003/07/20 13:19:08 mike Exp $" # # Makefile for mini-XML, a small XML-like file parsing library. # @@ -188,8 +188,8 @@ mxmldoc.o: mxml.h testmxml: libmxml.a testmxml.o $(CC) $(LDFLAGS) -o $@ testmxml.o libmxml.a @echo Testing library... - @./testmxml test.xml >temp1.xml - @./testmxml temp1.xml >temp2.xml + ./testmxml test.xml >temp1.xml + ./testmxml temp1.xml >temp2.xml @if cmp temp1.xml temp2.xml; then \ echo Test passed!; \ $(RM) temp1.xml temp2.xml; \ @@ -217,5 +217,5 @@ $(OBJS): Makefile # -# End of "$Id: Makefile.in,v 1.8 2003/06/15 01:29:02 mike Exp $". +# End of "$Id: Makefile.in,v 1.9 2003/07/20 13:19:08 mike Exp $". # diff --git a/mxml-file.c b/mxml-file.c index e54ea0c..a016b8d 100644 --- a/mxml-file.c +++ b/mxml-file.c @@ -1,5 +1,5 @@ /* - * "$Id: mxml-file.c,v 1.13 2003/06/19 04:25:12 mike Exp $" + * "$Id: mxml-file.c,v 1.14 2003/07/20 13:19:08 mike Exp $" * * File loading code for mini-XML, a small XML-like file parsing library. * @@ -786,7 +786,9 @@ mxml_parse_element(mxml_node_t *node, /* I - Element node */ while ((ch = (*getc_cb)(p)) != EOF) { - printf("parse_element: ch='%c'\n", ch); +#ifdef DEBUG + fprintf(stderr, "parse_element: ch='%c'\n", ch); +#endif /* DEBUG */ /* * Skip leading whitespace... @@ -1060,8 +1062,12 @@ mxml_write_node(mxml_node_t *node, /* I - Node to write */ if (node->value.element.name[0] == '?') { - if (mxml_write_string("?>\n", p, putc_cb) < 0) - return (-1); + if ((*putc_cb)('?', p) < 0) + return (-1); + if ((*putc_cb)('>', p) < 0) + return (-1); + if ((*putc_cb)('\n', p) < 0) + return (-1); col = 0; } @@ -1103,10 +1109,13 @@ mxml_write_node(mxml_node_t *node, /* I - Node to write */ col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); } - else if (mxml_write_string("/>", p, putc_cb) < 0) - return (-1); else { + if ((*putc_cb)('/', p) < 0) + return (-1); + if ((*putc_cb)('>', p) < 0) + return (-1); + col += 2; col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); @@ -1363,5 +1372,5 @@ mxml_write_ws(mxml_node_t *node, /* I - Current node */ /* - * End of "$Id: mxml-file.c,v 1.13 2003/06/19 04:25:12 mike Exp $". + * End of "$Id: mxml-file.c,v 1.14 2003/07/20 13:19:08 mike Exp $". */