=================================================================== RCS file: /cvs/mandoc/read.c,v retrieving revision 1.8 retrieving revision 1.14 diff -u -p -r1.8 -r1.14 --- mandoc/read.c 2011/03/31 10:54:39 1.8 +++ mandoc/read.c 2011/04/30 10:18:24 1.14 @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.8 2011/03/31 10:54:39 kristaps Exp $ */ +/* $Id: read.c,v 1.14 2011/04/30 10:18:24 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2011 Ingo Schwarze @@ -15,6 +15,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include @@ -138,7 +142,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = "tab in non-literal context", "end of line whitespace", "bad comment style", - "unknown escape sequence", + "bad escape sequence", "unterminated quoted string", "generic error", @@ -350,7 +354,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, int continue; } - if ('"' == blk.buf[i + 1]) { + if ('"' == blk.buf[i + 1] || '#' == blk.buf[i + 1]) { i += 2; /* Comment, skip to end of line */ for (; i < (int)blk.sz; ++i) { @@ -441,7 +445,7 @@ rerun: /* * If input parsers have not been allocated, do so now. - * We keep these instanced betwen parsers, but set them + * We keep these instanced between parsers, but set them * locally per parse routine since we can use different * parsers with each one. */ @@ -662,6 +666,8 @@ mparse_alloc(enum mparset inttype, enum mandoclevel wl { struct mparse *curp; + assert(wlevel <= MANDOCLEVEL_FATAL); + curp = mandoc_calloc(1, sizeof(struct mparse)); curp->wlevel = wlevel; @@ -709,8 +715,10 @@ void mparse_result(struct mparse *curp, struct mdoc **mdoc, struct man **man) { - *mdoc = curp->mdoc; - *man = curp->man; + if (mdoc) + *mdoc = curp->mdoc; + if (man) + *man = curp->man; } void