Subject: Re: groff question: update needs less -R
To: None <>
From: Alan Barrett <>
List: tech-userlevel
Date: 06/15/2003 09:50:40
On Sun, 15 Jun 2003, Thomas Klausner wrote:
> One solution would be to add -R to the default pager options
> in usr.bin/man/pathconf.h. That should work, but users
> setting their own PAGER would probably have to adapt.
> less -R displays old-style man pages fine.

groff really should not be using ANSI escape sequences, unless it knows
that you have a terminal that can handle them.  It would be nice if
NetBSD's groff could have this bug fixed.

Last time you raised this issue (in February 2003), I demonstrated that
"less -R" does not do the right thing if you have a terminal that does
not handle ANSI escape sequences.  Here's part of my previous message

On Mon, 17 Feb 2003, Thomas Klausner wrote:
> I guess it does the right thing,
> /usr/pkg/bin/nroff -mandoc /some/random/man/page.1 | less -R
> works fine for me.

Doing the right thing requires parsing the escape sequences on input,
and translating them to whatever is appropriate for the output device.

I see no hint in the less man page that it will do that.  A brief test
suggests that it copies the escape sequences to the output without

	$ script
	Script started, output file is typescript
	$ printf '\e[3mfoo\e[0m\n' | TERM=hp2624 less -R
	[press 'q' to quit from less]
	$ exit
	Script done, output file is typescript
	$ hexdump -C typescript | less
	[observe a weird mixture of HP escape sequences combined
	 with the ANSI escape sequences copied from the input]

--apb (Alan Barrett)