summaryrefslogtreecommitdiffstatshomepage
path: root/mdocterm.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-02-23 09:33:34 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-02-23 09:33:34 +0000
commitd4c0992263d8c5aca2724dda4684c89e608d697c (patch)
tree2fa6b0431d1dff9289abe3f214be7119e09cee27 /mdocterm.c
parent7caa51ee5a0c6624eb97d1d6bf06b84bdbd7f034 (diff)
downloadmandoc-d4c0992263d8c5aca2724dda4684c89e608d697c.tar.gz
mandoc-d4c0992263d8c5aca2724dda4684c89e608d697c.tar.zst
mandoc-d4c0992263d8c5aca2724dda4684c89e608d697c.zip
Considerable mdoc.3 documentation.
Added a few more escapes and macros.
Diffstat (limited to 'mdocterm.c')
-rw-r--r--mdocterm.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/mdocterm.c b/mdocterm.c
index faa06717..46451789 100644
--- a/mdocterm.c
+++ b/mdocterm.c
@@ -1,4 +1,4 @@
- /* $Id: mdocterm.c,v 1.3 2009/02/23 07:09:13 kristaps Exp $ */
+ /* $Id: mdocterm.c,v 1.4 2009/02/23 09:33:34 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -45,6 +45,7 @@ static void pword(struct termp *, const char *, size_t);
static void pescape(struct termp *,
const char *, size_t *, size_t);
static void chara(struct termp *, char);
+static void stringa(struct termp *, const char *);
static void style(struct termp *, enum termstyle);
#ifdef __linux__
@@ -231,6 +232,16 @@ vspace(struct termp *p)
static void
+stringa(struct termp *p, const char *s)
+{
+
+ /* XXX - speed up if not passing to chara. */
+ for ( ; *s; s++)
+ chara(p, *s);
+}
+
+
+static void
chara(struct termp *p, char c)
{
@@ -284,6 +295,10 @@ pescape(struct termp *p, const char *word, size_t *i, size_t len)
chara(p, ']');
else if ('l' == word[*i] && 'B' == word[*i + 1])
chara(p, '[');
+ else if ('<' == word[*i] && '-' == word[*i + 1])
+ stringa(p, "<-");
+ else if ('-' == word[*i] && '>' == word[*i + 1])
+ stringa(p, "->");
(*i)++;
return;