NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/58579: man(1) should make use of terminal width



The following reply was made to PR bin/58579; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/58579: man(1) should make use of terminal width
Date: Tue, 13 Aug 2024 05:34:25 +0000 (UTC)

 On Mon, 12 Aug 2024, gnats-admin%netbsd.org@localhost wrote:
 
 > This patch assumes man uses /usr/bin/mandoc to format the man pages
 > (what about /usr/pkg/bin/mandoc when using bsd userland commands on a
 > linux system, say?)  and hardcodes knowledge of its -Owidth option.
 >
 
 Yes, all that is deliberate: if the formatter isn't exactly `/usr/bin/mandoc',
 do nothing; if MANWIDTH isn't set (or bogus), do nothing; etc.
 
 > I don't think this is the right direction.
 >
 
 Oh, well... I can keep it as a local patch.
 
 > As I noted in a related mail thread a few years ago, one can *almost*
 > make MANWIDTH do the riht thing without any changes to the man command
 > with something like:
 >
 >   _build  .[1-9ln] /usr/bin/mandoc ${COLUMNS+-Owidth=${MANWIDTH:-$COLUMNS}} %s
 >
 
 Yeah, I had a shell-script `pcols' for that:
 
  	_build  .[1-9ln] /usr/bin/mandoc -O width=$(pcols)
 
 but, adding it everywhere, then the merging _another_ file during updates was
 just a headache.
 
 > [...]
 >
 > Any proposed solution must also support (being applicable to) nroff.
 > On obscenely fast machines the pro-mandoc speed argument is rather
 > weak and a user should be able to use the old
 >
 >     /usr/bin/nroff -msafer -man
 >
 > for its _build command
 >
 
 Right. I did think up a way to make this general--by introducing a new control
 keyword. Like:
 
 _build  .[1-9ln] ##_cmd## %s
 ...
 _cmd    /usr/bin/mandoc -O width=%V
 # _cmd  /usr/bin/nroff -rLL=%Vn -Tman
 
 then, replace %V with the column value and substitute `##_cmd##' with the
 expanded string. But, again, this is even more intrusive... which is why I
 went with the patch I sent in.
 
 > For the record, the way to tell nroff the page width with either old
 > man or mandoc is by setting number registers LL (length of line, like
 > .ll directive) and LT (length of title, like .lt) in 'n' units, e.g.
 > to format a man page to the width of 120 characters:
 >
 >     nroff -rLL=120n -rLT='\n(LL' -Tman
 >
 
 LL I knew, but not LT. Thanks.
 
 -RVP
 


Home | Main Index | Thread Index | Old Index