Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site elsie.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!zehntel!hplabs!hao!seismo!umcp-cs!cvl!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: net.bugs.4bsd Subject: 4.[12] bsd multiple tgetent bug (with fix) (reposting) Message-ID: <1210@elsie.UUCP> Date: Fri, 14-Sep-84 18:58:33 EDT Article-I.D.: elsie.1210 Posted: Fri Sep 14 18:58:33 1984 Date-Received: Tue, 25-Sep-84 02:30:03 EDT Organization: NIH-LEC, Bethesda, MD Lines: 45 Patient-- /usr/src/lib/libtermlib/termcap.c in 4.1bsd /usr/src/usr.lib/libtermlib/termcap.c in 4.2bsd Condition-- Calling "tgetent" multiple times can result in spurious diagnostics. Stimulus-- #includemain() { int i; char buf[1024]; for (i = 1; i < 40 ; ++i) if (tgetent(buf, "vt100w") != 1) return 1; else printf("okay on pass %d\n"); return 0; } If you get an "Infinite tc= loop" diagnostic after a number of successful passes, you've got the bug. Diagnosis-- A variable named "hopcount" counts the total number of "tc=" constructs found in termcap entries. Alas, hopcount counts the total number of "tc="s found during the life of the process. Cure-- We'll go for minimizing changes to existing code here. ed /usr/src/lib/libtermlib/termcap.c g/return(tnchktc/i\ #ifdef OLDVERSION g/return(tnchktc/a\ #else\ i = tnchktc(); hopcount = 0; return i;\ #endif w q -- ...decvax!seismo!umcp-cs!elsie!ado (301) 496-5688 (DEC, VAX and Elsie are Digital Equipment Corp. and Borden's trademarks)