summaryrefslogtreecommitdiffstats
path: root/man_validate.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-12-06 13:56:56 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-12-06 13:56:56 +0000
commitb297bfbc45f8193482ea6e6a7ca368c304dc5541 (patch)
tree68a3f6c35503a59add942e6ebcf96941f2f05c4e /man_validate.c
parentb1b0aae37dcfbf9c43a595aa139982d182ea8e9a (diff)
downloadmandoc-b297bfbc45f8193482ea6e6a7ca368c304dc5541.tar.gz
Make return(man_nmsg(...)) by a simple declaration.
Make non-uppercase warning only occur once. Make scope-open-on-error warning only occur once.
Diffstat (limited to 'man_validate.c')
-rw-r--r--man_validate.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/man_validate.c b/man_validate.c
index f345e595..66e1795b 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -163,9 +163,9 @@ check_root(CHKARGS)
{
if (MAN_BLINE & m->flags)
- return(man_nmsg(m, n, MANDOCERR_SCOPEEXIT));
- if (MAN_ELINE & m->flags)
- return(man_nmsg(m, n, MANDOCERR_SCOPEEXIT));
+ man_nmsg(m, n, MANDOCERR_SCOPEEXIT);
+ else if (MAN_ELINE & m->flags)
+ man_nmsg(m, n, MANDOCERR_SCOPEEXIT);
m->flags &= ~MAN_BLINE;
m->flags &= ~MAN_ELINE;
@@ -174,14 +174,13 @@ check_root(CHKARGS)
man_nmsg(m, n, MANDOCERR_NODOCBODY);
return(0);
} else if (NULL == m->meta.title) {
- if ( ! man_nmsg(m, n, MANDOCERR_NOTITLE))
- return(0);
+ man_nmsg(m, n, MANDOCERR_NOTITLE);
+
/*
* If a title hasn't been set, do so now (by
* implication, date and section also aren't set).
- *
- * FIXME: this should be in man_action.c.
*/
+
m->meta.title = mandoc_strdup("unknown");
m->meta.date = time(NULL);
m->meta.msec = mandoc_strdup("1");
@@ -204,9 +203,11 @@ check_title(CHKARGS)
}
for (p = n->child->string; '\0' != *p; p++)
- if (isalpha((u_char)*p) && ! isupper((u_char)*p))
- if ( ! man_nmsg(m, n, MANDOCERR_UPPERCASE))
- return(0);
+ /* Only warn about this once... */
+ if (isalpha((u_char)*p) && ! isupper((u_char)*p)) {
+ man_nmsg(m, n, MANDOCERR_UPPERCASE);
+ break;
+ }
return(1);
}
@@ -276,7 +277,7 @@ check_sec(CHKARGS)
man_nmsg(m, n, MANDOCERR_SYNTARGCOUNT);
return(0);
} else if (MAN_BODY == n->type && 0 == n->nchild)
- return(man_nmsg(m, n, MANDOCERR_NOBODY));
+ man_nmsg(m, n, MANDOCERR_NOBODY);
return(1);
}
@@ -287,7 +288,8 @@ check_part(CHKARGS)
{
if (MAN_BODY == n->type && 0 == n->nchild)
- return(man_nmsg(m, n, MANDOCERR_NOBODY));
+ man_nmsg(m, n, MANDOCERR_NOBODY);
+
return(1);
}
@@ -306,9 +308,9 @@ check_par(CHKARGS)
/* Body-less lists are ok. */
break;
default:
- if (n->nchild)
- break;
- return(man_nmsg(m, n, MANDOCERR_NOBODY));
+ if (0 == n->nchild)
+ man_nmsg(m, n, MANDOCERR_NOBODY);
+ break;
}
if (MAN_HEAD == n->type)
switch (n->tok) {
@@ -317,9 +319,9 @@ check_par(CHKARGS)
case (MAN_P):
/* FALLTHROUGH */
case (MAN_LP):
- if (0 == n->nchild)
- break;
- return(man_nmsg(m, n, MANDOCERR_ARGSLOST));
+ if (n->nchild)
+ man_nmsg(m, n, MANDOCERR_ARGSLOST);
+ break;
default:
break;
}