summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2011-01-30 16:05:30 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2011-01-30 16:05:30 +0000
commit3346ee504d87b690135176bebeecf513a150d2a5 (patch)
tree0cd93d66b729a045304560fe34aa9039541c79ba /usr.bin/mandoc/term.c
parent110382a22b114cad0f9431e25d6699be6f8b4f74 (diff)
Implement the \N'number' (numbered character) roff escape sequence.
Don't use it in new manuals, it is inherently non-portable, but we need it for backward-compatibility with existing manuals, for example in Xenocara driver pages. ok kristaps@ matthieu@ jmc@
Diffstat (limited to 'usr.bin/mandoc/term.c')
-rw-r--r--usr.bin/mandoc/term.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c
index e2d136a1cca..3544fd4d603 100644
--- a/usr.bin/mandoc/term.c
+++ b/usr.bin/mandoc/term.c
@@ -1,7 +1,7 @@
-/* $Id: term.c,v 1.55 2011/01/04 22:28:17 schwarze Exp $ */
+/* $Id: term.c,v 1.56 2011/01/30 16:05:29 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -349,6 +349,17 @@ term_vspace(struct termp *p)
static void
+numbered(struct termp *p, const char *word, size_t len)
+{
+ const char *rhs;
+
+ rhs = chars_num2char(word, len);
+ if (rhs)
+ encode(p, rhs, 1);
+}
+
+
+static void
spec(struct termp *p, enum roffdeco d, const char *word, size_t len)
{
const char *rhs;
@@ -507,6 +518,9 @@ term_word(struct termp *p, const char *word)
word += a2roffdeco(&deco, &seq, &ssz);
switch (deco) {
+ case (DECO_NUMBERED):
+ numbered(p, seq, ssz);
+ break;
case (DECO_RESERVED):
res(p, seq, ssz);
break;