Mysterious transformation of tset(1) output on Suns

Bill Shannon shannon at sun.uucp
Mon Oct 14 17:52:55 AEST 1985


Within the termcap library, whenever you do a tgetent, it tries to find
out the size of the current window.  It does this by doing an ioctl on
stdout.  Almost always, when using termcap, stdout is the tty/window
you're going to do termcap things to.  If the ioctl succeeds, tgetent
modifies the normal termcap entry to insert new "li" and "co" entries
at the front (where they'll be found before the attributes in the
normal termcap entry).  This explains why it fails when you pipe the
output through cat but succeeds in almost all real cases.

					Bill Shannon


P.S.  Not mentioned above is the fact that if the window size changes
after doing the tgetent, the program must've set itself up to notice
the change (catch the SIGWINCH signal) and do the ioctl itself to get
the new window size.



More information about the Comp.unix.wizards mailing list