summaryrefslogtreecommitdiffstats
path: root/term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-07-21 20:35:03 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-07-21 20:35:03 +0000
commit83b4f157d4daded80000e151a11815be7bc92575 (patch)
treecfdf435a5578191efb49da30ccc56ef93351f543 /term.c
parent28eeb27f1cb4b3c30ede14a1e367fa86624a8420 (diff)
downloadmandoc-83b4f157d4daded80000e151a11815be7bc92575.tar.gz
Accomodate for groff's crappy behaviour wherein an unrecognised
single-character escape (and ONLY this type of escape) will map back into itself: "If a backslash is followed by a character that does not constitute a defined escape sequence the backslash is silently ignored and the character maps to itself." (From groff.7.) Found by Jason McIntyre.
Diffstat (limited to 'term.c')
-rw-r--r--term.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/term.c b/term.c
index 9894ac07..4338559b 100644
--- a/term.c
+++ b/term.c
@@ -34,7 +34,8 @@
#include "term.h"
#include "main.h"
-static void spec(struct termp *, const char *, size_t);
+static void spec(struct termp *, enum roffdeco,
+ const char *, size_t);
static void res(struct termp *, const char *, size_t);
static void buffera(struct termp *, const char *, size_t);
static void bufferc(struct termp *, char);
@@ -360,7 +361,7 @@ term_vspace(struct termp *p)
static void
-spec(struct termp *p, const char *word, size_t len)
+spec(struct termp *p, enum roffdeco d, const char *word, size_t len)
{
const char *rhs;
size_t sz;
@@ -368,6 +369,8 @@ spec(struct termp *p, const char *word, size_t len)
rhs = chars_spec2str(p->symtab, word, len, &sz);
if (rhs)
encode(p, rhs, sz);
+ else if (DECO_SSPECIAL == d)
+ encode(p, word, len);
}
@@ -519,7 +522,9 @@ term_word(struct termp *p, const char *word)
res(p, seq, ssz);
break;
case (DECO_SPECIAL):
- spec(p, seq, ssz);
+ /* FALLTHROUGH */
+ case (DECO_SSPECIAL):
+ spec(p, deco, seq, ssz);
break;
case (DECO_BOLD):
term_fontrepl(p, TERMFONT_BOLD);