Termcap questions/problems

Termcap questions/problems

Post by John Grov » Wed, 12 Feb 1992 04:27:43

For reasons I talked about in another post (see subject PTY) my users
need to change terminal types once they are logged in over ethernet.
They change *after* they are all logged in and their environment set up
for them. As they come in, they have a terminal type (chosen for them) of
ibm5081, which has 25 lines, and need to change to vt100 which has 24.
The problem is that, while they get the terminal type vt100, they *still*
have 25 rows on the display.

They change the terminal type while a menu (blech) program is running,
and the menu program uses termcap routines to change the terminal type,
and then retrieve the value for rows and columns. I include a Stupid
Program at the bottom of this article to illustrate what I mean.
I compile this with bsdcc and link with the curses library, that is:
bsdcc -o tcap tcap.c -lcurses

To recreate what happens, if you have a 25 line terminal (like hft),
try these things -- my results in parentheses:

1. run tcap     (I get 24 lines)

2. run tset then tcap  (now I get 25 lines!)

3. run "stty rows 0 cols 0" then tcap  (back to 24 lines!)

Can anybody explain this?

Stupid Program attached...

 * tcap.c -- Another Stupid Program by jgrover

#include        <stdio.h>

main()  {

        int indx, LINES, COLS;
        char bp[1024];
        char buf[256];
        int rc;

        indx = 0;
        strcpy(bp, "vt100");

        indx = tgetent(buf, bp);

        if(indx > 0){
                LINES = tgetnum("li");
                COLS = tgetnum("co");
                LINES = COLS = 0;

        fprintf(stdout, "bp=%s\n", bp);
        fprintf(stdout, "buf={%s}\n", buf);
        fprintf(stdout, "LINES=%d\n", LINES);
        fprintf(stdout, "COLS=%d\n", COLS);


John Grover
Computing Center
University of Maine


1. Reading termcap database other than termcap

        I have a hacked up copy of the printcap code from the BSD 'lpr'
command that implements a "caplib" library - generic "termcap" capabilities.
It differs from the "standard" termcap in that it wants to know the sizes
of the buffers passed to it, and checks for overflow. It also doesn't
support the egregious tc= kludge. There's no support for grabbing the
entry out of the environment, but that shouldn't be very hard at all.
[the way BSD does that also is a kludge - getting it out of the environment
or not should be done at a higher level than in capgetent(), IE: if there
is no XXXXCAP in the environment, *then* it uses capgetent(), etc]

        If anyone wants a copy, let me know.

        Good software will grow smaller and faster as time goes by and
the code is improved and features that proved to be less useful are
weeded out.     [from the programming notebooks of a heretic, 1990]

2. URGENT Makefile Help

3. Linux on Compaq Presario 1690 - PS2 problem or Termcap/Terminfo problem ?

4. HELP!! Lost partition, need tools to recover

5. termcap/terminfo question

6. Basic instructions for setting up home network (newbie)

7. RS/6000 termcap question

8. lilo help

9. /etc/termcap question

10. What happened to /etc/termcap? (+ mtools question)

11. Termcap question

12. Termcap/Terminfo question

13. newbie's termcap question