From: utzoo!decvax!pur-ee!purdue!rlb Newsgroups: net.bugs.4bsd Title: tgetent() in termlib has a bug Article-I.D.: purdue.322 Posted: Wed Aug 4 00:42:59 1982 Received: Wed Aug 4 04:57:09 1982 tgetent() uses a global variable named "hopcount" to detect and reject long tc= chains in the termcap file. "hopcount" is assumed to be initially zero, which it is, and then is incremented and compared to 32 each time a tc= statement is encountered in termcap. This causes a problem in programs that call tgetent several times (notably Gosling's emacs on restarting from a pause) "hopcount" is never reset to zero, ever. Thus, if you have one tc= statement in the capability for your terminal, on your 32nd restart into emacs, the editor crashes with an "infinite tc= loop" error. It's even worse on our ADDS regent 40 terminals which have a tc= chain of about five. The solution is to place the statement hopcount = 0; near the beginning of tgetent() in termcap.c. Note that if you use tset to define the TERMCAP environment variable, this problem doesn't arise since the tc= chains are resolved by tset. Bob Brown (rlb) Purdue-CS (317)494-6530