summaryrefslogtreecommitdiffstatshomepage
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
commit5f6f39f0ca02386bfa43ddddec9507b47b57df7d (patch)
tree588877b394532c51bb97970ab0daa3675870c1f7 /validate.c
parenta0ba6cb742a9779f6af9e98cf541311c2b2c5d9d (diff)
downloadmandoc-5f6f39f0ca02386bfa43ddddec9507b47b57df7d.tar.gz
mandoc-5f6f39f0ca02386bfa43ddddec9507b47b57df7d.tar.zst
mandoc-5f6f39f0ca02386bfa43ddddec9507b47b57df7d.zip
Fixed spacing (almost there).
Diffstat (limited to 'validate.c')
-rw-r--r--validate.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/validate.c b/validate.c
index 79615394..1bf5b10d 100644
--- a/validate.c
+++ b/validate.c
@@ -1,4 +1,4 @@
-/* $Id: validate.c,v 1.3 2008/11/30 12:41:45 kristaps Exp $ */
+/* $Id: validate.c,v 1.4 2008/11/30 18:50:44 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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));
}