diff options
-rw-r--r-- | libmdoc.h | 2 | ||||
-rw-r--r-- | mdoc.c | 4 | ||||
-rw-r--r-- | mdoc_macro.c | 19 | ||||
-rw-r--r-- | mdoc_validate.c | 13 |
4 files changed, 18 insertions, 20 deletions
@@ -89,7 +89,7 @@ __BEGIN_DECLS (*(m)->msg)((t), (m)->data, (l), (p), NULL) #define mdoc_nmsg(m, n, t) \ (*(m)->msg)((t), (m)->data, (n)->line, (n)->pos, NULL) -int mdoc_vmsg(struct mdoc *, enum mandocerr, +void mdoc_vmsg(struct mdoc *, enum mandocerr, int, int, const char *, ...); int mdoc_macro(MACRO_PROT_ARGS); int mdoc_word_alloc(struct mdoc *, @@ -303,7 +303,7 @@ mdoc_parseln(struct mdoc *m, int ln, char *buf, int offs) } -int +void mdoc_vmsg(struct mdoc *mdoc, enum mandocerr t, int ln, int pos, const char *fmt, ...) { @@ -314,7 +314,7 @@ mdoc_vmsg(struct mdoc *mdoc, enum mandocerr t, vsnprintf(buf, sizeof(buf) - 1, fmt, ap); va_end(ap); - return((*mdoc->msg)(t, mdoc->data, ln, pos, buf)); + (*mdoc->msg)(t, mdoc->data, ln, pos, buf); } diff --git a/mdoc_macro.c b/mdoc_macro.c index 74e80d19..d1354c6e 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -710,8 +710,7 @@ blk_exp_close(MACRO_PROT_ARGS) if ( ! (MDOC_CALLABLE & mdoc_macros[tok].flags)) { /* FIXME: do this in validate */ if (buf[*pos]) - if ( ! mdoc_pmsg(m, line, ppos, MANDOCERR_ARGSLOST)) - return(0); + mdoc_pmsg(m, line, ppos, MANDOCERR_ARGSLOST); if ( ! rew_sub(MDOC_BODY, m, tok, line, ppos)) return(0); @@ -854,9 +853,9 @@ in_line(MACRO_PROT_ARGS) return(0); } else if ( ! nc && 0 == cnt) { mdoc_argv_free(arg); - if ( ! mdoc_pmsg(m, line, ppos, MANDOCERR_MACROEMPTY)) - return(0); + mdoc_pmsg(m, line, ppos, MANDOCERR_MACROEMPTY); } + if ( ! mdoc_macro(m, ntok, line, la, pos, buf)) return(0); if ( ! nl) @@ -936,8 +935,7 @@ in_line(MACRO_PROT_ARGS) return(0); } else if ( ! nc && 0 == cnt) { mdoc_argv_free(arg); - if ( ! mdoc_pmsg(m, line, ppos, MANDOCERR_MACROEMPTY)) - return(0); + mdoc_pmsg(m, line, ppos, MANDOCERR_MACROEMPTY); } if ( ! nl) @@ -1299,9 +1297,9 @@ blk_part_imp(MACRO_PROT_ARGS) * is ugly behaviour nodding its head to OpenBSD's overwhelming * crufty use of `Op' breakage. */ - if (n != body && ! mdoc_vmsg(m, MANDOCERR_SCOPENEST, - line, ppos, "%s broken", mdoc_macronames[tok])) - return(0); + if (n != body) + mdoc_vmsg(m, MANDOCERR_SCOPENEST, line, ppos, + "%s broken", mdoc_macronames[tok]); if (n && ! rew_sub(MDOC_BODY, m, tok, line, ppos)) return(0); @@ -1673,7 +1671,8 @@ static int obsolete(MACRO_PROT_ARGS) { - return(mdoc_pmsg(m, line, ppos, MANDOCERR_MACROOBS)); + mdoc_pmsg(m, line, ppos, MANDOCERR_MACROOBS); + return(1); } diff --git a/mdoc_validate.c b/mdoc_validate.c index 4e3373af..442c08a2 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -446,10 +446,10 @@ check_count(struct mdoc *m, enum mdoc_type type, } t = lvl == CHECK_WARN ? MANDOCERR_ARGCWARN : MANDOCERR_ARGCOUNT; - - return(mdoc_vmsg(m, t, m->last->line, m->last->pos, + mdoc_vmsg(m, t, m->last->line, m->last->pos, "want %s%d children (have %d)", - p, val, m->last->nchild)); + p, val, m->last->nchild); + return(1); } static int @@ -1266,7 +1266,7 @@ post_an(POST_ARGS) static int post_it(POST_ARGS) { - int i, cols, rc; + int i, cols; enum mdoc_list lt; struct mdoc_node *n, *c; enum mandocerr er; @@ -1332,10 +1332,9 @@ post_it(POST_ARGS) else er = MANDOCERR_SYNTARGCOUNT; - rc = mdoc_vmsg(mdoc, er, - mdoc->last->line, mdoc->last->pos, + mdoc_vmsg(mdoc, er, mdoc->last->line, mdoc->last->pos, "columns == %d (have %d)", cols, i); - return(rc); + return(MANDOCERR_ARGCOUNT == er); default: break; } |