summaryrefslogtreecommitdiffstats
path: root/man_term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-10-13 10:57:25 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-10-13 10:57:25 +0000
commitc73e1ec1c6a54b399da7b779448188ef6db6db68 (patch)
tree03658ba627049a18bc861428324a55cc63174686 /man_term.c
parentfd6f541ce489626cb695b97a00cee1e243aa40a4 (diff)
downloadmandoc-c73e1ec1c6a54b399da7b779448188ef6db6db68.tar.gz
Moved output definitions into main.h.
Pushed terminal_{mdoc,man} into {mdoc,man}_term.c.
Diffstat (limited to 'man_term.c')
-rw-r--r--man_term.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/man_term.c b/man_term.c
index 466d55f5..f54efedf 100644
--- a/man_term.c
+++ b/man_term.c
@@ -23,8 +23,10 @@
#include <stdlib.h>
#include <string.h>
-#include "term.h"
#include "man.h"
+#include "term.h"
+#include "chars.h"
+#include "main.h"
#define INDENT 7
#define HALFINDENT 3
@@ -140,20 +142,38 @@ static int arg_width(const struct man_node *);
void
-man_run(struct termp *p, const struct man *m)
+terminal_man(void *arg, const struct man *man)
{
- struct mtermp mt;
+ struct termp *p;
+ const struct man_node *n;
+ const struct man_meta *m;
+ struct mtermp mt;
+
+ p = (struct termp *)arg;
+
+ if (NULL == p->symtab)
+ switch (p->enc) {
+ case (TERMENC_ASCII):
+ p->symtab = chars_init(CHARS_ASCII);
+ break;
+ default:
+ abort();
+ /* NOTREACHED */
+ }
+
+ n = man_node(man);
+ m = man_meta(man);
- print_head(p, man_meta(m));
+ print_head(p, m);
p->flags |= TERMP_NOSPACE;
mt.fl = 0;
mt.lmargin = INDENT;
mt.offset = INDENT;
- if (man_node(m)->child)
- print_body(p, &mt, man_node(m)->child, man_meta(m));
- print_foot(p, man_meta(m));
+ if (n->child)
+ print_body(p, &mt, n->child, m);
+ print_foot(p, m);
}