source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Render roff escape sequences contained in manual page
@ 2014-05-07 16:19 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-05-07 16:19 UTC (permalink / raw)
  To: source

Log Message:
-----------
Render roff escape sequences contained in manual page descriptions 
before putting them into the mpages table.
Issue found by bentley@ in OpenBSD::Getopt(3p).

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.147
retrieving revision 1.148
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.147 -r1.148
--- mandocdb.c
+++ mandocdb.c
@@ -2036,12 +2036,21 @@ dbadd(struct mpage *mpage, struct mchars
 	if (debug)
 		say(mlink->file, "Adding to database");
 
+	i = strlen(mpage->desc) + 1;
+	key = mandoc_calloc(1, sizeof(struct str) + i);
+	memcpy(key->key, mpage->desc, i);
+	render_key(mc, key);
+
 	i = 1;
-	SQL_BIND_TEXT(stmts[STMT_INSERT_PAGE], i, mpage->desc);
+	SQL_BIND_TEXT(stmts[STMT_INSERT_PAGE], i, key->rendered);
 	SQL_BIND_INT(stmts[STMT_INSERT_PAGE], i, FORM_SRC == mpage->form);
 	SQL_STEP(stmts[STMT_INSERT_PAGE]);
 	mpage->pageid = sqlite3_last_insert_rowid(db);
 	sqlite3_reset(stmts[STMT_INSERT_PAGE]);
+
+	if (key->rendered != key->key)
+		free(key->rendered);
+	free(key);
 
 	while (NULL != mlink) {
 		dbadd_mlink(mlink);
--
 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:[~2014-05-07 16:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-07 16:19 mdocml: Render roff escape sequences contained in manual page schwarze

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).