summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2009-07-12 21:08:30 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2009-07-12 21:08:30 +0000
commit411df6592d91b72d1e98d0e50a1012477f3ca312 (patch)
tree536780d7c650d2deb6798423b703fe1ad38fb41d /usr.bin/mandoc
parent475001105e136851bef0c0389f449eb102901714 (diff)
sync to 1.7.23: pass error code to mdoc_nerr() instead of error string
and use the so improved mdoc_nerr() at many places
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/libmdoc.h10
-rw-r--r--usr.bin/mandoc/mdoc.c27
-rw-r--r--usr.bin/mandoc/mdoc_action.c52
-rw-r--r--usr.bin/mandoc/mdoc_argv.c38
-rw-r--r--usr.bin/mandoc/mdoc_macro.c4
-rw-r--r--usr.bin/mandoc/mdoc_validate.c62
6 files changed, 85 insertions, 108 deletions
diff --git a/usr.bin/mandoc/libmdoc.h b/usr.bin/mandoc/libmdoc.h
index a2b604b3f6f..861b891c2dc 100644
--- a/usr.bin/mandoc/libmdoc.h
+++ b/usr.bin/mandoc/libmdoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmdoc.h,v 1.10 2009/07/12 20:30:27 schwarze Exp $ */
+/* $Id: libmdoc.h,v 1.11 2009/07/12 21:08:29 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -118,16 +118,12 @@ extern const struct mdoc_macro *const mdoc_macros;
__BEGIN_DECLS
-/*
- * When GCC2 is deprecated, most of these can be reverted to #define
- * as mdoc_vXXX using __VA_ARGS__. Until then, use real functions.
- */
-int mdoc_nerr(struct mdoc *, const struct mdoc_node *,
- const char *, ...);
int mdoc_warn(struct mdoc *, enum mdoc_warn, const char *, ...);
int mdoc_pwarn(struct mdoc *, int, int,
enum mdoc_warn,const char *, ...);
int mdoc_perr(struct mdoc *, int, int, const char *, ...);
+#define mdoc_nerr(m, n, t) \
+ mdoc_err((m), (n)->line, (n)->pos, 0, (t))
int mdoc_err(struct mdoc *, int, int, int, enum merr);
int mdoc_verr(struct mdoc *, int, int, const char *, ...);
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index 5b90dbb41bf..e780ff806cf 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.14 2009/07/12 20:30:27 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.15 2009/07/12 21:08:29 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -329,24 +329,6 @@ mdoc_vwarn(struct mdoc *mdoc, int ln, int pos, const char *fmt, ...)
int
-mdoc_nerr(struct mdoc *mdoc, const struct mdoc_node *node,
- const char *fmt, ...)
-{
- char buf[256];
- va_list ap;
-
- if (NULL == mdoc->cb.mdoc_err)
- return(0);
-
- va_start(ap, fmt);
- (void)vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
- va_end(ap);
- return((*mdoc->cb.mdoc_err)(mdoc->data,
- node->line, node->pos, buf));
-}
-
-
-int
mdoc_warn(struct mdoc *mdoc, enum mdoc_warn type,
const char *fmt, ...)
{
@@ -534,8 +516,7 @@ node_alloc(struct mdoc *mdoc, int line,
struct mdoc_node *p;
if (NULL == (p = calloc(1, sizeof(struct mdoc_node)))) {
- (void)perr(mdoc, (mdoc)->last->line,
- (mdoc)->last->pos, EMALLOC);
+ (void)mdoc_nerr(mdoc, mdoc->last, EMALLOC);
return(NULL);
}
@@ -631,10 +612,10 @@ mdoc_word_alloc(struct mdoc *mdoc,
if (NULL == p)
return(0);
if (NULL == (p->string = strdup(word))) {
- (void)perr(mdoc, (mdoc)->last->line,
- (mdoc)->last->pos, EMALLOC);
+ (void)mdoc_nerr(mdoc, mdoc->last, EMALLOC);
return(0);
}
+
return(node_append(mdoc, p));
}
diff --git a/usr.bin/mandoc/mdoc_action.c b/usr.bin/mandoc/mdoc_action.c
index 0acaef68a08..042ca6e1927 100644
--- a/usr.bin/mandoc/mdoc_action.c
+++ b/usr.bin/mandoc/mdoc_action.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_action.c,v 1.11 2009/07/12 20:30:27 schwarze Exp $ */
+/* $Id: mdoc_action.c,v 1.12 2009/07/12 21:08:29 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -237,11 +237,11 @@ concat(struct mdoc *m, const struct mdoc_node *n,
for ( ; n; n = n->next) {
assert(MDOC_TEXT == n->type);
if (strlcat(buf, n->string, sz) >= sz)
- return(nerr(m, n, ETOOLONG));
+ return(mdoc_nerr(m, n, ETOOLONG));
if (NULL == n->next)
continue;
if (strlcat(buf, " ", sz) >= sz)
- return(nerr(m, n, ETOOLONG));
+ return(mdoc_nerr(m, n, ETOOLONG));
}
return(1);
@@ -316,12 +316,12 @@ post_std(POST_ARGS)
m->last->args->argv[0].value = calloc(1, sizeof(char *));
if (NULL == m->last->args->argv[0].value)
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
m->last->args->argv[0].sz = 1;
m->last->args->argv[0].value[0] = strdup(m->meta.name);
if (NULL == m->last->args->argv[0].value[0])
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
return(1);
}
@@ -340,7 +340,7 @@ post_nm(POST_ARGS)
return(0);
if (NULL == (m->meta.name = strdup(buf)))
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
return(1);
}
@@ -413,9 +413,9 @@ post_dt(POST_ARGS)
if (NULL == (n = m->last->child)) {
if (NULL == (m->meta.title = strdup("unknown")))
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
if (NULL == (m->meta.vol = strdup("local")))
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
return(post_prol(m));
}
@@ -424,11 +424,11 @@ post_dt(POST_ARGS)
*/
if (NULL == (m->meta.title = strdup(n->string)))
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
if (NULL == (n = n->next)) {
if (NULL == (m->meta.vol = strdup("local")))
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
return(post_prol(m));
}
@@ -442,13 +442,13 @@ post_dt(POST_ARGS)
cp = mdoc_a2msec(n->string);
if (cp) {
if (NULL == (m->meta.vol = strdup(cp)))
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
errno = 0;
lval = strtol(n->string, &ep, 10);
if (n->string[0] != '\0' && *ep == '\0')
m->meta.msec = (int)lval;
} else if (NULL == (m->meta.vol = strdup(n->string)))
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
if (NULL == (n = n->next))
return(post_prol(m));
@@ -464,16 +464,16 @@ post_dt(POST_ARGS)
if (cp) {
free(m->meta.vol);
if (NULL == (m->meta.vol = strdup(cp)))
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
n = n->next;
} else {
cp = mdoc_a2arch(n->string);
if (NULL == cp) {
free(m->meta.vol);
if (NULL == (m->meta.vol = strdup(n->string)))
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
} else if (NULL == (m->meta.arch = strdup(cp)))
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
}
/* Ignore any subsequent parameters... */
@@ -497,17 +497,17 @@ post_os(POST_ARGS)
if (0 == buf[0]) {
if (-1 == uname(&utsname))
- return(verr(m, EUTSNAME));
+ return(mdoc_nerr(m, m->last, EUTSNAME));
if (strlcat(buf, utsname.sysname, 64) >= 64)
- return(verr(m, ETOOLONG));
+ return(mdoc_nerr(m, m->last, ETOOLONG));
if (strlcat(buf, " ", 64) >= 64)
- return(verr(m, ETOOLONG));
+ return(mdoc_nerr(m, m->last, ETOOLONG));
if (strlcat(buf, utsname.release, 64) >= 64)
- return(verr(m, ETOOLONG));
+ return(mdoc_nerr(m, m->last, ETOOLONG));
}
if (NULL == (m->meta.os = strdup(buf)))
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
m->flags |= MDOC_PBODY;
return(post_prol(m));
@@ -549,7 +549,7 @@ post_bl_tagwidth(struct mdoc *m)
}
if (-1 == snprintf(buf, sizeof(buf), "%dn", sz))
- return(verr(m, ENUMFMT));
+ return(mdoc_nerr(m, m->last, ENUMFMT));
/*
* We have to dynamically add this to the macro's argument list.
@@ -564,7 +564,7 @@ post_bl_tagwidth(struct mdoc *m)
n->args->argc * sizeof(struct mdoc_argv));
if (NULL == n->args->argv)
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
n->args->argv[sz].arg = MDOC_Width;
n->args->argv[sz].line = m->last->line;
@@ -573,9 +573,9 @@ post_bl_tagwidth(struct mdoc *m)
n->args->argv[sz].value = calloc(1, sizeof(char *));
if (NULL == n->args->argv[sz].value)
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
if (NULL == (n->args->argv[sz].value[0] = strdup(buf)))
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
return(1);
}
@@ -615,12 +615,12 @@ post_bl_width(struct mdoc *m)
/* The value already exists: free and reallocate it. */
if (-1 == snprintf(buf, sizeof(buf), "%zun", width))
- return(verr(m, ENUMFMT));
+ return(mdoc_nerr(m, m->last, ENUMFMT));
free(m->last->args->argv[i].value[0]);
m->last->args->argv[i].value[0] = strdup(buf);
if (NULL == m->last->args->argv[i].value[0])
- return(verr(m, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
return(1);
}
diff --git a/usr.bin/mandoc/mdoc_argv.c b/usr.bin/mandoc/mdoc_argv.c
index 5a36765d718..89cfdc3845f 100644
--- a/usr.bin/mandoc/mdoc_argv.c
+++ b/usr.bin/mandoc/mdoc_argv.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_argv.c,v 1.5 2009/07/12 20:30:27 schwarze Exp $ */
+/* $Id: mdoc_argv.c,v 1.6 2009/07/12 21:08:29 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -229,7 +229,7 @@ static int mdoc_argflags[MDOC_MAX] = {
* one mandatory value, an optional single value, or no value.
*/
int
-mdoc_argv(struct mdoc *mdoc, int line, int tok,
+mdoc_argv(struct mdoc *m, int line, int tok,
struct mdoc_arg **v, int *pos, char *buf)
{
int i;
@@ -278,7 +278,7 @@ mdoc_argv(struct mdoc *mdoc, int line, int tok,
/* XXX - restore saved zeroed byte. */
if (sv)
buf[*pos - 1] = sv;
- if ( ! pwarn(mdoc, line, i, WARGVPARM))
+ if ( ! pwarn(m, line, i, WARGVPARM))
return(ARGV_ERROR);
return(ARGV_WORD);
}
@@ -286,13 +286,13 @@ mdoc_argv(struct mdoc *mdoc, int line, int tok,
while (buf[*pos] && ' ' == buf[*pos])
(*pos)++;
- if ( ! argv(mdoc, line, &tmp, pos, buf))
+ if ( ! argv(m, line, &tmp, pos, buf))
return(ARGV_ERROR);
if (NULL == (arg = *v)) {
*v = calloc(1, sizeof(struct mdoc_arg));
if (NULL == *v) {
- (void)verr(mdoc, EMALLOC);
+ (void)mdoc_nerr(m, m->last, EMALLOC);
return(ARGV_ERROR);
}
arg = *v;
@@ -303,7 +303,7 @@ mdoc_argv(struct mdoc *mdoc, int line, int tok,
sizeof(struct mdoc_argv));
if (NULL == arg->argv) {
- (void)verr(mdoc, EMALLOC);
+ (void)mdoc_nerr(m, m->last, EMALLOC);
return(ARGV_ERROR);
}
@@ -747,7 +747,7 @@ argv_a2arg(int tok, const char *argv)
static int
-argv_multi(struct mdoc *mdoc, int line,
+argv_multi(struct mdoc *m, int line,
struct mdoc_argv *v, int *pos, char *buf)
{
int c;
@@ -756,7 +756,7 @@ argv_multi(struct mdoc *mdoc, int line,
for (v->sz = 0; ; v->sz++) {
if ('-' == buf[*pos])
break;
- c = args(mdoc, line, pos, buf, ARGS_QUOTED, &p);
+ c = args(m, line, pos, buf, ARGS_QUOTED, &p);
if (ARGS_ERROR == c)
return(0);
else if (ARGS_EOLN == c)
@@ -766,12 +766,12 @@ argv_multi(struct mdoc *mdoc, int line,
v->value = realloc(v->value,
(v->sz + MULTI_STEP) * sizeof(char *));
if (NULL == v->value) {
- (void)verr(mdoc, EMALLOC);
+ (void)mdoc_nerr(m, m->last, EMALLOC);
return(ARGV_ERROR);
}
}
if (NULL == (v->value[(int)v->sz] = strdup(p)))
- return(verr(mdoc, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
}
return(1);
@@ -779,7 +779,7 @@ argv_multi(struct mdoc *mdoc, int line,
static int
-argv_opt_single(struct mdoc *mdoc, int line,
+argv_opt_single(struct mdoc *m, int line,
struct mdoc_argv *v, int *pos, char *buf)
{
int c;
@@ -788,7 +788,7 @@ argv_opt_single(struct mdoc *mdoc, int line,
if ('-' == buf[*pos])
return(1);
- c = args(mdoc, line, pos, buf, ARGS_QUOTED, &p);
+ c = args(m, line, pos, buf, ARGS_QUOTED, &p);
if (ARGS_ERROR == c)
return(0);
if (ARGS_EOLN == c)
@@ -796,9 +796,9 @@ argv_opt_single(struct mdoc *mdoc, int line,
v->sz = 1;
if (NULL == (v->value = calloc(1, sizeof(char *))))
- return(verr(mdoc, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
if (NULL == (v->value[0] = strdup(p)))
- return(verr(mdoc, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
return(1);
}
@@ -808,7 +808,7 @@ argv_opt_single(struct mdoc *mdoc, int line,
* Parse a single, mandatory value from the stream.
*/
static int
-argv_single(struct mdoc *mdoc, int line,
+argv_single(struct mdoc *m, int line,
struct mdoc_argv *v, int *pos, char *buf)
{
int c, ppos;
@@ -816,17 +816,17 @@ argv_single(struct mdoc *mdoc, int line,
ppos = *pos;
- c = args(mdoc, line, pos, buf, ARGS_QUOTED, &p);
+ c = args(m, line, pos, buf, ARGS_QUOTED, &p);
if (ARGS_ERROR == c)
return(0);
if (ARGS_EOLN == c)
- return(perr(mdoc, line, ppos, EARGVAL));
+ return(perr(m, line, ppos, EARGVAL));
v->sz = 1;
if (NULL == (v->value = calloc(1, sizeof(char *))))
- return(verr(mdoc, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
if (NULL == (v->value[0] = strdup(p)))
- return(verr(mdoc, EMALLOC));
+ return(mdoc_nerr(m, m->last, EMALLOC));
return(1);
}
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index 16bc80b0163..7eabfdbd04b 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.7 2009/07/12 20:30:27 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.8 2009/07/12 21:08:29 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -305,7 +305,7 @@ mdoc_macroend(struct mdoc *mdoc)
continue;
if ( ! (MDOC_EXPLICIT & mdoc_macros[n->tok].flags))
continue;
- return(nerr(mdoc, n, EOPEN));
+ return(mdoc_nerr(mdoc, n, EOPEN));
}
return(rew_last(mdoc, mdoc->first));
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 1cf5dffcb85..14a9d1ec6e4 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.18 2009/07/12 20:30:27 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.19 2009/07/12 21:08:29 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -669,7 +669,7 @@ check_argv(struct mdoc *m, const struct mdoc_node *n,
/* `Nm' name must be set. */
if (v->sz || m->meta.name)
return(1);
- return(nerr(m, n, ENAME));
+ return(mdoc_nerr(m, n, ENAME));
}
return(1);
@@ -744,7 +744,7 @@ pre_display(PRE_ARGS)
if (NULL == node)
return(1);
- return(nerr(mdoc, n, ENESTDISP));
+ return(mdoc_nerr(mdoc, n, ENESTDISP));
}
@@ -756,7 +756,7 @@ pre_bl(PRE_ARGS)
if (MDOC_BLOCK != n->type)
return(1);
if (NULL == n->args)
- return(nerr(mdoc, n, ELISTTYPE));
+ return(mdoc_nerr(mdoc, n, ELISTTYPE));
/* Make sure that only one type of list is specified. */
@@ -787,17 +787,17 @@ pre_bl(PRE_ARGS)
/* FALLTHROUGH */
case (MDOC_Column):
if (-1 != type)
- return(nerr(mdoc, n, EMULTILIST));
+ return(mdoc_nerr(mdoc, n, EMULTILIST));
type = n->args->argv[pos].arg;
break;
case (MDOC_Width):
if (-1 != width)
- return(nerr(mdoc, n, EARGREP));
+ return(mdoc_nerr(mdoc, n, EARGREP));
width = n->args->argv[pos].arg;
break;
case (MDOC_Offset):
if (-1 != offset)
- return(nerr(mdoc, n, EARGREP));
+ return(mdoc_nerr(mdoc, n, EARGREP));
offset = n->args->argv[pos].arg;
break;
default:
@@ -805,7 +805,7 @@ pre_bl(PRE_ARGS)
}
if (-1 == type)
- return(nerr(mdoc, n, ELISTTYPE));
+ return(mdoc_nerr(mdoc, n, ELISTTYPE));
/*
* Validate the width field. Some list types don't need width
@@ -844,7 +844,7 @@ pre_bd(PRE_ARGS)
if (MDOC_BLOCK != n->type)
return(1);
if (NULL == n->args)
- return(nerr(mdoc, n, EDISPTYPE));
+ return(mdoc_nerr(mdoc, n, EDISPTYPE));
/* Make sure that only one type of display is specified. */
@@ -863,14 +863,14 @@ pre_bd(PRE_ARGS)
case (MDOC_File):
if (0 == type++)
break;
- return(nerr(mdoc, n, EMULTIDISP));
+ return(mdoc_nerr(mdoc, n, EMULTIDISP));
default:
break;
}
if (type)
return(1);
- return(nerr(mdoc, n, EDISPTYPE));
+ return(mdoc_nerr(mdoc, n, EDISPTYPE));
}
@@ -1013,12 +1013,12 @@ post_bf(POST_ARGS)
head = mdoc->last->head;
if (mdoc->last->args && head->child)
- return(mdoc_nerr(mdoc, mdoc->last, "one argument expected"));
+ return(mdoc_nerr(mdoc, mdoc->last, ELINE));
else if (mdoc->last->args)
return(1);
if (NULL == head->child || MDOC_TEXT != head->child->type)
- return(mdoc_nerr(mdoc, mdoc->last, "text argument expected"));
+ return(mdoc_nerr(mdoc, mdoc->last, ELINE));
p = head->child->string;
@@ -1029,7 +1029,7 @@ post_bf(POST_ARGS)
else if (0 == strcmp(p, "Sm"))
return(1);
- return(mdoc_nerr(mdoc, head->child, "invalid font mode"));
+ return(mdoc_nerr(mdoc, head, EFONT));
}
@@ -1041,7 +1041,7 @@ post_nm(POST_ARGS)
return(1);
if (mdoc->meta.name)
return(1);
- return(verr(mdoc, ENAME));
+ return(mdoc_nerr(mdoc, mdoc->last, ENAME));
}
@@ -1052,10 +1052,10 @@ post_at(POST_ARGS)
if (NULL == mdoc->last->child)
return(1);
if (MDOC_TEXT != mdoc->last->child->type)
- return(verr(mdoc, EATT));
+ return(mdoc_nerr(mdoc, mdoc->last, EATT));
if (mdoc_a2att(mdoc->last->child->string))
return(1);
- return(verr(mdoc, EATT));
+ return(mdoc_nerr(mdoc, mdoc->last, EATT));
}
@@ -1066,12 +1066,12 @@ post_an(POST_ARGS)
if (mdoc->last->args) {
if (NULL == mdoc->last->child)
return(1);
- return(verr(mdoc, ELINE));
+ return(mdoc_nerr(mdoc, mdoc->last, ELINE));
}
if (mdoc->last->child)
return(1);
- return(verr(mdoc, ELINE));
+ return(mdoc_nerr(mdoc, mdoc->last, ELINE));
}
@@ -1081,7 +1081,7 @@ post_args(POST_ARGS)
if (mdoc->last->args)
return(1);
- return(verr(mdoc, ELINE));
+ return(mdoc_nerr(mdoc, mdoc->last, ELINE));
}
@@ -1096,7 +1096,7 @@ post_it(POST_ARGS)
n = mdoc->last->parent->parent;
if (NULL == n->args)
- return(verr(mdoc, ELISTTYPE));
+ return(mdoc_nerr(mdoc, mdoc->last, ELISTTYPE));
/* Some types require block-head, some not. */
@@ -1134,7 +1134,7 @@ post_it(POST_ARGS)
}
if (-1 == type)
- return(verr(mdoc, ELISTTYPE));
+ return(mdoc_nerr(mdoc, mdoc->last, ELISTTYPE));
switch (type) {
case (MDOC_Tag):
@@ -1212,7 +1212,7 @@ post_bl_head(POST_ARGS)
return(1);
if (n->args->argv[i].sz && mdoc->last->child)
- return(nerr(mdoc, n, ECOLMIS));
+ return(mdoc_nerr(mdoc, n, ECOLMIS));
return(1);
}
@@ -1262,7 +1262,7 @@ ebool(struct mdoc *mdoc)
if (NULL == n)
return(1);
- return(nerr(mdoc, n, EBOOL));
+ return(mdoc_nerr(mdoc, n, EBOOL));
}
@@ -1271,14 +1271,14 @@ post_root(POST_ARGS)
{
if (NULL == mdoc->first->child)
- return(verr(mdoc, ENODAT));
+ return(mdoc_nerr(mdoc, mdoc->first, ENODAT));
if ( ! (MDOC_PBODY & mdoc->flags))
- return(verr(mdoc, ENOPROLOGUE));
+ return(mdoc_nerr(mdoc, mdoc->first, ENOPROLOGUE));
if (MDOC_BLOCK != mdoc->first->child->type)
- return(verr(mdoc, ENODAT));
+ return(mdoc_nerr(mdoc, mdoc->first, ENODAT));
if (MDOC_Sh != mdoc->first->child->tok)
- return(verr(mdoc, ENODAT));
+ return(mdoc_nerr(mdoc, mdoc->first, ENODAT));
return(1);
}
@@ -1360,11 +1360,11 @@ post_sh_head(POST_ARGS)
assert(MDOC_TEXT == n->type);
if (strlcat(buf, n->string, 64) >= 64)
- return(nerr(mdoc, n, ETOOLONG));
+ return(mdoc_nerr(mdoc, n, ETOOLONG));
if (NULL == n->next)
continue;
if (strlcat(buf, " ", 64) >= 64)
- return(nerr(mdoc, n, ETOOLONG));
+ return(mdoc_nerr(mdoc, n, ETOOLONG));
}
sec = mdoc_atosec(buf);
@@ -1375,7 +1375,7 @@ post_sh_head(POST_ARGS)
*/
if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed)
- return(verr(mdoc, ESECNAME));
+ return(mdoc_nerr(mdoc, mdoc->last, ESECNAME));
if (SEC_CUSTOM == sec)
return(1);
if (sec == mdoc->lastnamed)