richmon@astrovax.UUCP (Michael Richmond) (07/16/85)
I quickly discovered that if I changed the size of a UNIX-running window on my 7300, programs such as vi would not realize that anything was different and editing was basically impossible. It turns out that vi looks at the $TERMCAP shell variable for its information, but there are several other environment variables that also keep track of the window size. So I wrote a little C program to find out how big a window is, and a shell script which puts the values found by the C program into the proper places in the environment. To make it work, do the following: 1. extract the files 'fix' and 'w_fix.c' from the end of this message by following the instructions. 2. compile 'w_fix.c' like so: cc w_fix.c -ltam -ltermcap -o w_fix and put it somewhere in your path, in the same directory as 'fix'. 3. whenever you change a window's shape or size, type . fix from the shell. It should take about two seconds to run. It has worked for me, and seems so useful that I thought I'd post it (here, because it is only useful for 7300 owners). Let me know if there are any problems. # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by richmon on Tue Jul 16 14:46:37 EDT 1985 # Contents: fix w_fix.c echo x - fix sed 's/^\@//' > "fix" <<'\@//E*O*F fix//' w_fix 2>&1 /dev/null LINES=`cat height` WNHEIGHT=LINES COLUMNS=`cat width` WNWIDTH=WNWIDTH export LINES WNHEIGHT COLUMNS WNWIDTH echo $TERMCAP | sed -e s/li#[0-9]\*/li#$LINES/ | sed -e s/co#[0-9]\*/co#$COLUMNS/ > foo TERMCAP=`cat foo` export TERMCAP /bin/rm foo height width \@//E*O*F fix// chmod u=rwx,g=rx,o=rx fix echo x - w_fix.c sed 's/^\@//' > "w_fix.c" <<'\@//E*O*F w_fix.c//' #include <stdio.h> #include <tam.h> main() { short win; WSTAT wstatp; FILE *f_height, *f_width, *fopen(); winit(); win = 0; if ((f_height = fopen("height", "w")) == NULL) { fprintf(stderr, "Can't open height - aborting\n"); exit(-1); } if ((f_width = fopen("width", "w")) == NULL) { fprintf(stderr, "Can't open width - aborting\n"); exit(-1); } wgetstat(win, &wstatp); fprintf(f_height, "%d", wstatp.height); fprintf(f_width, "%d", wstatp.width); wexit(); } \@//E*O*F w_fix.c// chmod u=rw,g=r,o=r w_fix.c exit 0 ########### CUT OUT THIS LINE AND ANY THAT FOLLOW ################## -- Michael Richmond Princeton University, Astrophysics {allegra,akgua,burl,cbosgd,decvax,ihnp4,noao,princeton,vax135}!astrovax!richmon