- if (m->meta.name)
- return(1);
-
- (void)xstrlcpys(buf, m->last->child, sizeof(buf));
- m->meta.name = xstrdup(buf);
+ assert(sz);
+ p[0] = '\0';
+ for ( ; n; n = n->next) {
+ assert(MDOC_TEXT == n->type);
+ /*
+ * XXX: yes, these can technically be resized, but it's
+ * highly unlikely that we're going to get here, so let
+ * it slip for now.
+ */
+ if (strlcat(p, n->string, sz) >= sz) {
+ mdoc_nmsg(m, n, MANDOCERR_MEM);
+ return(0);
+ }
+ if (NULL == n->next)
+ continue;
+ if (strlcat(p, " ", sz) >= sz) {
+ mdoc_nmsg(m, n, MANDOCERR_MEM);
+ return(0);
+ }
+ }