aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/read.c
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
commit459520d49c97cdad588c9f2c13cdc7b76b4733f5 (patch)
tree768336bfbdf81ab3fe471c74acf826c7290ee743 /read.c
parent3e8df8047cc27e09a5bd5c122feec093e776b9fd (diff)
downloadmandoc-459520d49c97cdad588c9f2c13cdc7b76b4733f5.tar.gz
mandoc-459520d49c97cdad588c9f2c13cdc7b76b4733f5.tar.zst
mandoc-459520d49c97cdad588c9f2c13cdc7b76b4733f5.zip
always use the right buffer, and fix one evil typo
Diffstat (limited to 'read.c')
-rw-r--r--read.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/read.c b/read.c
index 7b952aa7..2b67ace1 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.84 2014/09/06 23:24:32 schwarze Exp $ */
+/* $Id: read.c,v 1.85 2014/09/07 02:17:40 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;
}