- if (-1 == (*index->put)(index, &rkey, &rval, 0)) {
- perror(ibbuf);
- break;
- }
+ msec = NULL != mdoc ?
+ mdoc_meta(mdoc)->msec :
+ man_meta(man)->msec;
+ mtitle = NULL != mdoc ?
+ mdoc_meta(mdoc)->title :
+ man_meta(man)->title;
+
+ assert(msec);
+ assert(mtitle);
+
+ /*
+ * The index record value consists of a nil-terminated
+ * filename, a nil-terminated manual section, and a
+ * nil-terminated description. Since the description
+ * may not be set, we set a sentinel to see if we're
+ * going to write a nil byte in its place.
+ */
+
+ dbt_init(&rval, &rsz);
+ dbt_appendb(&rval, &rsz, fn, strlen(fn) + 1);
+ dbt_appendb(&rval, &rsz, msec, strlen(msec) + 1);
+ dbt_appendb(&rval, &rsz, mtitle, strlen(mtitle) + 1);
+ sv = rval.size;
+
+ /* Fix the record number in the btree value. */