[comp.unix.questions] curses & terminfo questions

wilber@alice.att.com (rew) (06/23/91)

I have a couple of curses and terminfo questions.

First, just what, precisely, does initscr() do?  First, can I count on it
having called savetty(), so that 

	initscr();
	resetty();

has the effect of resetting the terminal modes to what they were before
initscr() was called?  (And, if so, how does one set the terminal back to
the modes curses uses, after having called resetty()?  Calling initscr()
won't do since it will clear out stdscr.)

Second, does initscr() send the termcap "ti"/ terminfo "smcup" (enter cursor
address mode) string and the termcap "vs" / terminfo "cvvis" (cursor very
visible) string?

Basically, I want to know what must be done to provide a "subshell" capability
within a curses program.  E.g., "!" gives you a subshell with the terminal
reset to its normal state, and then exiting the subshell puts you back into
curses with the terminal set for full screen cursor addressing.  If in fact
initscr does send the ti and vs strings then the subshell routine must undo
this by sending te and ve (and then, when the subshell is exited, resending ti
and vs).

Similarly, precisely what does the terminfo routine setupterm() do?
The documentation I have says it "initializes the terminal".  Does that mean
that it frobs around with any ioctl calls for the terminal?  If so, what
gets twiddled?  And does setupterm() send the smcup string?

Finally, is there any way within curses to find out if a terminal has a 
usable standout mode?  (I.e., some way to tell if standout() and standend()
are actually doing anything?)

Bob Wilber    wilber@homxb.att.com

wilber@alice.att.com (rew) (06/23/91)

I wrote:
>... And, if so, how does one set the terminal back to
>the modes curses uses, after having called resetty()?  Calling initscr()
>won't do since it will clear out stdscr.

After groveling around on about six different flavors of Unix, I've
found that most versions of curses have fixterm(), which does the job.
But some BSD based systems don't have fixterm().  So how do I deal with
this problem on systems with bare bones versions of curses?

Bob Wilber    wilber@homxb.att.com