From 46efc2522501cd7521cb08c1686de2dbf6544a03 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sun, 12 Apr 2009 19:19:57 +0000 Subject: 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. --- mdoc_validate.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'mdoc_validate.c') 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; -- cgit