=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_validate.c,v retrieving revision 1.18 retrieving revision 1.19 diff -c -r1.18 -r1.19 *** src/usr.bin/mandoc/mdoc_validate.c 2009/07/12 20:30:27 1.18 --- src/usr.bin/mandoc/mdoc_validate.c 2009/07/12 21:08:29 1.19 *************** *** 1,4 **** ! /* $Id: mdoc_validate.c,v 1.18 2009/07/12 20:30:27 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * --- 1,4 ---- ! /* $Id: mdoc_validate.c,v 1.19 2009/07/12 21:08:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * *************** *** 669,675 **** /* `Nm' name must be set. */ if (v->sz || m->meta.name) return(1); ! return(nerr(m, n, ENAME)); } return(1); --- 669,675 ---- /* `Nm' name must be set. */ if (v->sz || m->meta.name) return(1); ! return(mdoc_nerr(m, n, ENAME)); } return(1); *************** *** 744,750 **** if (NULL == node) return(1); ! return(nerr(mdoc, n, ENESTDISP)); } --- 744,750 ---- if (NULL == node) return(1); ! return(mdoc_nerr(mdoc, n, ENESTDISP)); } *************** *** 756,762 **** if (MDOC_BLOCK != n->type) return(1); if (NULL == n->args) ! return(nerr(mdoc, n, ELISTTYPE)); /* Make sure that only one type of list is specified. */ --- 756,762 ---- if (MDOC_BLOCK != n->type) return(1); if (NULL == n->args) ! return(mdoc_nerr(mdoc, n, ELISTTYPE)); /* Make sure that only one type of list is specified. */ *************** *** 787,803 **** /* FALLTHROUGH */ case (MDOC_Column): if (-1 != type) ! return(nerr(mdoc, n, EMULTILIST)); type = n->args->argv[pos].arg; break; case (MDOC_Width): if (-1 != width) ! return(nerr(mdoc, n, EARGREP)); width = n->args->argv[pos].arg; break; case (MDOC_Offset): if (-1 != offset) ! return(nerr(mdoc, n, EARGREP)); offset = n->args->argv[pos].arg; break; default: --- 787,803 ---- /* FALLTHROUGH */ case (MDOC_Column): if (-1 != type) ! return(mdoc_nerr(mdoc, n, EMULTILIST)); type = n->args->argv[pos].arg; break; case (MDOC_Width): if (-1 != width) ! return(mdoc_nerr(mdoc, n, EARGREP)); width = n->args->argv[pos].arg; break; case (MDOC_Offset): if (-1 != offset) ! return(mdoc_nerr(mdoc, n, EARGREP)); offset = n->args->argv[pos].arg; break; default: *************** *** 805,811 **** } if (-1 == type) ! return(nerr(mdoc, n, ELISTTYPE)); /* * Validate the width field. Some list types don't need width --- 805,811 ---- } if (-1 == type) ! return(mdoc_nerr(mdoc, n, ELISTTYPE)); /* * Validate the width field. Some list types don't need width *************** *** 844,850 **** if (MDOC_BLOCK != n->type) return(1); if (NULL == n->args) ! return(nerr(mdoc, n, EDISPTYPE)); /* Make sure that only one type of display is specified. */ --- 844,850 ---- if (MDOC_BLOCK != n->type) return(1); if (NULL == n->args) ! return(mdoc_nerr(mdoc, n, EDISPTYPE)); /* Make sure that only one type of display is specified. */ *************** *** 863,876 **** case (MDOC_File): if (0 == type++) break; ! return(nerr(mdoc, n, EMULTIDISP)); default: break; } if (type) return(1); ! return(nerr(mdoc, n, EDISPTYPE)); } --- 863,876 ---- case (MDOC_File): if (0 == type++) break; ! return(mdoc_nerr(mdoc, n, EMULTIDISP)); default: break; } if (type) return(1); ! return(mdoc_nerr(mdoc, n, EDISPTYPE)); } *************** *** 1013,1024 **** head = mdoc->last->head; if (mdoc->last->args && head->child) ! return(mdoc_nerr(mdoc, mdoc->last, "one argument expected")); else if (mdoc->last->args) return(1); if (NULL == head->child || MDOC_TEXT != head->child->type) ! return(mdoc_nerr(mdoc, mdoc->last, "text argument expected")); p = head->child->string; --- 1013,1024 ---- head = mdoc->last->head; if (mdoc->last->args && head->child) ! return(mdoc_nerr(mdoc, mdoc->last, ELINE)); else if (mdoc->last->args) return(1); if (NULL == head->child || MDOC_TEXT != head->child->type) ! return(mdoc_nerr(mdoc, mdoc->last, ELINE)); p = head->child->string; *************** *** 1029,1035 **** else if (0 == strcmp(p, "Sm")) return(1); ! return(mdoc_nerr(mdoc, head->child, "invalid font mode")); } --- 1029,1035 ---- else if (0 == strcmp(p, "Sm")) return(1); ! return(mdoc_nerr(mdoc, head, EFONT)); } *************** *** 1041,1047 **** return(1); if (mdoc->meta.name) return(1); ! return(verr(mdoc, ENAME)); } --- 1041,1047 ---- return(1); if (mdoc->meta.name) return(1); ! return(mdoc_nerr(mdoc, mdoc->last, ENAME)); } *************** *** 1052,1061 **** if (NULL == mdoc->last->child) return(1); if (MDOC_TEXT != mdoc->last->child->type) ! return(verr(mdoc, EATT)); if (mdoc_a2att(mdoc->last->child->string)) return(1); ! return(verr(mdoc, EATT)); } --- 1052,1061 ---- if (NULL == mdoc->last->child) return(1); if (MDOC_TEXT != mdoc->last->child->type) ! return(mdoc_nerr(mdoc, mdoc->last, EATT)); if (mdoc_a2att(mdoc->last->child->string)) return(1); ! return(mdoc_nerr(mdoc, mdoc->last, EATT)); } *************** *** 1066,1077 **** if (mdoc->last->args) { if (NULL == mdoc->last->child) return(1); ! return(verr(mdoc, ELINE)); } if (mdoc->last->child) return(1); ! return(verr(mdoc, ELINE)); } --- 1066,1077 ---- if (mdoc->last->args) { if (NULL == mdoc->last->child) return(1); ! return(mdoc_nerr(mdoc, mdoc->last, ELINE)); } if (mdoc->last->child) return(1); ! return(mdoc_nerr(mdoc, mdoc->last, ELINE)); } *************** *** 1081,1087 **** if (mdoc->last->args) return(1); ! return(verr(mdoc, ELINE)); } --- 1081,1087 ---- if (mdoc->last->args) return(1); ! return(mdoc_nerr(mdoc, mdoc->last, ELINE)); } *************** *** 1096,1102 **** n = mdoc->last->parent->parent; if (NULL == n->args) ! return(verr(mdoc, ELISTTYPE)); /* Some types require block-head, some not. */ --- 1096,1102 ---- n = mdoc->last->parent->parent; if (NULL == n->args) ! return(mdoc_nerr(mdoc, mdoc->last, ELISTTYPE)); /* Some types require block-head, some not. */ *************** *** 1134,1140 **** } if (-1 == type) ! return(verr(mdoc, ELISTTYPE)); switch (type) { case (MDOC_Tag): --- 1134,1140 ---- } if (-1 == type) ! return(mdoc_nerr(mdoc, mdoc->last, ELISTTYPE)); switch (type) { case (MDOC_Tag): *************** *** 1212,1218 **** return(1); if (n->args->argv[i].sz && mdoc->last->child) ! return(nerr(mdoc, n, ECOLMIS)); return(1); } --- 1212,1218 ---- return(1); if (n->args->argv[i].sz && mdoc->last->child) ! return(mdoc_nerr(mdoc, n, ECOLMIS)); return(1); } *************** *** 1262,1268 **** if (NULL == n) return(1); ! return(nerr(mdoc, n, EBOOL)); } --- 1262,1268 ---- if (NULL == n) return(1); ! return(mdoc_nerr(mdoc, n, EBOOL)); } *************** *** 1271,1284 **** { if (NULL == mdoc->first->child) ! return(verr(mdoc, ENODAT)); if ( ! (MDOC_PBODY & mdoc->flags)) ! return(verr(mdoc, ENOPROLOGUE)); if (MDOC_BLOCK != mdoc->first->child->type) ! return(verr(mdoc, ENODAT)); if (MDOC_Sh != mdoc->first->child->tok) ! return(verr(mdoc, ENODAT)); return(1); } --- 1271,1284 ---- { if (NULL == mdoc->first->child) ! return(mdoc_nerr(mdoc, mdoc->first, ENODAT)); if ( ! (MDOC_PBODY & mdoc->flags)) ! return(mdoc_nerr(mdoc, mdoc->first, ENOPROLOGUE)); if (MDOC_BLOCK != mdoc->first->child->type) ! return(mdoc_nerr(mdoc, mdoc->first, ENODAT)); if (MDOC_Sh != mdoc->first->child->tok) ! return(mdoc_nerr(mdoc, mdoc->first, ENODAT)); return(1); } *************** *** 1360,1370 **** assert(MDOC_TEXT == n->type); if (strlcat(buf, n->string, 64) >= 64) ! return(nerr(mdoc, n, ETOOLONG)); if (NULL == n->next) continue; if (strlcat(buf, " ", 64) >= 64) ! return(nerr(mdoc, n, ETOOLONG)); } sec = mdoc_atosec(buf); --- 1360,1370 ---- assert(MDOC_TEXT == n->type); if (strlcat(buf, n->string, 64) >= 64) ! return(mdoc_nerr(mdoc, n, ETOOLONG)); if (NULL == n->next) continue; if (strlcat(buf, " ", 64) >= 64) ! return(mdoc_nerr(mdoc, n, ETOOLONG)); } sec = mdoc_atosec(buf); *************** *** 1375,1381 **** */ if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed) ! return(verr(mdoc, ESECNAME)); if (SEC_CUSTOM == sec) return(1); if (sec == mdoc->lastnamed) --- 1375,1381 ---- */ if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed) ! return(mdoc_nerr(mdoc, mdoc->last, ESECNAME)); if (SEC_CUSTOM == sec) return(1); if (sec == mdoc->lastnamed)