version 1.67, 2009/03/04 13:57:35 |
version 1.68, 2009/03/05 13:12:12 |
Line 53 static int check_stdarg(PRE_ARGS); |
|
Line 53 static int check_stdarg(PRE_ARGS); |
|
|
|
static int check_text(struct mdoc *, |
static int check_text(struct mdoc *, |
int, int, const char *); |
int, int, const char *); |
|
static int check_argv(struct mdoc *, |
|
const struct mdoc_node *, |
|
const struct mdoc_arg *); |
|
|
static int err_child_lt(struct mdoc *, const char *, int); |
static int err_child_lt(struct mdoc *, const char *, int); |
static int warn_child_lt(struct mdoc *, const char *, int); |
static int warn_child_lt(struct mdoc *, const char *, int); |
Line 298 mdoc_valid_pre(struct mdoc *mdoc, |
|
Line 301 mdoc_valid_pre(struct mdoc *mdoc, |
|
node->data.elem.argc; |
node->data.elem.argc; |
|
|
for (i = 0; i < (int)argc; i++) { |
for (i = 0; i < (int)argc; i++) { |
if (0 == argv[i].sz) |
|
continue; |
|
for (j = 0; j < (int)argv[i].sz; j++) { |
for (j = 0; j < (int)argv[i].sz; j++) { |
tp = argv[i].value[j]; |
tp = argv[i].value[j]; |
line = argv[i].line; |
line = argv[i].line; |
Line 307 mdoc_valid_pre(struct mdoc *mdoc, |
|
Line 308 mdoc_valid_pre(struct mdoc *mdoc, |
|
if ( ! check_text(mdoc, line, pos, tp)) |
if ( ! check_text(mdoc, line, pos, tp)) |
return(0); |
return(0); |
} |
} |
|
if ( ! check_argv(mdoc, node, &argv[i])) |
|
return(0); |
} |
} |
} |
} |
|
|
Line 476 check_msec(PRE_ARGS, int sz, enum mdoc_msec *msecs) |
|
Line 479 check_msec(PRE_ARGS, int sz, enum mdoc_msec *msecs) |
|
} |
} |
|
|
|
|
|
/* |
|
* Check over an argument. When this has more stuff in it, make this |
|
* into a table-driven function; until then, a switch is fine. |
|
*/ |
static int |
static int |
|
check_argv(struct mdoc *mdoc, |
|
const struct mdoc_node *node, |
|
const struct mdoc_arg *argv) |
|
{ |
|
|
|
|
|
switch (argv->arg) { |
|
case (MDOC_Std): |
|
switch (node->tok) { |
|
case (MDOC_Ex): |
|
/* |
|
* If the -std does not have an argument, then |
|
* set it with the default name (if set). This |
|
* only happens with MDOC_Ex. |
|
*/ |
|
if (1 == argv->sz) |
|
return(1); |
|
assert(0 == argv->sz); |
|
if (mdoc->meta.name) |
|
return(1); |
|
return(mdoc_nerr(mdoc, node, |
|
"default name not yet set")); |
|
default: |
|
break; |
|
} |
|
break; |
|
default: |
|
break; |
|
} |
|
|
|
return(1); |
|
} |
|
|
|
|
|
static int |
check_text(struct mdoc *mdoc, int line, int pos, const char *p) |
check_text(struct mdoc *mdoc, int line, int pos, const char *p) |
{ |
{ |
size_t c; |
size_t c; |
Line 484 check_text(struct mdoc *mdoc, int line, int pos, const |
|
Line 526 check_text(struct mdoc *mdoc, int line, int pos, const |
|
/* XXX - indicate deprecated escapes \*(xx and \*x. */ |
/* XXX - indicate deprecated escapes \*(xx and \*x. */ |
|
|
for ( ; *p; p++) { |
for ( ; *p; p++) { |
if ( ! isprint((int)*p) && '\t' != *p) |
if ( ! isprint((u_char)*p) && '\t' != *p) |
return(mdoc_perr(mdoc, line, pos, |
return(mdoc_perr(mdoc, line, pos, |
"invalid non-printing characters")); |
"invalid non-printing characters")); |
if ('\\' != *p) |
if ('\\' != *p) |