[comp.sources.wanted] Curses to file or printer output filter sought

salem@fritz.sri.com (Bruce B. Salem) (12/02/89)

	I'm new to this type of group.
	I'd like to get a filter program that can except the stdout
of a curses program and produce an ordinary stream that could go to
a file or a printer and be read by a human. I know that curses
produces output that could update a two dimensional character array in
any order.
	I run a Sun-3 running Sun OS 4.0.X and Sunview.

Thanks,
	Bruce Salem	 salem@fritz.sri.com

andyb@coat.com (Andy Behrens) (12/06/89)

In article <6343@unix.SRI.COM> salem@fritz.sri.com (Bruce B. Salem) writes:
>	I'd like to get a filter program that can [accept] the stdout
> of a curses program and produce an ordinary stream that could go to
> a file or a printer and be read by a human.

No program is needed.  

Just tell curses that you are using a funny terminal that will clear
the screen when it sees the string "{clr}", that deletes a character
when it sees the string "{delc}", etc.

Save the file below under the name "faketermcap", and tell curses to
use it instead of /etc/termcap.

	setenv TERMCAP $HOME/faketermcap	(csh)

	TERMCAP=$HOME/faketermcap		(sh)
	export TERMCAP

If your own terminal isn't listed below, copy its entry from
/etc/termcap and edit all of the output attributes to be mnemonics
instead of escape sequences.  Sometimes you will have to override
default definitions, as in the case of cr (carriage return character)
and bs/bc (backspace character).

Sys V people can do all this by adding new terminfo entries, but it's a
little more work.

------------------------- Cut Here -------------------------
# These termcap entries will make curses display its output in
# human-readable form.  
#
# vt100 (has scrolling but no insert-line)
#
d0|vt100|vt100-am|dec vt100:\
	:cr={cr}:do={nl}:nl={nl}:co#80:li#24:\
	:cl=^M^J{clr}:\
	:sf={scrollfwd}:\
	:le={le}:bs@:bc={bs}:am:\
	:cm=^M^J{R%d,C%d}:\
	:nd={rt}:up={up}:\
	:ce={clreol}:\
	:cd={clreos}:\
	:so={so}:se={endso}:\
	:us={ul}:ue={endul}:\
	:md={bold}:mr={reverse}:\
	:mb={blink}:me={attr-off}:\
	:is=^M^J{initialize}:\
	:rs=^M^J{reset}:\
	:ks={keypad-xmit}:ke={end-keypad-xmit}:\
	:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
	:ho=^M^J{home}:\
	:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\
	:pt:\
	:sr={scrollrev}:\
	:vt#3:xn:\
	:sc={savecursor}:rc={restorecursor}:\
	:cs=^M^J{scrollregion %d-%d}:
#
# Televideo 925
# (Note that other vendors' emulations usually have :xn@:)
#
vi|tvi925|925|televideo model 925:\
	:hs:xn:am:bs@:bc={bs}:co#80:li#24:\
	:cm=^M^J{R%d,C%d}:\
	:cl=^M^J{clr}:\
	:cd={clreos}:\
	:ce={clreol}:\
	:is=^M^J{initialize}:\
	:al={add}:\
	:im=:ei=:\
	:ic={insc}:dc={delc}:\
	:ho=^M^J{home}:\
	:nd={rt}:bt={backtab}:\
	:pt:\
	:so={so}:se={endso}:sg#1:\
	:us={ul}:ue={endul}:ug#1:\
	:up={up}:do={dn}:\
	:kb=^H:ku=^K:kd=^V:kl=^H:kr=^L:kh=^^:\
	:k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:\
	:k8=^AG\r:k9=^AH\r:k0=^AI\r:\
	:ts={goto-status}:fs={exit-status}:ds={disable-status}:\
	:sr={scrollrev}:
#
# 'window' window-manager, with a full-screen window
#
WW|window|window package:\
	:cr={cr}:nl={nl}^M^J:bl=^G:ta={tab}:\
	:bs@:bc={bs}:am:mi:pt:\
	:al={add}:\
	:cd={clreos}:\
	:ce={clreol}:\
	:cl=^M^J{clr}:\
	:cm=^M^J{R%d,C%d}:\
	:dc={delc}:\
	:da:db:dl={dell}:\
	:up={up}:do={dn}:nd={rt}:le={le}:\
	:im={ins}:ei={endins}:\
	:ho=^M^J{home}:\
	:co#80:li#24:\
	:se={endso}:so={so}:\
	:ae={endgr}:as={gr}:
------------------------- End of Fake Termcap -------------------------

--
Live justly, love gently, walk humbly.
					Andy Behrens
					andyb@coat.com

uucp:   {uunet,rutgers}!dartvax!coat.com!andyb
bitnet: andyb%coat.com@dartcms1
Burlington Coat, PO Box 729, Lebanon, N.H. 03766	(603) 448-5000