diff options
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index 1eaa3ecd..8615ad46 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -532,8 +532,8 @@ pre_display(PRE_ARGS) static int pre_bl(PRE_ARGS) { - int i, width, comp, dup; - const char *offs; + int i, comp, dup; + const char *offs, *width; enum mdoc_list lt; if (MDOC_BLOCK != n->type) { @@ -553,13 +553,12 @@ pre_bl(PRE_ARGS) */ assert(LIST__NONE == n->data.Bl.type); - width = -1; /* LINTED */ for (i = 0; n->args && i < (int)n->args->argc; i++) { lt = LIST__NONE; dup = comp = 0; - offs = NULL; + width = offs = NULL; switch (n->args->argv[i].arg) { /* Set list types. */ case (MDOC_Bullet): @@ -601,15 +600,14 @@ pre_bl(PRE_ARGS) comp = 1; break; case (MDOC_Width): - if (width >= 0) - dup++; - width = i; + dup = (NULL != n->data.Bl.width); + width = n->args->argv[i].value[0]; break; case (MDOC_Offset): /* NB: this can be empty! */ if (n->args->argv[i].sz) { offs = n->args->argv[i].value[0]; - dup = (NULL != n->data.Bd.offs); + dup = (NULL != n->data.Bl.offs); break; } if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV)) @@ -626,6 +624,8 @@ pre_bl(PRE_ARGS) n->data.Bl.comp = comp; if (offs && ! dup) n->data.Bl.offs = offs; + if (width && ! dup) + n->data.Bl.width = width; /* Check: multiple list types. */ @@ -641,7 +641,9 @@ pre_bl(PRE_ARGS) /* The list type should come first. */ if (n->data.Bl.type == LIST__NONE) - if (width >= 0 || n->data.Bl.offs || n->data.Bl.comp) + if (n->data.Bl.width || + n->data.Bl.offs || + n->data.Bl.comp) if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST)) return(0); @@ -664,7 +666,7 @@ pre_bl(PRE_ARGS) switch (n->data.Bl.type) { case (LIST_tag): - if (width >= 0) + if (n->data.Bl.width) break; if (mdoc_nmsg(mdoc, n, MANDOCERR_NOWIDTHARG)) break; @@ -678,7 +680,7 @@ pre_bl(PRE_ARGS) case (LIST_inset): /* FALLTHROUGH */ case (LIST_item): - if (width < 0) + if (NULL == n->data.Bl.width) break; if (mdoc_nmsg(mdoc, n, MANDOCERR_WIDTHARG)) break; |