version 1.14, 2009/07/12 20:30:27 |
version 1.15, 2009/07/12 21:08:29 |
|
|
|
|
|
|
int |
int |
mdoc_nerr(struct mdoc *mdoc, const struct mdoc_node *node, |
|
const char *fmt, ...) |
|
{ |
|
char buf[256]; |
|
va_list ap; |
|
|
|
if (NULL == mdoc->cb.mdoc_err) |
|
return(0); |
|
|
|
va_start(ap, fmt); |
|
(void)vsnprintf(buf, sizeof(buf) - 1, fmt, ap); |
|
va_end(ap); |
|
return((*mdoc->cb.mdoc_err)(mdoc->data, |
|
node->line, node->pos, buf)); |
|
} |
|
|
|
|
|
int |
|
mdoc_warn(struct mdoc *mdoc, enum mdoc_warn type, |
mdoc_warn(struct mdoc *mdoc, enum mdoc_warn type, |
const char *fmt, ...) |
const char *fmt, ...) |
{ |
{ |
|
|
struct mdoc_node *p; |
struct mdoc_node *p; |
|
|
if (NULL == (p = calloc(1, sizeof(struct mdoc_node)))) { |
if (NULL == (p = calloc(1, sizeof(struct mdoc_node)))) { |
(void)perr(mdoc, (mdoc)->last->line, |
(void)mdoc_nerr(mdoc, mdoc->last, EMALLOC); |
(mdoc)->last->pos, EMALLOC); |
|
return(NULL); |
return(NULL); |
} |
} |
|
|
|
|
if (NULL == p) |
if (NULL == p) |
return(0); |
return(0); |
if (NULL == (p->string = strdup(word))) { |
if (NULL == (p->string = strdup(word))) { |
(void)perr(mdoc, (mdoc)->last->line, |
(void)mdoc_nerr(mdoc, mdoc->last, EMALLOC); |
(mdoc)->last->pos, EMALLOC); |
|
return(0); |
return(0); |
} |
} |
|
|
return(node_append(mdoc, p)); |
return(node_append(mdoc, p)); |
} |
} |
|
|