diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-06-20 17:24:00 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-06-20 17:24:00 +0000 |
commit | f55f857f8f078275f8f6d914367c3075c9e25022 (patch) | |
tree | 32eae989a5989bbd16b4929027c3c2df76fd428c /man_validate.c | |
parent | 6b6c88dfdce932cd2de0f3b003a8bf31558b0fbe (diff) | |
download | mandoc-f55f857f8f078275f8f6d914367c3075c9e25022.tar.gz |
Start systematic improvements of error reporting.
So far, this covers all WARNINGs related to the prologue.
1) hierarchical naming of MANDOCERR_* constants
2) mention the macro name in messages where that adds clarity
3) add one missing MANDOCERR_DATE_MISSING msg
4) fix the wording of one message related to the man(7) prologue
Started on the plane back from Ottawa.
Diffstat (limited to 'man_validate.c')
-rw-r--r-- | man_validate.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/man_validate.c b/man_validate.c index 03a5f4c5..0088e6f8 100644 --- a/man_validate.c +++ b/man_validate.c @@ -202,7 +202,7 @@ check_root(CHKARGS) man_nmsg(man, n, MANDOCERR_NODOCBODY); return(0); } else if (NULL == man->meta.title) { - man_nmsg(man, n, MANDOCERR_NOTITLE); + man_nmsg(man, n, MANDOCERR_TH_MISSING); /* * If a title hasn't been set, do so now (by @@ -390,6 +390,7 @@ post_IP(CHKARGS) static int post_TH(CHKARGS) { + struct man_node *nb; const char *p; free(man->meta.title); @@ -401,6 +402,8 @@ post_TH(CHKARGS) 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; @@ -409,7 +412,7 @@ post_TH(CHKARGS) /* Only warn about this once... */ if (isalpha((unsigned char)*p) && ! isupper((unsigned char)*p)) { - man_nmsg(man, n, MANDOCERR_UPPERCASE); + man_nmsg(man, n, MANDOCERR_TITLE_CASE); break; } } @@ -435,8 +438,10 @@ post_TH(CHKARGS) 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 */ |