summaryrefslogtreecommitdiffstats
path: root/mandocdb.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-12-09 00:49:01 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-12-09 00:49:01 +0000
commitb88c62abf487d22b91a7f73aae5eb2b897822afc (patch)
tree1017808a5db564c1bcf0f5fa4420f709269fd456 /mandocdb.c
parenta1b7401425f44a0e342e72a2eb2c412fe430a434 (diff)
downloadmandoc-b88c62abf487d22b91a7f73aae5eb2b897822afc.tar.gz
Strip backspace encoding from preformatted manuals. This cleans up a lot
of catpage entries in the mandoc databases.
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 64e85414..9cbdd8c9 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1336,6 +1336,18 @@ pformatted(DB *hash, struct buf *buf, struct buf *dbuf,
p[plen] = '\0';
}
+ /* Strip backspace-encoding from line. */
+
+ while (NULL != (line = memchr(p, '\b', plen))) {
+ len = line - p;
+ if (0 == len) {
+ memmove(line, line + 1, plen--);
+ continue;
+ }
+ memmove(line - 1, line + 1, plen - len);
+ plen -= 2;
+ }
+
buf_appendb(dbuf, p, plen + 1);
buf->len = 0;
buf_appendb(buf, p, plen + 1);