summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-09-07 02:17:40 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-09-07 02:17:40 +0000
commit7c52c557c239f14fe4680df3ac9e78fa295307a6 (patch)
treecb027d9edfab618962f8c336da966196b649248a
parente13eaef731c921e8230fb25465559ac5145a9500 (diff)
downloadmandoc-7c52c557c239f14fe4680df3ac9e78fa295307a6.tar.gz
always use the right buffer, and fix one evil typo
-rw-r--r--read.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/read.c b/read.c
index 931d82fa..bcb2e0b3 100644
--- a/read.c
+++ b/read.c
@@ -262,7 +262,7 @@ choose_parser(struct mparse *curp)
cp = curp->primary->buf;
ep = cp + curp->primary->sz;
while (cp < ep) {
- if (*cp == '.' || *cp != '\'') {
+ if (*cp == '.' || *cp == '\'') {
cp++;
if (cp[0] == 'D' && cp[1] == 'd') {
format = MPARSE_MDOC;
@@ -712,6 +712,7 @@ mparse_end(struct mparse *curp)
static void
mparse_parse_buffer(struct mparse *curp, struct buf blk, const char *file)
{
+ struct buf *svprimary;
const char *svfile;
static int recursion_depth;
@@ -723,6 +724,7 @@ mparse_parse_buffer(struct mparse *curp, struct buf blk, const char *file)
/* Line number is per-file. */
svfile = curp->file;
curp->file = file;
+ svprimary = curp->primary;
curp->primary = &blk;
curp->line = 1;
recursion_depth++;
@@ -732,6 +734,7 @@ mparse_parse_buffer(struct mparse *curp, struct buf blk, const char *file)
if (0 == --recursion_depth && MANDOCLEVEL_FATAL > curp->file_status)
mparse_end(curp);
+ curp->primary = svprimary;
curp->file = svfile;
}