summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 6bd6c14d..cc00a1ae 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -453,26 +453,29 @@ check_argv(struct mdoc *m, struct mdoc_node *n, struct mdoc_argv *v)
static int
-check_text(struct mdoc *mdoc, int line, int pos, char *p)
+check_text(struct mdoc *m, int ln, int pos, char *p)
{
int c;
-
- /*
- * FIXME: we absolutely cannot let \b get through or it will
- * destroy some assumptions in terms of format.
- */
+ size_t sz;
for ( ; *p; p++, pos++) {
+ sz = strcspn(p, "\t\\");
+ p += (int)sz;
+
+ if ('\0' == *p)
+ break;
+
+ pos += (int)sz;
+
if ('\t' == *p) {
- if ( ! (MDOC_LITERAL & mdoc->flags))
- if ( ! mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADCHAR))
- return(0);
- } else if ( ! isprint((u_char)*p) && ASCII_HYPH != *p)
- if ( ! mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADCHAR))
- return(0);
+ if (MDOC_LITERAL & m->flags)
+ continue;
+ if (mdoc_pmsg(m, ln, pos, MANDOCERR_BADTAB))
+ continue;
+ return(0);
+ }
- if ('\\' != *p)
- continue;
+ /* Check the special character. */
c = mandoc_special(p);
if (c) {
@@ -481,8 +484,8 @@ check_text(struct mdoc *mdoc, int line, int pos, char *p)
continue;
}
- c = mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADESCAPE);
- if ( ! (MDOC_IGN_ESCAPE & mdoc->pflags) && ! c)
+ c = mdoc_pmsg(m, ln, pos, MANDOCERR_BADESCAPE);
+ if ( ! (MDOC_IGN_ESCAPE & m->pflags) && ! c)
return(c);
}
@@ -490,8 +493,6 @@ check_text(struct mdoc *mdoc, int line, int pos, char *p)
}
-
-
static int
check_parent(PRE_ARGS, enum mdoct tok, enum mdoc_type t)
{
@@ -509,7 +510,6 @@ check_parent(PRE_ARGS, enum mdoct tok, enum mdoc_type t)
}
-
static int
pre_display(PRE_ARGS)
{