summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2009-07-12 20:30:28 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2009-07-12 20:30:28 +0000
commit475001105e136851bef0c0389f449eb102901714 (patch)
tree0a16af1acf6f5fb2ab39f3e8bf213260bd92471b /usr.bin/mandoc/mdoc_validate.c
parenta434aaccc80703d795f7b657854c13afc56100c5 (diff)
sync to 1.7.23: unify the various "enum merr" into libman.h and libmdoc.h,
use it as a new argument to mdoc_err(), the same way as for for man_err(), and use string tables instead of switch statements to select error messages
Diffstat (limited to 'usr.bin/mandoc/mdoc_validate.c')
-rw-r--r--usr.bin/mandoc/mdoc_validate.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 4849120dd55..1cf5dffcb85 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.17 2009/07/12 19:05:52 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.18 2009/07/12 20:30:27 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -31,26 +31,6 @@
#define PRE_ARGS struct mdoc *mdoc, const struct mdoc_node *n
#define POST_ARGS struct mdoc *mdoc
-enum merr {
- ETOOLONG,
- EESCAPE,
- EPRINT,
- ENODATA,
- ENOPROLOGUE,
- ELINE,
- EATT,
- ENAME,
- ELISTTYPE,
- EDISPTYPE,
- EMULTIDISP,
- ESECNAME,
- EMULTILIST,
- EARGREP,
- EBOOL,
- ECOLMIS,
- ENESTDISP
-};
-
enum mwarn {
WPRINT,
WNOWIDTH,
@@ -417,7 +397,7 @@ perr(struct mdoc *m, int line, int pos, enum merr type)
case (ENOPROLOGUE):
p = "document has no prologue";
break;
- case (ENODATA):
+ case (ENODAT):
p = "document has no data";
break;
case (ECOLMIS):
@@ -1033,12 +1013,12 @@ post_bf(POST_ARGS)
head = mdoc->last->head;
if (mdoc->last->args && head->child)
- return(mdoc_err(mdoc, "one argument expected"));
+ return(mdoc_nerr(mdoc, mdoc->last, "one argument expected"));
else if (mdoc->last->args)
return(1);
if (NULL == head->child || MDOC_TEXT != head->child->type)
- return(mdoc_err(mdoc, "text argument expected"));
+ return(mdoc_nerr(mdoc, mdoc->last, "text argument expected"));
p = head->child->string;
@@ -1291,14 +1271,14 @@ post_root(POST_ARGS)
{
if (NULL == mdoc->first->child)
- return(verr(mdoc, ENODATA));
+ return(verr(mdoc, ENODAT));
if ( ! (MDOC_PBODY & mdoc->flags))
return(verr(mdoc, ENOPROLOGUE));
if (MDOC_BLOCK != mdoc->first->child->type)
- return(verr(mdoc, ENODATA));
+ return(verr(mdoc, ENODAT));
if (MDOC_Sh != mdoc->first->child->tok)
- return(verr(mdoc, ENODATA));
+ return(verr(mdoc, ENODAT));
return(1);
}