diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-07-04 09:01:55 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-07-04 09:01:55 +0000 |
commit | 4731011d94a8295f8bf499ee10709029a5ac9f4a (patch) | |
tree | 029371328cc51743d850eecdc97ab2d9d1d7256b /mdoc_strings.c | |
parent | b446ffedf453a9238f7514a3d1ca6d8ac7489f03 (diff) | |
download | mandoc-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 'mdoc_strings.c')
-rw-r--r-- | mdoc_strings.c | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/mdoc_strings.c b/mdoc_strings.c index 9b5fbf78..13549a94 100644 --- a/mdoc_strings.c +++ b/mdoc_strings.c @@ -17,7 +17,6 @@ #include <sys/types.h> #include <assert.h> -#include <ctype.h> #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -59,82 +58,6 @@ extern char *strptime(const char *, const char *, struct tm *); #endif -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) { |