aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-05-17 14:38:34 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-05-17 14:38:34 +0000
commit0587ad80d46d89f36315c37bbd67cf8899708b8d (patch)
treef6e1521213cb40a637bdb175e43f121249534ba3 /main.c
parent79f16537cd09bc054f9d18169708d63030803d98 (diff)
downloadmandoc-0587ad80d46d89f36315c37bbd67cf8899708b8d.tar.gz
mandoc-0587ad80d46d89f36315c37bbd67cf8899708b8d.tar.zst
mandoc-0587ad80d46d89f36315c37bbd67cf8899708b8d.zip
Add mode for -Tlocale. This mode, with this commit, behaves exactly
like -Tascii. While adding this, inline term_alloc() (was a one-liner), remove some switches around the terminal encoding for the symbol table (unnecessary), and split out ascii_alloc() into ascii_init(), which is also called from locale_init().
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/main.c b/main.c
index bbbb8846..f7edf473 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.161 2011/03/31 10:53:43 kristaps Exp $ */
+/* $Id: main.c,v 1.162 2011/05/17 14:38:34 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -43,6 +43,7 @@ typedef void (*out_free)(void *);
enum outt {
OUTT_ASCII = 0, /* -Tascii */
+ OUTT_LOCALE, /* -Tlocale */
OUTT_TREE, /* -Ttree */
OUTT_HTML, /* -Thtml */
OUTT_XHTML, /* -Txhtml */
@@ -206,9 +207,15 @@ parse(struct curparse *curp, int fd,
switch (curp->outtype) {
case (OUTT_XHTML):
curp->outdata = xhtml_alloc(curp->outopts);
+ curp->outfree = html_free;
break;
case (OUTT_HTML):
curp->outdata = html_alloc(curp->outopts);
+ curp->outfree = html_free;
+ break;
+ case (OUTT_LOCALE):
+ curp->outdata = locale_alloc(curp->outopts);
+ curp->outfree = ascii_free;
break;
case (OUTT_ASCII):
curp->outdata = ascii_alloc(curp->outopts);
@@ -232,7 +239,6 @@ parse(struct curparse *curp, int fd,
case (OUTT_XHTML):
curp->outman = html_man;
curp->outmdoc = html_mdoc;
- curp->outfree = html_free;
break;
case (OUTT_TREE):
curp->outman = tree_man;
@@ -242,6 +248,8 @@ parse(struct curparse *curp, int fd,
/* FALLTHROUGH */
case (OUTT_ASCII):
/* FALLTHROUGH */
+ case (OUTT_LOCALE):
+ /* FALLTHROUGH */
case (OUTT_PS):
curp->outman = terminal_man;
curp->outmdoc = terminal_mdoc;
@@ -299,6 +307,8 @@ toptions(struct curparse *curp, char *arg)
curp->outtype = OUTT_TREE;
else if (0 == strcmp(arg, "html"))
curp->outtype = OUTT_HTML;
+ else if (0 == strcmp(arg, "locale"))
+ curp->outtype = OUTT_LOCALE;
else if (0 == strcmp(arg, "xhtml"))
curp->outtype = OUTT_XHTML;
else if (0 == strcmp(arg, "ps"))