-/* $Id: man_validate.c,v 1.91 2014/04/20 16:46:04 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.96 2014/07/02 11:43:20 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
man->flags &= ~MAN_BLINE;
man->flags &= ~MAN_ELINE;
- if (NULL == man->first->child) {
- man_nmsg(man, n, MANDOCERR_NODOCBODY);
- return(0);
- } else if (NULL == man->meta.title) {
- man_nmsg(man, n, MANDOCERR_NOTITLE);
+ if (NULL == man->first->child)
+ man_nmsg(man, n, MANDOCERR_DOC_EMPTY);
+ else
+ man->meta.hasbody = 1;
+
+ if (NULL == man->meta.title) {
+ man_nmsg(man, n, MANDOCERR_TH_MISSING);
/*
* If a title hasn't been set, do so now (by
break;
case MAN_BODY:
if (0 == n->nchild)
- man_nmsg(man, n, MANDOCERR_IGNPAR);
+ mandoc_vmsg(MANDOCERR_PAR_SKIP,
+ man->parse, n->line, n->pos,
+ "%s empty", man_macronames[n->tok]);
break;
case MAN_HEAD:
if (n->nchild)
break;
case MAN_BODY:
if (0 == n->parent->head->nchild && 0 == n->nchild)
- man_nmsg(man, n, MANDOCERR_IGNPAR);
+ mandoc_vmsg(MANDOCERR_PAR_SKIP,
+ man->parse, n->line, n->pos,
+ "%s empty", man_macronames[n->tok]);
break;
default:
break;
static int
post_TH(CHKARGS)
{
+ struct man_node *nb;
const char *p;
free(man->meta.title);
man->meta.title = man->meta.vol = man->meta.date =
man->meta.msec = man->meta.source = NULL;
+ nb = n;
+
/* ->TITLE<- MSEC DATE SOURCE VOL */
n = n->child;
/* Only warn about this once... */
if (isalpha((unsigned char)*p) &&
! isupper((unsigned char)*p)) {
- man_nmsg(man, n, MANDOCERR_UPPERCASE);
+ mandoc_msg(MANDOCERR_TITLE_CASE,
+ man->parse, n->line,
+ n->pos + (p - n->string),
+ n->string);
break;
}
}
mandoc_strdup(n->string) :
mandoc_normdate(man->parse, n->string,
n->line, n->pos);
- } else
+ } else {
man->meta.date = mandoc_strdup("");
+ man_nmsg(man, n ? n : nb, MANDOCERR_DATE_MISSING);
+ }
/* TITLE MSEC DATE ->SOURCE<- VOL */
{
if (MAN_LITERAL & man->flags)
- man_nmsg(man, n, MANDOCERR_SCOPEREP);
+ man_nmsg(man, n, MANDOCERR_NF_SKIP);
man->flags |= MAN_LITERAL;
return(1);
{
if ( ! (MAN_LITERAL & man->flags))
- man_nmsg(man, n, MANDOCERR_WNOSCOPE);
+ man_nmsg(man, n, MANDOCERR_FI_SKIP);
man->flags &= ~MAN_LITERAL;
return(1);
case MAN_SH:
/* FALLTHROUGH */
case MAN_SS:
- man_nmsg(man, n, MANDOCERR_IGNPAR);
+ mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse, n->line, n->pos,
+ "%s after %s", man_macronames[n->tok],
+ man_macronames[n->parent->tok]);
/* FALLTHROUGH */
case MAN_MAX:
/*