Also convert man_vmsg to return void.
-/* $Id: libman.h,v 1.45 2011/01/12 10:43:22 kristaps Exp $ */
+/* $Id: libman.h,v 1.46 2011/03/17 11:56:17 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
#define ARGS_EOLN (0)
#define ARGS_WORD (1)
#define ARGS_QWORD (1)
-int man_vmsg(struct man *, enum mandocerr,
+void man_vmsg(struct man *, enum mandocerr,
int, int, const char *, ...);
int man_valid_post(struct man *);
int man_valid_pre(struct man *, struct man_node *);
-/* $Id: man.c,v 1.102 2011/03/07 01:35:51 schwarze Exp $ */
+/* $Id: man.c,v 1.103 2011/03/17 11:56:17 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
}
-int
+void
man_vmsg(struct man *man, enum mandocerr t,
int ln, int pos, const char *fmt, ...)
{
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
va_end(ap);
- return((*man->msg)(t, man->data, ln, pos, buf));
+ (*man->msg)(t, man->data, ln, pos, buf);
}
-/* $Id: man_macro.c,v 1.55 2011/01/12 16:55:22 kristaps Exp $ */
+/* $Id: man_macro.c,v 1.56 2011/03/17 11:56:17 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
const struct man_node *);
static enum rew rew_block(enum mant, enum man_type,
const struct man_node *);
-static int rew_warn(struct man *,
+static void rew_warn(struct man *,
struct man_node *, enum mandocerr);
const struct man_macro __man_macros[MAN_MAX] = {
/*
* Warn when "n" is an explicit non-roff macro.
*/
-static int
+static void
rew_warn(struct man *m, struct man_node *n, enum mandocerr er)
{
if (er == MANDOCERR_MAX || MAN_BLOCK != n->type)
- return(1);
+ return;
if (MAN_VALID & n->flags)
- return(1);
+ return;
if ( ! (MAN_EXPLICIT & man_macros[n->tok].flags))
- return(1);
- return(man_nmsg(m, n, er));
+ return;
+
+ assert(er < MANDOCERR_FATAL);
+ man_nmsg(m, n, er);
}
* out to be lost.
*/
n = m->last->parent;
- if ( ! rew_warn(m, m->last, er))
- return(0);
+ rew_warn(m, m->last, er);
if ( ! man_valid_post(m))
return(0);
m->last = n;
assert(m->last);
}
- if ( ! rew_warn(m, m->last, er))
- return(0);
+ rew_warn(m, m->last, er);
if ( ! man_valid_post(m))
return(0);
break;
if (NULL == nn)
- if ( ! man_pmsg(m, line, ppos, MANDOCERR_NOSCOPE))
- return(0);
+ man_pmsg(m, line, ppos, MANDOCERR_NOSCOPE);
if ( ! rew_scope(MAN_BODY, m, ntok))
return(0);
-/* $Id: man_validate.c,v 1.63 2011/03/07 01:35:51 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.64 2011/03/17 11:56:17 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
if ('\t' == *p) {
if (MAN_LITERAL & m->flags)
continue;
- if (man_pmsg(m, n->line, pos, MANDOCERR_BADTAB))
- continue;
- return(0);
+ man_pmsg(m, n->line, pos, MANDOCERR_BADTAB);
+ continue;
}
/* Check the special character. */