summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man_validate.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2009-07-08 00:04:10 +0000
committerschwarze <schwarze@openbsd.org>2009-07-08 00:04:10 +0000
commitf6854d5ca3fcac678f129f074109501c0fbadcbb (patch)
tree2d732ed6833f2a3cd8c680308d66896c85279ce9 /usr.bin/mandoc/man_validate.c
parentDon't let ambiguous commands override an exact alias match: eg if commands (diff)
downloadwireguard-openbsd-f6854d5ca3fcac678f129f074109501c0fbadcbb.tar.xz
wireguard-openbsd-f6854d5ca3fcac678f129f074109501c0fbadcbb.zip
sync to 1.7.21: unified escape sequence validation for mdoc and man
checking is still incomplete, but a bit better, in particular for man now in sync with 1.7.22: the only 1.7.22 diff was already in
Diffstat (limited to 'usr.bin/mandoc/man_validate.c')
-rw-r--r--usr.bin/mandoc/man_validate.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c
index 08e2a1ca72e..b09bec2af70 100644
--- a/usr.bin/mandoc/man_validate.c
+++ b/usr.bin/mandoc/man_validate.c
@@ -1,4 +1,4 @@
-/* $Id: man_validate.c,v 1.4 2009/06/23 22:31:26 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.5 2009/07/08 00:04:10 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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)