From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (kristaps@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id pB90n18F011904 for ; Thu, 8 Dec 2011 19:49:02 -0500 (EST) Received: (from kristaps@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id pB90n1gQ004200; Thu, 8 Dec 2011 19:49:01 -0500 (EST) Date: Thu, 8 Dec 2011 19:49:01 -0500 (EST) Message-Id: <201112090049.pB90n1gQ004200@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Strip backspace encoding from preformatted manuals. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Strip backspace encoding from preformatted manuals. This cleans up a lot of catpage entries in the mandoc databases. Modified Files: -------------- mdocml: mandocdb.c Revision Data ------------- Index: mandocdb.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v retrieving revision 1.28 retrieving revision 1.29 diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.28 -r1.29 --- mandocdb.c +++ mandocdb.c @@ -1336,6 +1336,18 @@ pformatted(DB *hash, struct buf *buf, st 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); -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv