diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-07-02 15:03:14 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-07-02 15:03:14 +0000 |
commit | 04c0fb6aedd8b530745e03f63c8b188e7d2c7466 (patch) | |
tree | e3a52de1d3ede9a6386351492d792dad43688a99 /mdoc_validate.c | |
parent | 63ed1f431a924feaf23069c7881c2520fbc991ae (diff) | |
download | mandoc-04c0fb6aedd8b530745e03f63c8b188e7d2c7466.tar.gz |
Cached `An' arguments in struct mdoc_an. Note that this isn't a
pointer like the other data members, as there's no need to copy it around.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index dd70ed96..3e8e1066 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -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); } @@ -1076,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)); } |