Subject: Re: groff update?
To: None <tech-userlevel@netbsd.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-userlevel
Date: 02/17/2003 16:50:45
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
translation.

	$ 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]

On Mon, 17 Feb 2003, Thomas Klausner wrote:
> On Mon, Feb 17, 2003 at 02:09:06PM +0000, David Laight wrote:
> > and what sort of terminal are you using?
> > probably an 'xterm' that understands ANSI escape sequences....
> 
> cd /usr/pkgsrc/textproc/groff && make install
> /usr/pkg/bin/nroff -mandoc /usr/share/man/man1/ssh.1 | less -R
> 
> Please try it yourself, it's not really a question only I can answer
> for you (less is doing the work, that's what -R is for....).

As far as I can tell, less is *not* doing the necessary work.  I assume
that it appears to work for you because you happen to be using a
terminal that understands ANSI escape sequences.

--apb (Alan Barrett)