+ if (NULL == man->meta.title) {
+ mandoc_msg(MANDOCERR_TH_NOTITLE, man->parse,
+ n->line, n->pos, NULL);
+
+ /*
+ * If a title hasn't been set, do so now (by
+ * implication, date and section also aren't set).
+ */
+
+ man->meta.title = mandoc_strdup("");
+ man->meta.msec = mandoc_strdup("");
+ man->meta.date = man->quick ? mandoc_strdup("") :
+ mandoc_normdate(man->parse, NULL, n->line, n->pos);
+ }
+}
+
+static void
+check_text(CHKARGS)
+{
+ char *cp, *p;
+
+ if (MAN_LITERAL & man->flags)
+ return;
+
+ cp = n->string;
+ for (p = cp; NULL != (p = strchr(p, '\t')); p++)
+ mandoc_msg(MANDOCERR_FI_TAB, man->parse,
+ n->line, n->pos + (p - cp), NULL);
+}
+
+static void
+post_OP(CHKARGS)
+{
+
+ if (n->nchild == 0)
+ mandoc_msg(MANDOCERR_OP_EMPTY, man->parse,
+ n->line, n->pos, "OP");
+ else if (n->nchild > 2) {
+ n = n->child->next->next;
+ mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse,
+ n->line, n->pos, "OP ... %s", n->string);
+ }
+}
+
+static void
+post_UR(CHKARGS)
+{
+
+ if (n->type == ROFFT_HEAD && n->child == NULL)
+ mandoc_vmsg(MANDOCERR_UR_NOHEAD, man->parse,
+ n->line, n->pos, "UR");
+ check_part(man, n);
+}
+
+static void
+post_ft(CHKARGS)
+{
+ char *cp;
+ int ok;
+
+ if (0 == n->nchild)
+ return;
+
+ ok = 0;
+ cp = n->child->string;
+ switch (*cp) {
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case 'I':
+ case 'P':
+ case 'R':
+ if ('\0' == cp[1])
+ ok = 1;
+ break;
+ case 'B':
+ if ('\0' == cp[1] || ('I' == cp[1] && '\0' == cp[2]))
+ ok = 1;
+ break;
+ case 'C':
+ if ('W' == cp[1] && '\0' == cp[2])
+ ok = 1;
+ break;
+ default:
+ break;
+ }
+
+ if (0 == ok) {
+ mandoc_vmsg(MANDOCERR_FT_BAD, man->parse,
+ n->line, n->pos, "ft %s", cp);
+ *cp = '\0';
+ }
+}
+
+static void
+check_part(CHKARGS)
+{
+
+ if (n->type == ROFFT_BODY && n->child == NULL)
+ mandoc_msg(MANDOCERR_BLK_EMPTY, man->parse,
+ n->line, n->pos, man_macronames[n->tok]);
+}
+
+static void
+check_par(CHKARGS)
+{
+
+ switch (n->type) {
+ case ROFFT_BLOCK:
+ if (0 == n->body->nchild)
+ roff_node_delete(man, n);
+ break;
+ case ROFFT_BODY:
+ if (0 == n->nchild)
+ mandoc_vmsg(MANDOCERR_PAR_SKIP,
+ man->parse, n->line, n->pos,
+ "%s empty", man_macronames[n->tok]);
+ break;
+ case ROFFT_HEAD:
+ if (n->nchild)
+ mandoc_vmsg(MANDOCERR_ARG_SKIP,
+ man->parse, n->line, n->pos,
+ "%s %s%s", man_macronames[n->tok],
+ n->child->string,
+ n->nchild > 1 ? " ..." : "");
+ break;