tag_files
outst->tag_files->tcpgid =
outst->tag_files->tcpgid = tc_pgid;
assert(outst->tag_files->ofd == -1);
assert(outst->tag_files->tfs == NULL);
if (*outst->tag_files->tfn != '\0' &&
argv[argc++] = mandoc_strdup(outst->tag_files->tfn);
outst->tag_files->ofn, tag_target);
argv[argc] = mandoc_strdup(outst->tag_files->ofn);
outst->tag_files->pager_pid = pager_pid;
outst.tag_files = NULL;
if (outst.tag_files != NULL) {
struct tag_files *tag_files; /* Tagging state variables. */
outst->tag_files = term_tag_init(conf->output.outfilename,
if (outst->tag_files != NULL) {
outst->tag_files->ofn, strerror(errno));
outst->tag_files = NULL;
(void)strlcpy(tag_files.tfn, "/tmp/man.XXXXXXXXXX",
sizeof(tag_files.tfn));
if ((tfd = mkstemp(tag_files.tfn)) == -1) {
"%s: %s", tag_files.tfn, strerror(errno));
(void)strlcpy(tag_files.tfn, tagfilename,
sizeof(tag_files.tfn));
if ((tag_files.tfs = fdopen(tfd, "w")) == NULL) {
return &tag_files;
if (tag_files.ofd != -1) {
close(tag_files.ofd);
tag_files.ofd = -1;
if (tag_files.tfs == NULL)
fprintf(tag_files.tfs, "%.*s %s %zu\n",
len, cp, tag_files.ofn, line);
if (tag_files.tfs != NULL) {
fclose(tag_files.tfs);
tag_files.tfs = NULL;
if (tag_files.ofd != -1) {
if ((irc = dup2(tag_files.ofd, STDOUT_FILENO)) == -1)
close(tag_files.ofd);
tag_files.ofd = -1;
if (tag_files.tcpgid != -1) {
if (tc_pgid == tag_files.pager_pid ||
(void)tcsetpgrp(STDOUT_FILENO, tag_files.tcpgid);
if (strncmp(tag_files.ofn, "/tmp/man.", 9) == 0) {
unlink(tag_files.ofn);
*tag_files.ofn = '\0';
if (strncmp(tag_files.tfn, "/tmp/man.", 9) == 0) {
unlink(tag_files.tfn);
*tag_files.tfn = '\0';
static struct tag_files tag_files;
struct tag_files *
tag_files.tfs = NULL;
tag_files.tcpgid = -1;
if ((tag_files.ofd = dup(STDOUT_FILENO)) == -1) {
(void)snprintf(tag_files.ofn, sizeof(tag_files.ofn),
if ((ofd = mkstemps(tag_files.ofn, strlen(suffix))) == -1) {
"%s: %s", tag_files.ofn, strerror(errno));
(void)strlcpy(tag_files.ofn, outfilename,
sizeof(tag_files.ofn));
struct tag_files *term_tag_init(const char *, const char *, const char *);