[comp.unix.questions] How do I change the number of lines on my term?

wilber@sal-sun11.usc.edu (John Wilber) (08/18/90)

I'm having troubles changing the number of lines that the OS thinks I
have on my terminal.  Normally, I log into my Unix account here
remotely, and emulate a vt100 (setenv term vt100), and this works fine.
Sometimes, however, I login at an actual workstation, and no matter what
I do, I can't make the OS think that I have more than 25 lines on my
screen.

I am using Sun workstations running Sun OS 4.0.3, and yes I have RTFM'd.
I have tried the following commands:

   setenv term sun
   setenv term sun-34

What's wrong?  Do the terminal parameters only get initialized upon
starting up csh? (I'm using csh).

Thanks,

John
wilber@nunki.usc.edu

gt0178a@prism.gatech.EDU (BURNS,JIM) (08/19/90)

in article <11485@chaph.usc.edu>, wilber@sal-sun11.usc.edu (John Wilber) says:
> I'm having troubles changing the number of lines that the OS thinks I
> have on my terminal.  Normally, I log into my Unix account here
> remotely, and emulate a vt100 (setenv term vt100), and this works fine.
> Sometimes, however, I login at an actual workstation, and no matter what
> I do, I can't make the OS think that I have more than 25 lines on my
> screen.

This usually involves doing what tset does, (which sets TERMCAP, not just
TERM/term), with possibly also telling stty what your changes are. Following
is a function definition I amalgamated from the /etc/profiles on some of the
various machines I have access to. Put it in your .profile, or '.' it
(equivalent of csh source), and whenever you type 'term' in your login shell,
(or the shell you sourced it in), you can change your window size whenever
you want, so long as your termcap/terminfo supports dynamic sizing of the
term type you input. If they don't, you may have to set LINES and COLUMNS
manually, tho' I suspect this still won't work (tho' you could try editing
your TERMCAP string with sed to change the 'li#' and 'co#' entries.

The various processor tests are because not all systems support 'tput'.
With minor tweaking of syntax, like the if and while, and set noglob
instead of set -f, and unset noglob instead of set +f, you take the body
of this function and put it in a csh script you can source when you
want. You can also delete references to 'DEFAULT_TERM:-'.

term()
{
	set -x
	if [ ! -z "$1" ];then TERM=$1;fi
	set -f;
	while :
	do
	   eval `tset -s -Q -m "plugboard:?${DEFAULT_TERM:-ansi}" \
			    -m "network:?${DEFAULT_TERM:-ansi}" \
			    -m "unknown:?${DEFAULT_TERM:-ansi}" \
			    -m "sun:sun"`;
	   if [ "${TERM}" != unknown ]; then break; fi
	done; set +f
	if [ $PROCESSOR = 'libmac' ]
	then export LINES=$(tput lines) COLUMNS=$(tput cols)
	stty rows $LINES cols $COLUMNS
	fi
	if [ $PROCESSOR = 'richsun' ]
	then eval $(echo $TERMCAP | 
	awk -F: '{ for (i = 0; i <= NF; i++) 
	  ct[substr($i,1,2)] = substr($i,4,length($i)-3) } 
	  END { printf ("export LINES=%s COLUMNS=%s\n", ct["li"], ct["co"]) }' )
	stty rows $LINES cols $COLUMNS
	fi
}
-- 
BURNS,JIM
Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
Internet: gt0178a@prism.gatech.edu