aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 8472b8f3..fac902bc 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.265 2014/04/20 19:40:13 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.266 2014/04/20 20:18:12 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -30,6 +30,7 @@
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "term.h"
#include "mdoc.h"
@@ -441,9 +442,10 @@ print_mdoc_foot(struct termp *p, const void *arg)
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;
@@ -473,7 +475,7 @@ print_mdoc_head(struct termp *p, const void *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;
@@ -508,6 +510,7 @@ print_mdoc_head(struct termp *p, const void *arg)
p->flags &= ~TERMP_NOSPACE;
p->offset = 0;
p->rmargin = p->maxrmargin;
+ free(title);
}
static size_t