To: vim-dev@vim.org Subject: Patch 5.6.092 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.092 Problem: FreeBSD: When setting $TERM to a non-valid terminal name, Vim hangs in tputs(). Solution: After tgetent() returns an error code, call it again with the terminal name "dumb". This apparently creates an environment in which tputs() doesn't fail. Files: src/term.c *** ../vim-5.6.91/src/term.c Wed Apr 12 20:42:06 2000 --- src/term.c Tue Jun 6 15:33:43 2000 *************** *** 1931,1944 **** int i; i = TGETENT(tbuf, term); ! if (i == -1) ! return (char_u *)"Cannot open termcap file"; ! if (i == 0) #ifdef TERMINFO ! return (char_u *)"Terminal entry not found in terminfo"; #else ! return (char_u *)"Terminal entry not found in termcap"; #endif return NULL; } --- 1931,1952 ---- int i; i = TGETENT(tbuf, term); ! if (i < 1) ! { ! /* On FreeBSD tputs() gets a SEGV after a tgetent() which fails. Call ! * tgetent() with the always existing "dumb" entry to avoid a crash or ! * hang. */ ! (void)TGETENT(tbuf, "dumb"); ! ! if (i == -1) ! return (char_u *)"Cannot open termcap file"; ! if (i == 0) #ifdef TERMINFO ! return (char_u *)"Terminal entry not found in terminfo"; #else ! return (char_u *)"Terminal entry not found in termcap"; #endif + } return NULL; } *************** *** 1972,1978 **** { char_u tbuf[TBUFSZ]; ! if (T_NAME != NULL && *T_NAME != NUL && TGETENT(tbuf, T_NAME) > 0) { if (Columns == 0) Columns = tgetnum("co"); --- 1980,1986 ---- { char_u tbuf[TBUFSZ]; ! if (T_NAME != NULL && *T_NAME != NUL && tgetent_error(tbuf, T_NAME) == NULL) { if (Columns == 0) Columns = tgetnum("co"); *** ../vim-5.6.91/src/version.c Tue Jun 6 14:13:00 2000 --- src/version.c Tue Jun 6 15:25:21 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 92, /**/ -- BLACK KNIGHT: I'm invincible! ARTHUR: You're a looney. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/