summaryrefslogtreecommitdiffstats
path: root/man_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
commit4731011d94a8295f8bf499ee10709029a5ac9f4a (patch)
tree029371328cc51743d850eecdc97ab2d9d1d7256b /man_validate.c
parentb446ffedf453a9238f7514a3d1ca6d8ac7489f03 (diff)
downloadmandoc-4731011d94a8295f8bf499ee10709029a5ac9f4a.tar.gz
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 'man_validate.c')
-rw-r--r--man_validate.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/man_validate.c b/man_validate.c
index e9a65510..183d31c5 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include "libman.h"
+#include "libmandoc.h"
#define POSTARGS struct man *m, const struct man_node *n
@@ -118,12 +119,26 @@ static int
check_text(POSTARGS)
{
const char *p;
- int pos;
+ int pos, c;
assert(n->string);
for (p = n->string, pos = n->pos + 1; *p; p++, pos++) {
- if ('\t' == *p || isprint((u_char)*p))
+ if ('\\' == *p) {
+ c = mandoc_special(p);
+ if (c) {
+ p += c - 1;
+ pos += c - 1;
+ continue;
+ }
+ if ( ! (MAN_IGN_ESCAPE & m->pflags))
+ return(man_perr(m, n->line, pos, WESCAPE));
+ if ( ! man_pwarn(m, n->line, pos, WESCAPE))
+ return(0);
+ continue;
+ }
+
+ if ('\t' == *p || isprint((u_char)*p))
continue;
if (MAN_IGN_CHARS & m->pflags)