=================================================================== RCS file: /cvs/mandoc/mdoc_validate.c,v retrieving revision 1.105 retrieving revision 1.107 diff -u -p -r1.105 -r1.107 --- mandoc/mdoc_validate.c 2010/07/02 12:54:33 1.105 +++ mandoc/mdoc_validate.c 2010/07/02 15:03:14 1.107 @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.105 2010/07/02 12:54:33 kristaps Exp $ */ +/* $Id: mdoc_validate.c,v 1.107 2010/07/02 15:03:14 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -849,13 +849,20 @@ static int pre_an(PRE_ARGS) { - if (NULL == n->args || 1 == n->args->argc) + if (NULL == n->args) return(1); - mdoc_vmsg(mdoc, MANDOCERR_SYNTARGCOUNT, - n->line, n->pos, - "line arguments == 1 (have %d)", - n->args->argc); - return(0); + if (n->args->argc > 1) + if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_ARGCOUNT)) + return(0); + + if (MDOC_Split == n->args->argv[0].arg) + n->data.An.auth = AUTH_split; + else if (MDOC_Nosplit == n->args->argv[0].arg) + n->data.An.auth = AUTH_nosplit; + else + abort(); + + return(1); } @@ -957,6 +964,8 @@ post_bf(POST_ARGS) } np = mdoc->last; + assert(MDOC_BLOCK == np->parent->type); + assert(MDOC_Bf == np->parent->tok); np->data.Bf = mandoc_calloc(1, sizeof(struct mdoc_bf)); /* @@ -964,16 +973,16 @@ post_bf(POST_ARGS) * If neither is specified, let it through with a warning. */ - if (np->args && np->child) { + if (np->parent->args && np->child) { mdoc_nmsg(mdoc, np, MANDOCERR_SYNTARGVCOUNT); return(0); - } else if (NULL == np->args && NULL == np->child) + } else if (NULL == np->parent->args && NULL == np->child) return(mdoc_nmsg(mdoc, np, MANDOCERR_FONTTYPE)); /* Extract argument into data. */ - if (np->args) { - arg = np->args->argv[0].arg; + if (np->parent->args) { + arg = np->parent->args->argv[0].arg; if (MDOC_Emphasis == arg) np->data.Bf->font = FONT_Em; else if (MDOC_Literal == arg) @@ -1074,16 +1083,14 @@ post_at(POST_ARGS) static int post_an(POST_ARGS) { + struct mdoc_node *np; - if (mdoc->last->args) { - if (NULL == mdoc->last->child) - return(1); - return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_ARGCOUNT)); - } - - if (mdoc->last->child) + np = mdoc->last; + if (AUTH__NONE != np->data.An.auth && np->child) + return(mdoc_nmsg(mdoc, np, MANDOCERR_ARGCOUNT)); + if (AUTH__NONE != np->data.An.auth || np->child) return(1); - return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS)); + return(mdoc_nmsg(mdoc, np, MANDOCERR_NOARGS)); }