diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-05-31 23:40:25 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-05-31 23:40:25 +0000 |
commit | ea2ceb2ee976e30f8b74c5d7c7ee5776197094f3 (patch) | |
tree | d665a2f169a9b87cef600f15cdc91897f5acfc11 | |
parent | a2ce92b30d2f8a916c5a8743ec8d24d54df8e3bd (diff) | |
download | mandoc-ea2ceb2ee976e30f8b74c5d7c7ee5776197094f3.tar.gz |
Cleanup post_bl_head() to use enum mdoc_list (avoid traversing that
list).
Reverted MANDOC_COLUMNS to be a bad-bad syntax error: we don't, and
apparently never have, allowed mixing of -column syntaxes. This would
have segfaulted if encountered.
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | mandoc.h | 2 | ||||
-rw-r--r-- | mdoc_validate.c | 23 |
4 files changed, 17 insertions, 12 deletions
@@ -59,6 +59,8 @@ flags defined for struct mdoc_macro - set a meaningful default if no `Bl' list type is assigned + +- have a blank `It' head for `Bl -tag' not puke ************************************************************************ * formatting issues: ugly output @@ -102,7 +102,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "out of order prologue", "repeated prologue entry", "list type must come first", - "column syntax is inconsistent", "bad standard", "bad library", "bad escape sequence", @@ -144,6 +143,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "no title in document", "line argument(s) will be lost", "body argument(s) will be lost", + "column syntax is inconsistent", "missing font type", "missing display type", "missing list type", @@ -31,7 +31,6 @@ enum mandocerr { MANDOCERR_PROLOGOOO, /* out of order prologue */ MANDOCERR_PROLOGREP, /* repeated prologue entry */ MANDOCERR_LISTFIRST, /* list type must come first */ - MANDOCERR_COLUMNS, /* column syntax is inconsistent */ MANDOCERR_BADSTANDARD, /* bad standard */ MANDOCERR_BADLIB, /* bad library */ MANDOCERR_BADESCAPE, /* bad escape sequence */ @@ -78,6 +77,7 @@ enum mandocerr { MANDOCERR_BODYLOST, /* body argument(s) will be lost */ #define MANDOCERR_ERROR MANDOCERR_BODYLOST + MANDOCERR_COLUMNS, /* column syntax is inconsistent */ /* FIXME: this should be a MANDOCERR_ERROR */ MANDOCERR_FONTTYPE, /* missing font type */ /* FIXME: this should be a MANDOCERR_ERROR */ diff --git a/mdoc_validate.c b/mdoc_validate.c index e8a7b191..e2e358a5 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1024,20 +1024,23 @@ post_it(POST_ARGS) static int post_bl_head(POST_ARGS) { - int i; - const struct mdoc_node *n; - const struct mdoc_argv *a; + int i; + struct mdoc_node *n; + assert(mdoc->last->parent); n = mdoc->last->parent; - assert(n->args); - for (i = 0; i < (int)n->args->argc; i++) { - a = &n->args->argv[i]; - if (a->arg == MDOC_Column) { - if (a->sz && mdoc->last->nchild) - return(mdoc_nmsg(mdoc, n, MANDOCERR_COLUMNS)); - return(1); + if (LIST_column == n->data.list) { + for (i = 0; i < (int)n->args->argc; i++) + if (MDOC_Column == n->args->argv[i].arg) + break; + assert(i < (int)n->args->argc); + + if (n->args->argv[i].sz && mdoc->last->nchild) { + mdoc_nmsg(mdoc, n, MANDOCERR_COLUMNS); + return(0); } + return(1); } if (0 == (i = mdoc->last->nchild)) |