Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site pegasus.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!pegasus!hansen From: hansen@pegasus.UUCP (Tony L. Hansen) Newsgroups: net.micro.att,net.unix,net.sources,net.unix-wizards Subject: Re: 3B2 and 'tset' (the answer) Message-ID: <2598@pegasus.UUCP> Date: Thu, 19-Sep-85 23:56:38 EDT Article-I.D.: pegasus.2598 Posted: Thu Sep 19 23:56:38 1985 Date-Received: Sat, 21-Sep-85 03:23:15 EDT References: <167@darth.UUCP> Distribution: net Organization: AT&T Information Systems, Lincroft NJ Lines: 72 Keywords: tset, terminfo, termcap, curses Xref: watmath net.micro.att:561 net.unix:5686 net.sources:3487 net.unix-wizards:14915 Summary: a partial tset replacement for Vr2 < Back in the good(?) old days of System III and Version 7 there was a < terminal initialization program called 'tset'. Even though this is still < referenced in the 3B2 documentation in TERMINFO(4) I can find neither hide < nor hair of it. If anyone has implemented the equivalent function or knows < of one I would very much appreciate hearing about it. [I've cross-posted this to net.unix and net.unix-wizards because a similar question was posted in those newsgroups a couple of months ago and I never got around to replying to the question back then.] The tset program, created by Eric Allman at Berkeley, has several major functions: 1) determine the terminal type for setting $TERM, 2) initialize the terminal for screen-oriented programs, 3) initialize the carriage-return and newline delays in the tty driver, 4) set the erase/kill/interrupt characters, 5) initialize $TERMCAP, and, 6) reinitializing (resetting) the terminal. Number 5, setting $TERMCAP, is obviously not needed anymore with terminfo. Using the compiled terminfo entry is still faster than interpreting from the $TERMCAP variable. Number 4, setting ^H, etc., is handled just fine by stty. Personally I believe that number 1, setting $TERM, belongs in a separate program from the program that does numbers 2 and 3. A simple invocation of such a program, call it "getterm", would be: TERM=`getterm`; export TERM or setenv TERM `getterm` Of course, this program should do everything that tset used to do: looking in a database of hardwired lines and looking at your tty speed, then assuming or asking questions based on what it found. Number 2 is the most crucial step, terminal initialization. It is fairly easy to handle because of a tool provided with Unix System Vr2 called tput(1). My version of how to do terminal initialization follows. I call this shell "initterm". # initterm - initialize the terminal like tset used to do. eval `tput iprog` tput is1 tput is2 if [ -n "`tput ht`" ] then stty tabs; tabs -8 else stty -tabs fi cat -s "`tput if`" tput is3 Number 3, setting the carriage-return/newline delays, is non-trivial. If a program were written to do such a thing, it should be done after the above. Number 6, reset, could be done with very slight modifications to the above script, such as: RS1=`tput rs1` if [ -n "$RS1" ] then echo "$RS1" else tput is1 fi for each of the rs1/is1, rs2/is2, rs3/is3 and rf/if pairs. I hope that all of this helps. Tony Hansen ihnp4!pegasus!hansen Brought to you by Super Global Mega Corp .com