=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/read.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- src/usr.bin/mandoc/read.c 2014/08/08 15:15:27 1.49 +++ src/usr.bin/mandoc/read.c 2014/08/08 15:21:17 1.50 @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.49 2014/08/08 15:15:27 schwarze Exp $ */ +/* $Id: read.c,v 1.50 2014/08/08 15:21:17 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2014 Ingo Schwarze @@ -196,14 +196,12 @@ "generic fatal error", "input too large", - "not a manual", "column syntax is inconsistent", "NOT IMPLEMENTED: .Bd -file", "child violates parent syntax", "argument count wrong, violates syntax", "NOT IMPLEMENTED: .so with absolute path or \"..\"", ".so request failed", - "no document prologue", "static buffer exhausted", /* system errors */ @@ -256,18 +254,9 @@ } if (MPARSE_MDOC & curp->options) { - if (NULL == curp->pmdoc) - curp->pmdoc = mdoc_alloc( - curp->roff, curp, curp->defos, - MPARSE_QUICK & curp->options ? 1 : 0); - assert(curp->pmdoc); curp->mdoc = curp->pmdoc; return; } else if (MPARSE_MAN & curp->options) { - if (NULL == curp->pman) - curp->pman = man_alloc(curp->roff, curp, - MPARSE_QUICK & curp->options ? 1 : 0); - assert(curp->pman); curp->man = curp->pman; return; } @@ -673,6 +662,19 @@ if (MANDOCLEVEL_FATAL <= curp->file_status) return; + if (curp->mdoc == NULL && + curp->man == NULL && + curp->sodest == NULL) { + if (curp->options & MPARSE_MDOC) + curp->mdoc = curp->pmdoc; + else { + if (curp->pman == NULL) + curp->pman = man_alloc(curp->roff, curp, + curp->options & MPARSE_QUICK ? 1 : 0); + curp->man = curp->pman; + } + } + if (curp->mdoc && ! mdoc_endparse(curp->mdoc)) { assert(MANDOCLEVEL_FATAL <= curp->file_status); return; @@ -683,12 +685,6 @@ return; } - if ( ! (curp->mdoc || curp->man || curp->sodest)) { - mandoc_msg(MANDOCERR_NOTMANUAL, curp, 0, 0, NULL); - curp->file_status = MANDOCLEVEL_FATAL; - return; - } - roff_endparse(curp->roff); } @@ -771,6 +767,14 @@ curp->defos = defos; curp->roff = roff_alloc(curp, options); + if (curp->options & MPARSE_MDOC) + curp->pmdoc = mdoc_alloc( + curp->roff, curp, curp->defos, + curp->options & MPARSE_QUICK ? 1 : 0); + if (curp->options & MPARSE_MAN) + curp->pman = man_alloc(curp->roff, curp, + curp->options & MPARSE_QUICK ? 1 : 0); + return(curp); }