summaryrefslogtreecommitdiffstats
path: root/man_validate.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-06-22 13:09:17 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-06-22 13:09:17 +0000
commitf951b5d078f310702724f3214b50e17b27716023 (patch)
tree8b2a208c3aa81aa16a9575f4a7b1199e4b8e4537 /man_validate.c
parent101796b4d79943845f21342db70d90db02e715a4 (diff)
downloadmandoc-f951b5d078f310702724f3214b50e17b27716023.tar.gz
libman documents require `TH' and at least one node.
libman requirements documented in man.7 STRUCTURE section. Added STRUCTURE section to mdoc.7, too.
Diffstat (limited to 'man_validate.c')
-rw-r--r--man_validate.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/man_validate.c b/man_validate.c
index 77ca142e..e9a65510 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -38,6 +38,7 @@ static int check_le1(POSTARGS);
static int check_le2(POSTARGS);
static int check_le5(POSTARGS);
static int check_text(POSTARGS);
+static int check_root(POSTARGS);
static v_post posts_le1[] = { check_le1, NULL };
static v_post posts_le2[] = { check_le2, NULL };
@@ -85,8 +86,7 @@ man_valid_post(struct man *m)
case (MAN_TEXT):
return(check_text(m, m->last));
case (MAN_ROOT):
- /* FIXME: validate that TH has been invoked! */
- return(1);
+ return(check_root(m, m->last));
default:
break;
}
@@ -102,6 +102,19 @@ man_valid_post(struct man *m)
static int
+check_root(POSTARGS)
+{
+
+ if (NULL == m->first->child)
+ return(man_nerr(m, n, WNODATA));
+ if (NULL == m->meta.title)
+ return(man_nerr(m, n, WNOTITLE));
+
+ return(1);
+}
+
+
+static int
check_text(POSTARGS)
{
const char *p;