summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-04-12 19:19:57 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-04-12 19:19:57 +0000
commit46efc2522501cd7521cb08c1686de2dbf6544a03 (patch)
tree838e5d0fddbf9c6b0778c423a3570102f46edc83 /mdoc_validate.c
parent72def18baa480a6e0b55cbe174a49649342cd895 (diff)
downloadmandoc-46efc2522501cd7521cb08c1686de2dbf6544a03.tar.gz
Manual .Dt fields CAPITALISED.
Indent set to 5 chars (nroff compat). Half-indent set to 3 chars (nroff compat). Default behaviour is loose-y (ignore macro/char/escape). Added -fstrict. Added unknown-character ignoring.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 9056c8ae..2a4f8454 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -51,6 +51,7 @@ enum merr {
};
enum mwarn {
+ WPRINT,
WESCAPE,
WWRONGMSEC,
WSECOOO,
@@ -95,6 +96,7 @@ static int warn_child_gt(struct mdoc *, const char *, int);
static int err_child_eq(struct mdoc *, const char *, int);
static int warn_child_eq(struct mdoc *, const char *, int);
static int count_child(struct mdoc *);
+static int warn_print(struct mdoc *, int, int);
static int warn_count(struct mdoc *, const char *,
int, const char *, int);
static int err_count(struct mdoc *, const char *,
@@ -460,6 +462,9 @@ pwarn(struct mdoc *m, int line, int pos, enum mwarn type)
p = "prologue macros out-of-order";
c = WARN_COMPAT;
break;
+ case (WPRINT):
+ p = "invalid character";
+ break;
case (WESCAPE):
p = "invalid escape sequence";
break;
@@ -497,6 +502,14 @@ pwarn(struct mdoc *m, int line, int pos, enum mwarn type)
}
+static int
+warn_print(struct mdoc *m, int ln, int pos)
+{
+ if (MDOC_IGN_CHARS & m->pflags)
+ return(pwarn(m, ln, pos, WPRINT));
+ return(perr(m, ln, pos, EPRINT));
+}
+
static inline int
warn_count(struct mdoc *m, const char *k,
@@ -699,9 +712,11 @@ check_text(struct mdoc *mdoc, int line, int pos, const char *p)
for ( ; *p; p++) {
if ('\t' == *p) {
if ( ! (MDOC_LITERAL & mdoc->flags))
- return(perr(mdoc, line, pos, EPRINT));
+ if ( ! warn_print(mdoc, line, pos))
+ return(0);
} else if ( ! isprint((u_char)*p))
- return(perr(mdoc, line, pos, EPRINT));
+ if ( ! warn_print(mdoc, line, pos))
+ return(0);
if ('\\' != *p)
continue;