-/* $Id: man_html.c,v 1.52 2014/04/20 16:44:44 schwarze Exp $ */
+/* $Id: man_html.c,v 1.53 2014/04/20 20:17:36 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "html.h"
#include "man.h"
static void
man_root_pre(MAN_ARGS)
{
+ char b[BUFSIZ];
struct htmlpair tag[3];
struct tag *t, *tt;
- char b[BUFSIZ], title[BUFSIZ];
+ char *title;
b[0] = 0;
if (man->vol)
assert(man->title);
assert(man->msec);
- snprintf(title, BUFSIZ - 1, "%s(%s)", man->title, man->msec);
+ mandoc_asprintf(&title, "%s(%s)", man->title, man->msec);
PAIR_SUMMARY_INIT(&tag[0], "Document Header");
PAIR_CLASS_INIT(&tag[1], "head");
print_otag(h, TAG_TD, 2, tag);
print_text(h, title);
print_tagq(h, t);
+ free(title);
}
static void
-/* $Id: man_term.c,v 1.100 2014/04/20 16:44:44 schwarze Exp $ */
+/* $Id: man_term.c,v 1.101 2014/04/20 20:17:36 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "man.h"
#include "term.h"
static void
print_man_foot(struct termp *p, const void *arg)
{
- char title[BUFSIZ];
- size_t datelen;
- const struct man_meta *meta;
+ const struct man_meta *meta;
+ char *title;
+ size_t datelen;
meta = (const struct man_meta *)arg;
assert(meta->title);
if ( ! p->mdocstyle) {
term_vspace(p);
term_vspace(p);
- snprintf(title, BUFSIZ, "%s(%s)", meta->title, meta->msec);
+ mandoc_asprintf(&title, "%s(%s)",
+ meta->title, meta->msec);
} else if (meta->source) {
- strlcpy(title, meta->source, BUFSIZ);
+ title = mandoc_strdup(meta->source);
} else {
- title[0] = '\0';
+ title = mandoc_strdup("");
}
datelen = term_strlen(p, meta->date);
term_word(p, title);
term_flushln(p);
+ free(title);
}
static void
print_man_head(struct termp *p, const void *arg)
{
- char buf[BUFSIZ], title[BUFSIZ];
- size_t buflen, titlen;
- const struct man_meta *meta;
+ char buf[BUFSIZ];
+ const struct man_meta *meta;
+ char *title;
+ size_t buflen, titlen;
meta = (const struct man_meta *)arg;
assert(meta->title);
/* Top left corner: manual title and section. */
- snprintf(title, BUFSIZ, "%s(%s)", meta->title, meta->msec);
+ mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec);
titlen = term_strlen(p, title);
p->flags |= TERMP_NOBREAK | TERMP_NOSPACE;
term_vspace(p);
term_vspace(p);
}
+ free(title);
}
-/* $Id: mdoc_html.c,v 1.71 2014/04/20 16:44:44 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.72 2014/04/20 20:17:36 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "html.h"
#include "mdoc.h"
static int
mdoc_root_pre(MDOC_ARGS)
{
+ char b[BUFSIZ];
struct htmlpair tag[3];
struct tag *t, *tt;
- char b[BUFSIZ], title[BUFSIZ];
+ char *title;
strlcpy(b, meta->vol, BUFSIZ);
strlcat(b, ")", BUFSIZ);
}
- snprintf(title, BUFSIZ - 1, "%s(%s)", meta->title, meta->msec);
+ mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec);
PAIR_SUMMARY_INIT(&tag[0], "Document Header");
PAIR_CLASS_INIT(&tag[1], "head");
print_otag(h, TAG_TD, 2, tag);
print_text(h, title);
print_tagq(h, t);
+
+ free(title);
return(1);
}
-/* $Id: mdoc_term.c,v 1.167 2014/04/20 19:39:35 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.168 2014/04/20 20:17:36 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "term.h"
#include "mdoc.h"
static void
print_mdoc_head(struct termp *p, const void *arg)
{
- char buf[BUFSIZ], title[BUFSIZ];
- size_t buflen, titlen;
- const struct mdoc_meta *meta;
+ char buf[BUFSIZ];
+ const struct mdoc_meta *meta;
+ char *title;
+ size_t buflen, titlen;
meta = (const struct mdoc_meta *)arg;
strlcat(buf, ")", BUFSIZ);
}
- snprintf(title, BUFSIZ, "%s(%s)", meta->title, meta->msec);
+ mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec);
titlen = term_strlen(p, title);
p->flags |= TERMP_NOBREAK | TERMP_NOSPACE;
p->flags &= ~TERMP_NOSPACE;
p->offset = 0;
p->rmargin = p->maxrmargin;
+ free(title);
}
static size_t