+ free(man->meta.title);
+ free(man->meta.vol);
+ free(man->meta.os);
+ free(man->meta.msec);
+ free(man->meta.date);
+
+ man->meta.title = man->meta.vol = man->meta.date =
+ man->meta.msec = man->meta.os = NULL;
+
+ nb = n;
+
+ /* ->TITLE<- MSEC DATE OS VOL */
+
+ n = n->child;
+ if (n && n->string) {
+ for (p = n->string; '\0' != *p; p++) {
+ /* Only warn about this once... */
+ if (isalpha((unsigned char)*p) &&
+ ! isupper((unsigned char)*p)) {
+ mandoc_vmsg(MANDOCERR_TITLE_CASE,
+ man->parse, n->line,
+ n->pos + (p - n->string),
+ "TH %s", n->string);
+ break;
+ }
+ }
+ man->meta.title = mandoc_strdup(n->string);
+ } else {
+ man->meta.title = mandoc_strdup("");
+ mandoc_msg(MANDOCERR_TH_NOTITLE, man->parse,
+ nb->line, nb->pos, "TH");
+ }
+
+ /* TITLE ->MSEC<- DATE OS VOL */
+
+ if (n)
+ n = n->next;
+ if (n && n->string)
+ man->meta.msec = mandoc_strdup(n->string);
+ else {
+ man->meta.msec = mandoc_strdup("");
+ mandoc_vmsg(MANDOCERR_MSEC_MISSING, man->parse,
+ nb->line, nb->pos, "TH %s", man->meta.title);
+ }
+
+ /* TITLE MSEC ->DATE<- OS VOL */
+
+ if (n)
+ n = n->next;
+ if (n && n->string && '\0' != n->string[0]) {
+ man->meta.date = man->quick ?
+ mandoc_strdup(n->string) :
+ mandoc_normdate(man->parse, n->string,
+ n->line, n->pos);
+ } else {
+ man->meta.date = mandoc_strdup("");
+ mandoc_msg(MANDOCERR_DATE_MISSING, man->parse,
+ n ? n->line : nb->line,
+ n ? n->pos : nb->pos, "TH");
+ }
+
+ /* TITLE MSEC DATE ->OS<- VOL */
+
+ if (n && (n = n->next))
+ man->meta.os = mandoc_strdup(n->string);
+ else if (man->defos != NULL)
+ man->meta.os = mandoc_strdup(man->defos);
+
+ /* TITLE MSEC DATE OS ->VOL<- */
+ /* If missing, use the default VOL name for MSEC. */
+
+ if (n && (n = n->next))
+ man->meta.vol = mandoc_strdup(n->string);
+ else if ('\0' != man->meta.msec[0] &&
+ (NULL != (p = mandoc_a2msec(man->meta.msec))))
+ man->meta.vol = mandoc_strdup(p);
+
+ if (n != NULL && (n = n->next) != NULL)
+ mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse,
+ n->line, n->pos, "TH ... %s", n->string);
+
+ /*
+ * Remove the `TH' node after we've processed it for our
+ * meta-data.
+ */
+ roff_node_delete(man, man->last);
+}
+
+static void
+post_nf(CHKARGS)
+{
+
+ if (man->flags & MAN_LITERAL)
+ mandoc_msg(MANDOCERR_NF_SKIP, man->parse,
+ n->line, n->pos, "nf");
+
+ man->flags |= MAN_LITERAL;
+}
+
+static void
+post_fi(CHKARGS)
+{
+
+ if ( ! (MAN_LITERAL & man->flags))
+ mandoc_msg(MANDOCERR_FI_SKIP, man->parse,
+ n->line, n->pos, "fi");
+
+ man->flags &= ~MAN_LITERAL;
+}
+
+static void
+post_UC(CHKARGS)
+{
+ static const char * const bsd_versions[] = {
+ "3rd Berkeley Distribution",
+ "4th Berkeley Distribution",
+ "4.2 Berkeley Distribution",
+ "4.3 Berkeley Distribution",
+ "4.4 Berkeley Distribution",
+ };