summaryrefslogtreecommitdiffstats
path: root/validate.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2008-11-30 18:50:44 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2008-11-30 18:50:44 +0000
commit4bbdbe91830ef70f8e2412f6f13baa347956208b (patch)
tree97d07a935809a68388c62945354b4160d2827b68 /validate.c
parent8a90e3149d99de9d2b20d61307f7d4951ef18bf0 (diff)
downloadmandoc-4bbdbe91830ef70f8e2412f6f13baa347956208b.tar.gz
Fixed spacing (almost there).
Diffstat (limited to 'validate.c')
-rw-r--r--validate.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/validate.c b/validate.c
index e5ca3a50..e8f9cec8 100644
--- a/validate.c
+++ b/validate.c
@@ -52,7 +52,7 @@ static void roffmsg(void *arg, enum roffmsg,
static int roffhead(void *);
static int rofftail(void *);
static int roffin(void *, int, int *, char **);
-static int roffdata(void *, char *);
+static int roffdata(void *, int, char *);
static int roffout(void *, int);
static int roffblkin(void *, int, int *, char **);
static int roffblkout(void *, int);
@@ -60,7 +60,7 @@ static int roffspecial(void *, int);
static int mbuf_newline(struct md_valid *);
static int mbuf_indent(struct md_valid *);
-static int mbuf_data(struct md_valid *, char *);
+static int mbuf_data(struct md_valid *, int, char *);
static int
@@ -92,14 +92,11 @@ mbuf_newline(struct md_valid *p)
static int
-mbuf_data(struct md_valid *p, char *buf)
+mbuf_data(struct md_valid *p, int space, char *buf)
{
- int space;
size_t sz;
char *bufp;
- space = 1; /* FIXME */
-
assert(p->mbuf);
assert(0 != p->indent);
@@ -227,13 +224,15 @@ roffhead(void *arg)
assert(arg);
p = (struct md_valid *)arg;
- if ( ! md_buf_putstring(p->mbuf, "BEGIN"))
+ if ( ! md_buf_putstring(p->mbuf, "<?xml version=\"1.0\" "
+ "encoding=\"UTF-8\"?>\n"))
return(0);
- p->indent++;
- if ( ! mbuf_newline(p))
+
+ if ( ! md_buf_putstring(p->mbuf, "<mdoc>"))
return(0);
+ p->indent++;
- return(1);
+ return(mbuf_newline(p));
}
@@ -247,10 +246,7 @@ rofftail(void *arg)
if (0 != p->pos && ! mbuf_newline(p))
return(0);
-
- if ( ! md_buf_putstring(p->mbuf, "END\n"))
- return(0);
- return(1);
+ return(md_buf_putstring(p->mbuf, "</mdoc>\n"));
}
@@ -334,6 +330,7 @@ roffin(void *arg, int tok, int *argcp, char **argvp)
if (0 == p->pos && ! mbuf_indent(p))
return(0);
+ /* FIXME: not always with a space... */
if ( ! md_buf_putstring(p->mbuf, " <"))
return(0);
if ( ! md_buf_putstring(p->mbuf, toknames[tok]))
@@ -406,11 +403,11 @@ roffmsg(void *arg, enum roffmsg lvl,
static int
-roffdata(void *arg, char *buf)
+roffdata(void *arg, int space, char *buf)
{
struct md_valid *p;
assert(arg);
p = (struct md_valid *)arg;
- return(mbuf_data(p, buf));
+ return(mbuf_data(p, space, buf));
}