summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-07-04 09:01:55 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-07-04 09:01:55 +0000
commit9e21548672490d99d4a59ab449c80b3721689818 (patch)
tree8680f364835e7cc1a867ed96dbd5a3eaf8669759 /mdoc_validate.c
parentf2ddfbfe82c8d980d204eb501343ff94da2d568c (diff)
downloadmandoc-9e21548672490d99d4a59ab449c80b3721689818.tar.gz
mandoc-9e21548672490d99d4a59ab449c80b3721689818.tar.zst
mandoc-9e21548672490d99d4a59ab449c80b3721689818.zip
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.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c12
1 files changed, 7 insertions, 5 deletions
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 <kristaps@kth.se>
*
@@ -23,6 +23,7 @@
#include <string.h>
#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))