=================================================================== RCS file: /cvs/mandoc/man_validate.c,v retrieving revision 1.107 retrieving revision 1.112 diff -u -p -r1.107 -r1.112 --- mandoc/man_validate.c 2014/11/28 05:51:32 1.107 +++ mandoc/man_validate.c 2015/02/06 09:38:43 1.112 @@ -1,4 +1,4 @@ -/* $OpenBSD: man_validate.c,v 1.107 2014/11/28 05:51:32 schwarze Exp $ */ +/* $OpenBSD: man_validate.c,v 1.112 2015/02/06 09:38:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze @@ -38,9 +38,7 @@ typedef void (*v_check)(CHKARGS); -static void check_eq0(CHKARGS); static void check_eq2(CHKARGS); -static void check_le1(CHKARGS); static void check_le5(CHKARGS); static void check_par(CHKARGS); static void check_part(CHKARGS); @@ -79,7 +77,6 @@ static v_check man_valids[MAN_MAX] = { NULL, /* I */ NULL, /* IR */ NULL, /* RI */ - check_eq0, /* na */ post_vs, /* sp */ post_nf, /* nf */ post_fi, /* fi */ @@ -87,7 +84,7 @@ static v_check man_valids[MAN_MAX] = { check_part, /* RS */ NULL, /* DT */ post_UC, /* UC */ - check_le1, /* PD */ + NULL, /* PD */ post_AT, /* AT */ NULL, /* in */ post_ft, /* ft */ @@ -183,9 +180,7 @@ check_##name(CHKARGS) \ #ineq, (x), n->nchild); \ } -INEQ_DEFINE(0, ==, eq0) INEQ_DEFINE(2, ==, eq2) -INEQ_DEFINE(1, <=, le1) INEQ_DEFINE(5, <=, le5) static void @@ -243,19 +238,15 @@ post_ft(CHKARGS) n->line, n->pos, "ft %s", cp); *cp = '\0'; } - - if (1 < n->nchild) - mandoc_vmsg(MANDOCERR_ARGCOUNT, man->parse, n->line, - n->pos, "want one child (have %d)", n->nchild); } static void check_part(CHKARGS) { - if (MAN_BODY == n->type && 0 == n->nchild) - mandoc_msg(MANDOCERR_ARGCWARN, man->parse, n->line, - n->pos, "want children (have none)"); + if (n->type == MAN_BODY && n->child == NULL) + mandoc_msg(MANDOCERR_BLK_EMPTY, man->parse, + n->line, n->pos, man_macronames[n->tok]); } static void @@ -379,6 +370,8 @@ post_TH(CHKARGS) if (n && (n = n->next)) man->meta.source = mandoc_strdup(n->string); + else if (man->defos != NULL) + man->meta.source = mandoc_strdup(man->defos); /* TITLE MSEC DATE SOURCE ->VOL<- */ /* If missing, use the default VOL name for MSEC. */ @@ -400,9 +393,7 @@ static void post_nf(CHKARGS) { - check_eq0(man, n); - - if (MAN_LITERAL & man->flags) + if (man->flags & MAN_LITERAL) mandoc_msg(MANDOCERR_NF_SKIP, man->parse, n->line, n->pos, "nf"); @@ -413,8 +404,6 @@ static void post_fi(CHKARGS) { - check_eq0(man, n); - if ( ! (MAN_LITERAL & man->flags)) mandoc_msg(MANDOCERR_FI_SKIP, man->parse, n->line, n->pos, "fi"); @@ -499,11 +488,6 @@ post_AT(CHKARGS) static void post_vs(CHKARGS) { - - if (n->tok == MAN_br) - check_eq0(man, n); - else - check_le1(man, n); if (NULL != n->prev) return;