home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!math.fu-berlin.de!mailgzrz.TU-Berlin.DE!news.netmbx.de!Germany.EU.net!urmel.informatik.rwth-aachen.de!gandalf!michael
- From: michael@gandalf.moria (Michael Haardt)
- Newsgroups: comp.unix.programmer
- Subject: Re: how does term[cap,lib] work
- Date: Mon, 04 Jan 93 23:18:13 +0100
- Organization: An old and gray machine, somewhere in Moria.
- Lines: 54
- Distribution: world
- Message-ID: <9301043449@gandalf.moria>
- References: <1993Jan3.201913.18477@umr.edu>
- Reply-To: u31b3hs@pool.informatik.rwth-aachen.de (Michael Haardt)
- NNTP-Posting-Host: messua.informatik.rwth-aachen.de
-
- In article <1993Jan3.201913.18477@umr.edu>, mcastle@cs.umr.edu (Michael R Castle) writes:
- > However, I'm a little unsure what to expect with programs that use
- > termcap/lib. It appears to me that the termcap functions return
- > string of escape sequence that would then be printed out rather
- > than executing the sequences themselves. Is this a correct
- > interpretations?
-
- Yes. I should add, that they are printed using tputs() and nothing
- else.
-
- > If it it, it looks like I may have a bit more
- > to look foward to than I had originally planned. :-/
-
- My way out once was to write termcap functions which return tokens in
- the strings. tputs looks like "switch (*token) { case CH: ... case CM: }"
- Note that you have to encode parameters in the string too, but all in
- all it is not hard to code.
-
- > Along the same lines. How does the SIGWINCH signal get propogated
- > along?
-
- I am not really sure about that, so the following explanations may be
- wrong: The process running with a pty slave as controlling tty gets
- SIGWINCH when the master side sets the winsize structure using ioctl().
-
- > Example: I start up an xterm and resize it. Does a program that
- > catch it then change it's TERMCAP environment variable to update
- > the new change?
-
- The usual reaction to SIGWINCH is either to reread co/li from termcap or
- get the winsize using ioctl(). Some termcap libraries read co/li not
- from /etc/termcap but from the winsize struct (if it contains valid
- values). Changing $TERMCAP might help the next program, but you can't
- change the environment of another already running process.
-
- > Also, how does stty figure into all this (does
- > stty send a SIGWINCH?) I notice if I do this, some programs,
- > like more(1) and vi(1) do the right thing. Are they catching
- > the signal, or checking the current tty information constantly?
-
- stty does an ioctl() to change winsize.
-
- > This last may cause problems because it's so easy under dos for a
- > program to change it's own window size and I'm curious as to how
- > programs handle this.
-
- My explainations are only valid (if at all) for systems which pass the
- winsize struct from master through kernel to slave side. If a system
- doesn't, you have no other way to find out the window size than to ask
- the window environment about it. At least I got told that concerning
- HP-UX, where a not-yet-famous editor asks xterm for the new size after
- getting SIGWINCH.
-
- Michael "doesn't like ptys and winsize structs"
-