[comp.unix.questions] getting 'more' to not count termcap formatting strings

rg@msel.unh.edu (Roger Gonzalez) (02/07/91)

I wrote a termcap based hex file dump program that works really well, and
has lots of features, but it would be nice to be able to pipe the output
through 'more'.   'more' screws up because its count of characters coming
into it isn't the same as what actually gets shown on the screen.  Is there
a standard way to do this?  I had thought about sending all the termcap 
stuff to standard error, but then I realized I would have to flush
stderr's buffer after every formatting string to keep the output properly
interlaced (and it didn't seem that this would even necessarily be adequate
to keep the order correct.)  'more' handles underlining fine, but that's
programmed into it.  Am I out of luck?


-Roger

-- 
"The question of whether a computer can think is no more interesting
 than the question of whether a submarine can swim" - Edsgar W. Dijkstra 
rg@[msel|unhd].unh.edu        |  UNH Marine Systems Engineering Laboratory
r_gonzalez@unhh.bitnet        |  Durham, NH  03824-3525

hotte@sunrise.in-berlin.de (Horst Laumer) (02/12/91)

rg@msel.unh.edu (Roger Gonzalez) writes:

>I wrote a termcap based hex file dump program that works really well, and
>has lots of features, but it would be nice to be able to pipe the output
>through 'more'.   'more' screws up because its count of characters coming
>into it isn't the same as what actually gets shown on the screen.  Is there
>a standard way to do this?  I had thought about sending all the termcap 
>stuff to standard error, but then I realized I would have to flush
>stderr's buffer after every formatting string to keep the output properly
>interlaced (and it didn't seem that this would even necessarily be adequate
>to keep the order correct.)  'more' handles underlining fine, but that's
>programmed into it.  Am I out of luck?

>-Roger

Try less(), trust PD.
less offers lot of options, lets you page to and fro, invoke editor ...
real good stuff.

Horst
-- 
============================================================================
Horst Laumer, Kantstrasse 107, D-1000 Berlin 12 ! Bang-Adress: Junk-Food 
INET: hotte@sunrise.in-berlin.de                ! for Autorouters -- me --
UUCP: ..unido!fub!geminix!sunrise.in-berlin.de!hotte

peace@geiger.rtp.dg.com (John Peace) (02/19/91)

In article <1991Feb7.151700.11770@unhd.unh.edu> rg@msel.unh.edu (Roger Gonzalez) writes:
>I wrote a termcap based hex file dump program that works really well, and
>has lots of features, but it would be nice to be able to pipe the output
>through 'more'.   'more' screws up because its count of characters coming
>into it isn't the same as what actually gets shown on the screen.  Is there
>a standard way to do this?
>
Try 'more -f'.  This essentially turns off the pager's splitting of
long lines into multiple lines.  The non-printing escape sequences
won't confuse 'more' this way, but then each line of text is expected
to fit on one line of the screen.  Here's what more(1) says in TFM:

   -f   This causes 'more' to count logical lines, rather than
	screen lines.  That is, long lines are not folded.
	This option is recommended for viewing ul(1) output,
	since it may contain escape sequences.  These escape
	sequences contain characters which would ordinarily
	occupy screen positions, but which do not print when
	they are sent to the terminal as part of an escape
	sequence.  Thus 'more' may think that lines are longer
	than they actually are, and fold lines erroneously.

(I use 'more -f' all the time for viewing formatted man page output.)
----
John R. Peace			CSnet:       peace@dg-rtp.dg.com
Data General Corporation	UUCP:        ...!mcnc!rti!xyzzy!peace
Research Triangle Park, NC	Disclaimer:  Speaking for me, not DG.