From 84680f53fcf50f9c0d74c7e6cd5986183774cd75 Mon Sep 17 00:00:00 2001 From: schwarze Date: Mon, 13 Nov 2023 19:13:00 +0000 Subject: [PATCH] Reduce the man(7) default global indentation from 7n, which was an oddity in groff-1.01 to groff-1.22.4, to 5n for compatibility with Version 7 AT&T UNIX, 4.3BSD-Reno, groff-1.23.0, and all versions of mdoc(7). OK jmc@ millert@ --- usr.bin/mandoc/man_macro.c | 4 ++-- usr.bin/mandoc/man_term.c | 17 ++++++----------- usr.bin/mandoc/mandoc.1 | 12 ++++-------- usr.bin/mandoc/mdoc_term.c | 7 +------ usr.bin/mandoc/term_ascii.c | 7 +++---- 5 files changed, 16 insertions(+), 31 deletions(-) diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c index f73ad970b7f..b0800c18173 100644 --- a/usr.bin/mandoc/man_macro.c +++ b/usr.bin/mandoc/man_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_macro.c,v 1.110 2023/10/24 20:30:49 schwarze Exp $ */ +/* $OpenBSD: man_macro.c,v 1.111 2023/11/13 19:13:00 schwarze Exp $ */ /* * Copyright (c) 2012-2015,2017-2020,2022 Ingo Schwarze * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons @@ -312,7 +312,7 @@ blk_exp(MACRO_PROT_ARGS) if (tok == MAN_RS) { if (roff_getreg(man->roff, "an-margin") == 0) roff_setreg(man->roff, "an-margin", - 7 * 24, '='); + 5 * 24, '='); if ((head->aux = strtod(p, NULL) * 24.0) > 0) roff_setreg(man->roff, "an-margin", head->aux, '+'); diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 5fa9bc1bfc7..7ebcb75fa45 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_term.c,v 1.196 2023/10/24 20:30:49 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.197 2023/11/13 19:13:00 schwarze Exp $ */ /* * Copyright (c) 2010-15,2017-20,2022-23 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons @@ -151,19 +151,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; @@ -193,7 +189,6 @@ terminal_man(void *arg, const struct roff_meta *man) print_man_nodelist(p, &mt, n, man); term_end(p); } - p->defindent = save_defindent; } /* @@ -502,7 +497,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: @@ -678,7 +673,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); /* @@ -719,7 +714,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); /* @@ -803,7 +798,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; } diff --git a/usr.bin/mandoc/mandoc.1 b/usr.bin/mandoc/mandoc.1 index 527511c5f2a..024458339c8 100644 --- a/usr.bin/mandoc/mandoc.1 +++ b/usr.bin/mandoc/mandoc.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mandoc.1,v 1.192 2023/10/24 20:30:49 schwarze Exp $ +.\" $OpenBSD: mandoc.1,v 1.193 2023/11/13 19:13:00 schwarze Exp $ .\" .\" Copyright (c) 2012, 2014-2023 Ingo Schwarze .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: October 24 2023 $ +.Dd $Mdocdate: November 13 2023 $ .Dt MANDOC 1 .Os .Sh NAME @@ -287,10 +287,7 @@ arguments are accepted: .It Cm indent Ns = Ns Ar indent The left margin for normal text is set to .Ar indent -blank characters instead of the default of five for -.Xr mdoc 7 -and seven for -.Xr man 7 . +blank characters instead of the default of five. Increasing this is not recommended; it may result in degraded formatting, for example overfull lines or ugly line breaks. When output is to a pager on a terminal that is less than 66 columns @@ -302,8 +299,7 @@ input files in .Xr mdoc 7 output style. This prints the operating system name rather than the page title -on the right side of the footer line, and it implies -.Fl O Cm indent Ns =5 . +on the right side of the footer line. One useful application is for checking that .Fl T Cm man output formats in the same way as the diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 895649caa50..2979434c201 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_term.c,v 1.281 2022/09/11 09:12:47 schwarze Exp $ */ +/* $OpenBSD: mdoc_term.c,v 1.282 2023/11/13 19:13:00 schwarze Exp $ */ /* * Copyright (c) 2010, 2012-2020, 2022 Ingo Schwarze * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons @@ -248,7 +248,6 @@ terminal_mdoc(void *arg, const struct roff_meta *mdoc) { struct roff_node *n, *nn; struct termp *p; - size_t save_defindent; p = (struct termp *)arg; p->tcol->rmargin = p->maxrmargin = p->defrmargin; @@ -273,9 +272,6 @@ terminal_mdoc(void *arg, const struct roff_meta *mdoc) print_mdoc_nodelist(p, NULL, mdoc, n); term_newln(p); } else { - save_defindent = p->defindent; - if (p->defindent == 0) - p->defindent = 5; term_begin(p, print_mdoc_head, print_mdoc_foot, mdoc); while (n != NULL && (n->type == ROFFT_COMMENT || @@ -287,7 +283,6 @@ terminal_mdoc(void *arg, const struct roff_meta *mdoc) print_mdoc_nodelist(p, NULL, mdoc, n); } term_end(p); - p->defindent = save_defindent; } } diff --git a/usr.bin/mandoc/term_ascii.c b/usr.bin/mandoc/term_ascii.c index 9aed8551fef..0db46eac8fa 100644 --- a/usr.bin/mandoc/term_ascii.c +++ b/usr.bin/mandoc/term_ascii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: term_ascii.c,v 1.54 2022/08/16 17:44:53 schwarze Exp $ */ +/* $OpenBSD: term_ascii.c,v 1.55 2023/11/13 19:13:00 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014,2015,2017,2018,2020 Ingo Schwarze @@ -64,6 +64,7 @@ ascii_init(enum termenc enc, const struct manoutput *outopts) p->maxtcol = 1; p->line = 1; + p->defindent = 5; p->defrmargin = p->lastrmargin = 78; p->fontq = mandoc_reallocarray(NULL, (p->fontsz = 8), sizeof(*p->fontq)); @@ -112,10 +113,8 @@ ascii_init(enum termenc enc, const struct manoutput *outopts) } } - if (outopts->mdoc) { + if (outopts->mdoc) p->mdocstyle = 1; - p->defindent = 5; - } if (outopts->indent) p->defindent = outopts->indent; if (outopts->width) -- 2.20.1