=================================================================== RCS file: /cvs/mandoc/man_term.c,v retrieving revision 1.243 retrieving revision 1.245 diff -u -p -r1.243 -r1.245 --- mandoc/man_term.c 2023/10/24 20:53:12 1.243 +++ mandoc/man_term.c 2025/06/26 17:06:34 1.245 @@ -1,6 +1,6 @@ -/* $Id: man_term.c,v 1.243 2023/10/24 20:53:12 schwarze Exp $ */ +/* $Id: man_term.c,v 1.245 2025/06/26 17:06:34 schwarze Exp $ */ /* - * Copyright (c) 2010-15,2017-20,2022-23 Ingo Schwarze + * Copyright (c) 2010-2020,2022-23,2025 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any @@ -153,19 +153,15 @@ terminal_man(void *arg, const struct roff_meta *man) struct mtermp mt; struct termp *p; struct roff_node *n, *nc, *nn; - size_t save_defindent; p = (struct termp *)arg; - save_defindent = p->defindent; - if (p->synopsisonly == 0 && p->defindent == 0) - p->defindent = 7; p->tcol->rmargin = p->maxrmargin = p->defrmargin; term_tab_set(p, NULL); term_tab_set(p, "T"); term_tab_set(p, ".5i"); memset(&mt, 0, sizeof(mt)); - mt.lmargin[mt.lmargincur] = term_len(p, p->defindent); + mt.lmargin[mt.lmargincur] = term_len(p, 7); mt.offset = term_len(p, p->defindent); mt.pardist = 1; @@ -195,7 +191,6 @@ terminal_man(void *arg, const struct roff_meta *man) print_man_nodelist(p, &mt, n, man); term_end(p); } - p->defindent = save_defindent; } /* @@ -504,7 +499,7 @@ pre_PP(DECL_ARGS) { switch (n->type) { case ROFFT_BLOCK: - mt->lmargin[mt->lmargincur] = term_len(p, p->defindent); + mt->lmargin[mt->lmargincur] = term_len(p, 7); print_bvspace(p, n, mt->pardist); break; case ROFFT_HEAD: @@ -680,7 +675,7 @@ pre_SS(DECL_ARGS) switch (n->type) { case ROFFT_BLOCK: - mt->lmargin[mt->lmargincur] = term_len(p, p->defindent); + mt->lmargin[mt->lmargincur] = term_len(p, 7); mt->offset = term_len(p, p->defindent); /* @@ -721,7 +716,7 @@ pre_SH(DECL_ARGS) switch (n->type) { case ROFFT_BLOCK: - mt->lmargin[mt->lmargincur] = term_len(p, p->defindent); + mt->lmargin[mt->lmargincur] = term_len(p, 7); mt->offset = term_len(p, p->defindent); /* @@ -805,7 +800,7 @@ pre_RS(DECL_ARGS) if (++mt->lmarginsz < MAXMARGINS) mt->lmargincur = mt->lmarginsz; - mt->lmargin[mt->lmargincur] = term_len(p, p->defindent); + mt->lmargin[mt->lmargincur] = term_len(p, 7); return 1; } @@ -1022,38 +1017,24 @@ print_man_foot(struct termp *p, const struct roff_meta char *title; size_t datelen, titlen; - assert(meta->title); - assert(meta->msec); - assert(meta->date); + assert(meta->title != NULL); + assert(meta->msec != NULL); term_fontrepl(p, TERMFONT_NONE); - if (meta->hasbody) term_vspace(p); - /* - * Temporary, undocumented option to imitate mdoc(7) output. - * In the bottom right corner, use the operating system - * instead of the title. - */ - - if ( ! p->mdocstyle) { - mandoc_asprintf(&title, "%s(%s)", - meta->title, meta->msec); - } else if (meta->os != NULL) { - title = mandoc_strdup(meta->os); - } else { - title = mandoc_strdup(""); - } datelen = term_strlen(p, meta->date); + mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec); + titlen = term_strlen(p, title); /* Bottom left corner: operating system. */ - p->flags |= TERMP_NOSPACE | TERMP_NOBREAK; - p->trailspace = 1; p->tcol->offset = 0; p->tcol->rmargin = p->maxrmargin > datelen ? (p->maxrmargin + term_len(p, 1) - datelen) / 2 : 0; + p->trailspace = 1; + p->flags |= TERMP_NOSPACE | TERMP_NOBREAK; if (meta->os) term_word(p, meta->os); @@ -1062,7 +1043,6 @@ print_man_foot(struct termp *p, const struct roff_meta /* At the bottom in the middle: manual date. */ p->tcol->offset = p->tcol->rmargin; - titlen = term_strlen(p, title); p->tcol->rmargin = p->maxrmargin > titlen ? p->maxrmargin - titlen : 0; p->flags |= TERMP_NOSPACE; @@ -1072,11 +1052,11 @@ print_man_foot(struct termp *p, const struct roff_meta /* Bottom right corner: manual title and section. */ - p->flags &= ~TERMP_NOBREAK; - p->flags |= TERMP_NOSPACE; - p->trailspace = 0; p->tcol->offset = p->tcol->rmargin; p->tcol->rmargin = p->maxrmargin; + p->trailspace = 0; + p->flags &= ~TERMP_NOBREAK; + p->flags |= TERMP_NOSPACE; term_word(p, title); term_flushln(p); @@ -1091,7 +1071,6 @@ print_man_foot(struct termp *p, const struct roff_meta p->tcol->offset = 0; p->flags = 0; - free(title); }