version 1.44, 2010/06/19 20:46:28 |
version 1.46, 2010/07/20 14:56:42 |
|
|
#include <limits.h> |
#include <limits.h> |
#include <stdarg.h> |
#include <stdarg.h> |
#include <stdlib.h> |
#include <stdlib.h> |
|
#include <string.h> |
|
|
#include "mandoc.h" |
#include "mandoc.h" |
#include "libman.h" |
#include "libman.h" |
Line 206 check_text(CHKARGS) |
|
Line 207 check_text(CHKARGS) |
|
{ |
{ |
char *p; |
char *p; |
int pos, c; |
int pos, c; |
|
size_t sz; |
|
|
assert(n->string); |
|
|
|
for (p = n->string, pos = n->pos + 1; *p; p++, pos++) { |
for (p = n->string, pos = n->pos + 1; *p; p++, pos++) { |
if ('\\' == *p) { |
sz = strcspn(p, "\t\\"); |
c = mandoc_special(p); |
p += (int)sz; |
if (c) { |
|
p += c - 1; |
|
pos += c - 1; |
|
continue; |
|
} |
|
|
|
c = man_pmsg(m, n->line, pos, MANDOCERR_BADESCAPE); |
if ('\0' == *p) |
if ( ! (MAN_IGN_ESCAPE & m->pflags) && ! c) |
break; |
return(c); |
|
|
pos += (int)sz; |
|
|
|
if ('\t' == *p) { |
|
if (MAN_LITERAL & m->flags) |
|
continue; |
|
if (man_pmsg(m, n->line, pos, MANDOCERR_BADTAB)) |
|
continue; |
|
return(0); |
} |
} |
|
|
if ('\t' == *p || isprint((u_char)*p) || ASCII_HYPH == *p) |
/* Check the special character. */ |
|
|
|
c = mandoc_special(p); |
|
if (c) { |
|
p += c - 1; |
|
pos += c - 1; |
continue; |
continue; |
if ( ! man_pmsg(m, n->line, pos, MANDOCERR_BADCHAR)) |
} |
return(0); |
|
|
c = man_pmsg(m, n->line, pos, MANDOCERR_BADESCAPE); |
|
if ( ! (MAN_IGN_ESCAPE & m->pflags) && ! c) |
|
return(c); |
} |
} |
|
|
return(1); |
return(1); |