=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_html.c,v retrieving revision 1.72 retrieving revision 1.73 diff -c -r1.72 -r1.73 *** src/usr.bin/mandoc/mdoc_html.c 2014/04/20 20:17:36 1.72 --- src/usr.bin/mandoc/mdoc_html.c 2014/04/23 16:07:06 1.73 *************** *** 1,4 **** ! /* $Id: mdoc_html.c,v 1.72 2014/04/20 20:17:36 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze --- 1,4 ---- ! /* $Id: mdoc_html.c,v 1.73 2014/04/23 16:07:06 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze *************** *** 511,529 **** static int mdoc_root_pre(MDOC_ARGS) { - char b[BUFSIZ]; struct htmlpair tag[3]; struct tag *t, *tt; ! char *title; ! strlcpy(b, meta->vol, BUFSIZ); - if (meta->arch) { - strlcat(b, " (", BUFSIZ); - strlcat(b, meta->arch, BUFSIZ); - strlcat(b, ")", BUFSIZ); - } - mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec); PAIR_SUMMARY_INIT(&tag[0], "Document Header"); --- 511,526 ---- static int mdoc_root_pre(MDOC_ARGS) { struct htmlpair tag[3]; struct tag *t, *tt; ! char *volume, *title; ! if (NULL == meta->arch) ! volume = mandoc_strdup(meta->vol); ! else ! mandoc_asprintf(&volume, "%s (%s)", ! meta->vol, meta->arch); mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec); PAIR_SUMMARY_INIT(&tag[0], "Document Header"); *************** *** 547,553 **** PAIR_CLASS_INIT(&tag[0], "head-vol"); PAIR_INIT(&tag[1], ATTR_ALIGN, "center"); print_otag(h, TAG_TD, 2, tag); ! print_text(h, b); print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "head-rtitle"); --- 544,550 ---- PAIR_CLASS_INIT(&tag[0], "head-vol"); PAIR_INIT(&tag[1], ATTR_ALIGN, "center"); print_otag(h, TAG_TD, 2, tag); ! print_text(h, volume); print_stagq(h, tt); PAIR_CLASS_INIT(&tag[0], "head-rtitle"); *************** *** 557,562 **** --- 554,560 ---- print_tagq(h, t); free(title); + free(volume); return(1); } *************** *** 989,996 **** PAIR_STYLE_INIT(&tag[0], h); assert(lists[n->norm->Bl.type]); ! strlcpy(buf, "list ", BUFSIZ); ! strlcat(buf, lists[n->norm->Bl.type], BUFSIZ); PAIR_INIT(&tag[1], ATTR_CLASS, buf); /* Set the block's left-hand margin. */ --- 987,994 ---- PAIR_STYLE_INIT(&tag[0], h); assert(lists[n->norm->Bl.type]); ! (void)strlcpy(buf, "list ", BUFSIZ); ! (void)strlcat(buf, lists[n->norm->Bl.type], BUFSIZ); PAIR_INIT(&tag[1], ATTR_CLASS, buf); /* Set the block's left-hand margin. */ *************** *** 1359,1364 **** --- 1357,1371 ---- if (NULL != (n = n->next)) { assert(MDOC_TEXT == n->type); + + /* + * XXX This is broken and not easy to fix. + * When using -Oincludes, truncation may occur. + * Dynamic allocation wouldn't help because + * passing long strings to buffmt_includes() + * does not work either. + */ + strlcpy(buf, '<' == *n->string || '"' == *n->string ? n->string + 1 : n->string, BUFSIZ); *************** *** 1471,1480 **** t = print_otag(h, TAG_B, 1, tag); ! if (sp) { ! strlcpy(nbuf, sp, BUFSIZ); ! print_text(h, nbuf); ! } print_tagq(h, t); --- 1478,1485 ---- t = print_otag(h, TAG_B, 1, tag); ! if (sp) ! print_text(h, sp); print_tagq(h, t);