-/* $OpenBSD: main.c,v 1.255 2020/07/21 15:08:48 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.256 2021/02/19 19:49:49 kn Exp $ */
/*
* Copyright (c) 2010-2012, 2014-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
if (outst->use_pager) {
outst->use_pager = 0;
outst->tag_files = term_tag_init(conf->output.outfilename,
+ outst->outtype == OUTT_HTML ? ".html" : "",
conf->output.tagfilename);
if ((conf->output.outfilename != NULL ||
conf->output.tagfilename != NULL) &&
-/* $OpenBSD: term_tag.c,v 1.5 2020/07/21 15:08:49 schwarze Exp $ */
+/* $OpenBSD: term_tag.c,v 1.6 2021/02/19 19:49:49 kn Exp $ */
/*
* Copyright (c) 2015,2016,2018,2019,2020 Ingo Schwarze <schwarze@openbsd.org>
*
* but for simplicity, create it anyway.
*/
struct tag_files *
-term_tag_init(const char *outfilename, const char *tagfilename)
+term_tag_init(const char *outfilename, const char *suffix,
+ const char *tagfilename)
{
struct sigaction sa;
int ofd; /* In /tmp/, dup(2)ed to stdout. */
/* Create both temporary output files. */
if (outfilename == NULL) {
- (void)strlcpy(tag_files.ofn, "/tmp/man.XXXXXXXXXX",
- sizeof(tag_files.ofn));
- if ((ofd = mkstemp(tag_files.ofn)) == -1) {
+ (void)snprintf(tag_files.ofn, sizeof(tag_files.ofn),
+ "/tmp/man.XXXXXXXXXX%s", suffix);
+ if ((ofd = mkstemps(tag_files.ofn, strlen(suffix))) == -1) {
mandoc_msg(MANDOCERR_MKSTEMP, 0, 0,
"%s: %s", tag_files.ofn, strerror(errno));
goto fail;
-/* $OpenBSD: term_tag.h,v 1.3 2020/07/21 15:08:49 schwarze Exp $ */
+/* $OpenBSD: term_tag.h,v 1.4 2021/02/19 19:49:49 kn Exp $ */
/*
* Copyright (c) 2015, 2018, 2019, 2020 Ingo Schwarze <schwarze@openbsd.org>
*
};
-struct tag_files *term_tag_init(const char *, const char *);
+struct tag_files *term_tag_init(const char *, const char *, const char *);
void term_tag_write(struct roff_node *, size_t);
int term_tag_close(void);
void term_tag_unlink(void);