summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_strings.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/mdoc_strings.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/mdoc_strings.c')
-rw-r--r--usr.bin/mandoc/mdoc_strings.c80
1 files changed, 2 insertions, 78 deletions
diff --git a/usr.bin/mandoc/mdoc_strings.c b/usr.bin/mandoc/mdoc_strings.c
index de00025fb85..7b561fa264c 100644
--- a/usr.bin/mandoc/mdoc_strings.c
+++ b/usr.bin/mandoc/mdoc_strings.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_strings.c,v 1.7 2009/06/21 20:21:09 schwarze Exp $ */
+/* $Id: mdoc_strings.c,v 1.8 2009/07/08 00:04:10 schwarze Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -17,7 +17,6 @@
#include <sys/types.h>
#include <assert.h>
-#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -55,82 +54,6 @@ static const struct mdoc_secname secnames[SECNAME_MAX] = {
};
-size_t
-mdoc_isescape(const char *p)
-{
- size_t c;
-
- if ('\\' != *p++)
- return(0);
-
- switch (*p) {
- case ('\\'):
- /* FALLTHROUGH */
- case ('\''):
- /* FALLTHROUGH */
- case ('`'):
- /* FALLTHROUGH */
- case ('q'):
- /* FALLTHROUGH */
- case ('-'):
- /* FALLTHROUGH */
- case ('~'):
- /* FALLTHROUGH */
- case ('^'):
- /* FALLTHROUGH */
- case ('%'):
- /* FALLTHROUGH */
- case ('0'):
- /* FALLTHROUGH */
- case (' '):
- /* FALLTHROUGH */
- case ('|'):
- /* FALLTHROUGH */
- case ('&'):
- /* FALLTHROUGH */
- case ('.'):
- /* FALLTHROUGH */
- case (':'):
- /* FALLTHROUGH */
- case ('e'):
- return(2);
- case ('*'):
- if (0 == *++p || ! isgraph((u_char)*p))
- return(0);
- switch (*p) {
- case ('('):
- if (0 == *++p || ! isgraph((u_char)*p))
- return(0);
- return(4);
- case ('['):
- for (c = 3, p++; *p && ']' != *p; p++, c++)
- if ( ! isgraph((u_char)*p))
- break;
- return(*p == ']' ? c : 0);
- default:
- break;
- }
- return(3);
- case ('('):
- if (0 == *++p || ! isgraph((u_char)*p))
- return(0);
- if (0 == *++p || ! isgraph((u_char)*p))
- return(0);
- return(4);
- case ('['):
- break;
- default:
- return(0);
- }
-
- for (c = 3, p++; *p && ']' != *p; p++, c++)
- if ( ! isgraph((u_char)*p))
- break;
-
- return(*p == ']' ? c : 0);
-}
-
-
int
mdoc_iscdelim(char p)
{
@@ -217,6 +140,7 @@ mdoc_atotime(const char *p)
}
+/* FIXME: move this into an editable .in file. */
size_t
mdoc_macro2len(int macro)
{