source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Strip backspace encoding from preformatted manuals.
@ 2011-12-09  0:49 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-12-09  0:49 UTC (permalink / raw)
  To: source

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-12-09  0:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-09  0:49 mdocml: Strip backspace encoding from preformatted manuals kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).