From 9e21548672490d99d4a59ab449c80b3721689818 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sat, 4 Jul 2009 09:01:55 +0000 Subject: Moved escape validation into libmandoc.h/mandoc.c (common between libman/libmdoc1). libman supports MAN_IGN_ESCAPE (like MDOC_IGN_ESCAPE). All popular escapes now handled consistently. --- mdoc_validate.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'mdoc_validate.c') diff --git a/mdoc_validate.c b/mdoc_validate.c index 994ca9da..07db995a 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.17 2009/06/27 09:03:03 kristaps Exp $ */ +/* $Id: mdoc_validate.c,v 1.18 2009/07/04 09:01:55 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -23,6 +23,7 @@ #include #include "libmdoc.h" +#include "libmandoc.h" /* FIXME: .Bl -diag can't have non-text children in HEAD. */ /* TODO: ignoring Pp (it's superfluous in some invocations). */ @@ -708,9 +709,9 @@ check_argv(struct mdoc *m, const struct mdoc_node *n, static int check_text(struct mdoc *mdoc, int line, int pos, const char *p) { - size_t c; + int c; - for ( ; *p; p++) { + for ( ; *p; p++, pos++) { if ('\t' == *p) { if ( ! (MDOC_LITERAL & mdoc->flags)) if ( ! warn_print(mdoc, line, pos)) @@ -722,9 +723,10 @@ check_text(struct mdoc *mdoc, int line, int pos, const char *p) if ('\\' != *p) continue; - c = mdoc_isescape(p); + c = mandoc_special(p); if (c) { - p += (int)c - 1; + p += c - 1; + pos += c - 1; continue; } if ( ! (MDOC_IGN_ESCAPE & mdoc->pflags)) -- cgit v1.2.3-56-ge451