aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-10-06 22:29:12 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-10-06 22:29:12 +0000
commit04d794422a19264dc0a985a9b145b3748fc69862 (patch)
treed3a4862033902d2b0715fbc967dad707f873374a /main.c
parent2b6476580cd1b6473035ea2e2276e33efcb7fa74 (diff)
downloadmandoc-04d794422a19264dc0a985a9b145b3748fc69862.tar.gz
mandoc-04d794422a19264dc0a985a9b145b3748fc69862.tar.zst
mandoc-04d794422a19264dc0a985a9b145b3748fc69862.zip
If -Tman is specified and input is -man, echo the preprocessed (`so'
replaced by file) input. This replaces earlier behaviour of doing nothing, which I found unexpected (mandoc should always output). This requires a buffer in read.c that saves the input lines before being parsed, with a special hook if `so' is invoked. This buffer is just flushed to output if -mman is the input. While mucking around doing this, I also alpha-ordered the mandoc.h functions. Ok schwarze@, with no screaming when the polished patch was published.
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.c b/main.c
index b76a6047..fec83fba 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.164 2011/09/17 15:00:51 schwarze Exp $ */
+/* $Id: main.c,v 1.165 2011/10/06 22:29:12 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -127,6 +127,12 @@ main(int argc, char *argv[])
curp.mp = mparse_alloc(type, curp.wlevel, mmsg, &curp);
+ /*
+ * Conditionally start up the lookaside buffer before parsing.
+ */
+ if (OUTT_MAN == curp.outtype)
+ mparse_keep(curp.mp);
+
argc -= optind;
argv += optind;
@@ -252,6 +258,7 @@ parse(struct curparse *curp, int fd,
break;
case (OUTT_MAN):
curp->outmdoc = man_mdoc;
+ curp->outman = man_man;
break;
case (OUTT_PDF):
/* FALLTHROUGH */