VT100/UNIX Aegis VT100/UNIX
NAME
vt100/unix - Using the vt100 emulator with a Remote UNIX(R) System
Running 'termcap'
DESCRIPTION
The following are some tips for using the vt100 emulator when the remote
host is a UNIX(R) system that has the termcap facility.
Most users set the term and termcap environment variables by running
the UNIX system through the vt100 emulator, you should specify
that your terminal is a vt132, which is a vt100 with
insert/delete character and insert/delete lines capabilities. The only
difference is that a real vt132 is always 24 lines by 80 columns, and
the emulator will use as many lines and columns as will fit in the DM
window. However, you can automatically modify your termcap variable at
login time so that the li and co capabilities reflect the actual size of
the emulator screen. To do so, place the following two lines, or
something similar, in your .login file (this would need to be
changed slightly for use in a .profile file):
tset -s -i vt132 >tset1.$$; setsize <tset1.$$ >tset.$$
source tset.$$; stty nl0; rm tset.$$ tset1.$$
where setsize is the following c-shell script:
#
set size=`sz`
set lines=$size[1]
set columns=$size[2]
sed -e "s/li#[0-9]*:/li#${lines}:/" -e "s/co#[0-9]*:/co#${columns}:/"
and sz is a C program, shown below:
#include <stdio.h>
#include <sgtty.h>
main()
{
FILE *fp;
int fd, lines, columns;
struct sgttyb otty, ntty;
fd = fileno(stderr);
if (gtty(fd, &otty) < 0)
perror("gtty"), exit(3);
ntty = otty;
ntty.sg_flags = (ntty.sg_flags & ~ECHO) | RAW;
stty(fd, &ntty);
write(fd, " 33[50n", 5);
fscanf(stdin, " 33[%d;%dS", &lines, &columns);
stty(fd, &otty);
printf("%d %d0, lines, columns);
}
This program sends ESC[50n to the emulator. This is a non-standard
escape sequence, in response to which the emulator sends back the
current screen size, in the form ESC[nn;mmS, where nn is the number of
lines, and mm is the number of columns.
Note:
In order for programs such as 'vi' to work properly in windows
larger than 24 lines, there is one change you must make to the
termcap entry for vt100. The sf (scroll forward)
capability is given as sf=30E7E[24HEDE8. This works by saving
the cursor (ESC 7), moving to the bottom line (ESC[24H, which
moves the cursor to the 24th line), doing an index operation (ESC
D), and restoring the cursor (ESC 8). The problem, of course, is
that line 24 may not be the bottom line. This can be fixed by
changing the 24 to some very large number, say 200, since
trying to move the cursor outside the bounds of the screen always
causes it to be placed at the edge of the screen. Thus this change
is safe to make, even when a real vt100 terminal is being used.