home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.1.362 < prev    next >
Encoding:
Internet Message Format  |  2003-02-24  |  6.9 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.362
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.1.362
  11. Problem:    tgetent() may return zero for success. tgetflag() may return -1
  12.         for an error.
  13. Solution:   Check tgetflag() for returning a positive value.  Add an autoconf
  14.         check for the value that tgetent() returns.
  15. Files:        src/auto/configure, src/config.h.in, src/configure.in, src/term.c
  16.  
  17.  
  18. *** ../vim61.361/src/auto/configure    Mon Jan  6 21:55:57 2003
  19. --- src/auto/configure    Mon Feb 17 12:00:06 2003
  20. ***************
  21. *** 5423,5432 ****
  22.     echo "$ac_t""none found" 1>&6
  23.   fi
  24.   
  25.   echo $ac_n "checking whether termcap.h contains ospeed""... $ac_c" 1>&6
  26. ! echo "configure:5381: checking whether termcap.h contains ospeed" >&5
  27.   cat > conftest.$ac_ext <<EOF
  28. ! #line 5383 "configure"
  29.   #include "confdefs.h"
  30.   
  31.   #ifdef HAVE_TERMCAP_H
  32. --- 5501,5543 ----
  33.     echo "$ac_t""none found" 1>&6
  34.   fi
  35.   
  36. + if test "x$olibs" != "x$LIBS"; then
  37. +   echo $ac_n "checking what tgetent() returns for an unknown terminal""... $ac_c" 1>&6
  38. + echo "configure:5507: checking what tgetent() returns for an unknown terminal" >&5
  39. +   if test "$cross_compiling" = yes; then
  40. +   { echo "configure: error: failed to compile test program." 1>&2; exit 1; }
  41. + else
  42. +   cat > conftest.$ac_ext <<EOF
  43. + #line 5512 "configure"
  44. + #include "confdefs.h"
  45. + #ifdef HAVE_TERMCAP_H
  46. + # include <termcap.h>
  47. + #endif
  48. + main()
  49. + {char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
  50. + EOF
  51. + if { (eval echo configure:5521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  52. + then
  53. +   echo "$ac_t""zero" 1>&6; cat >> confdefs.h <<\EOF
  54. + #define TGETENT_ZERO_ERR 0
  55. + EOF
  56. + else
  57. +   echo "configure: failed program was:" >&5
  58. +   cat conftest.$ac_ext >&5
  59. +   rm -fr conftest*
  60. +   echo "$ac_t""non-zero" 1>&6
  61. + fi
  62. + rm -fr conftest*
  63. + fi
  64. + fi
  65.   echo $ac_n "checking whether termcap.h contains ospeed""... $ac_c" 1>&6
  66. ! echo "configure:5539: checking whether termcap.h contains ospeed" >&5
  67.   cat > conftest.$ac_ext <<EOF
  68. ! #line 5541 "configure"
  69.   #include "confdefs.h"
  70.   
  71.   #ifdef HAVE_TERMCAP_H
  72. *** ../vim61.361/src/config.h.in    Mon Jan  6 21:55:57 2003
  73. --- src/config.h.in    Sun Feb 16 18:31:10 2003
  74. ***************
  75. *** 135,140 ****
  76. --- 123,131 ----
  77.   /* Define if tgetstr() has a second argument that is (char *) */
  78.   #undef TGETSTR_CHAR_P
  79.   
  80. + /* Define if tgetent() returns zero for an error */
  81. + #undef TGETENT_ZERO_ERR
  82.   /* Define if the getcwd() function should not be used.  */
  83.   #undef BAD_GETCWD
  84.   
  85. *** ../vim61.361/src/configure.in    Mon Jan  6 21:55:57 2003
  86. --- src/configure.in    Mon Feb 17 11:59:46 2003
  87. ***************
  88. *** 1546,1551 ****
  89. --- 1597,1615 ----
  90.         AC_MSG_ERROR(failed to compile test program.))
  91.   else
  92.     AC_MSG_RESULT(none found)
  93. + fi
  94. + if test "x$olibs" != "x$LIBS"; then
  95. +   AC_MSG_CHECKING(what tgetent() returns for an unknown terminal)
  96. +   AC_TRY_RUN([
  97. + #ifdef HAVE_TERMCAP_H
  98. + # include <termcap.h>
  99. + #endif
  100. + main()
  101. + {char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }],
  102. +       AC_MSG_RESULT(zero); AC_DEFINE(TGETENT_ZERO_ERR, 0),
  103. +       AC_MSG_RESULT(non-zero),
  104. +       AC_MSG_ERROR(failed to compile test program.))
  105.   fi
  106.   
  107.   AC_MSG_CHECKING(whether termcap.h contains ospeed)
  108. *** ../vim61.361/src/term.c    Thu Feb 20 21:36:44 2003
  109. --- src/term.c    Mon Feb 17 11:51:49 2003
  110. ***************
  111. *** 1642,1656 ****
  112.                          TGETSTR(string_names[i].name, &tp);
  113.           }
  114.   
  115. !         if ((T_MS == NULL || T_MS == empty_option) && tgetflag("ms"))
  116.               T_MS = (char_u *)"y";
  117. !         if ((T_XS == NULL || T_XS == empty_option) && tgetflag("xs"))
  118.               T_XS = (char_u *)"y";
  119. !         if ((T_DB == NULL || T_DB == empty_option) && tgetflag("db"))
  120.               T_DB = (char_u *)"y";
  121. !         if ((T_DA == NULL || T_DA == empty_option) && tgetflag("da"))
  122.               T_DA = (char_u *)"y";
  123. !         if ((T_UT == NULL || T_UT == empty_option) && tgetflag("ut"))
  124.               T_UT = (char_u *)"y";
  125.   
  126.   
  127. --- 1642,1663 ----
  128.                          TGETSTR(string_names[i].name, &tp);
  129.           }
  130.   
  131. !         /* tgetflag() returns 1 if the flag is present, 0 if not and
  132. !          * possibly -1 if the flag doesn't exist. */
  133. !         if ((T_MS == NULL || T_MS == empty_option)
  134. !                             && tgetflag("ms") > 0)
  135.               T_MS = (char_u *)"y";
  136. !         if ((T_XS == NULL || T_XS == empty_option)
  137. !                             && tgetflag("xs") > 0)
  138.               T_XS = (char_u *)"y";
  139. !         if ((T_DB == NULL || T_DB == empty_option)
  140. !                             && tgetflag("db") > 0)
  141.               T_DB = (char_u *)"y";
  142. !         if ((T_DA == NULL || T_DA == empty_option)
  143. !                             && tgetflag("da") > 0)
  144.               T_DA = (char_u *)"y";
  145. !         if ((T_UT == NULL || T_UT == empty_option)
  146. !                             && tgetflag("ut") > 0)
  147.               T_UT = (char_u *)"y";
  148.   
  149.   
  150. ***************
  151. *** 2104,2123 ****
  152.       int        i;
  153.   
  154.       i = TGETENT(tbuf, term);
  155. !     if (i < 1)
  156.       {
  157.       /* On FreeBSD tputs() gets a SEGV after a tgetent() which fails.  Call
  158.        * tgetent() with the always existing "dumb" entry to avoid a crash or
  159.        * hang. */
  160.       (void)TGETENT(tbuf, "dumb");
  161.   
  162. !     if (i == -1)
  163.           return (char_u *)_("Cannot open termcap file");
  164.       if (i == 0)
  165.   #ifdef TERMINFO
  166.           return (char_u *)_("Terminal entry not found in terminfo");
  167.   #else
  168. !     return (char_u *)_("Terminal entry not found in termcap");
  169.   #endif
  170.       }
  171.       return NULL;
  172. --- 2111,2136 ----
  173.       int        i;
  174.   
  175.       i = TGETENT(tbuf, term);
  176. !     if (i < 0            /* -1 is always an error */
  177. ! # ifdef TGETENT_ZERO_ERR
  178. !         || i == 0        /* sometimes zero is also an error */
  179. ! # endif
  180. !        )
  181.       {
  182.       /* On FreeBSD tputs() gets a SEGV after a tgetent() which fails.  Call
  183.        * tgetent() with the always existing "dumb" entry to avoid a crash or
  184.        * hang. */
  185.       (void)TGETENT(tbuf, "dumb");
  186.   
  187. !     if (i < 0)
  188. ! # ifdef TGETENT_ZERO_ERR
  189.           return (char_u *)_("Cannot open termcap file");
  190.       if (i == 0)
  191. + # endif
  192.   #ifdef TERMINFO
  193.           return (char_u *)_("Terminal entry not found in terminfo");
  194.   #else
  195. !         return (char_u *)_("Terminal entry not found in termcap");
  196.   #endif
  197.       }
  198.       return NULL;
  199. *** ../vim61.361/src/version.c    Tue Feb 25 21:41:42 2003
  200. --- src/version.c    Tue Feb 25 21:46:43 2003
  201. ***************
  202. *** 608,609 ****
  203. --- 612,615 ----
  204.   {   /* Add new patch number below this line */
  205. + /**/
  206. +     362,
  207.   /**/
  208.  
  209. -- 
  210. TIM: To the north there lies a cave,  the cave of Caerbannog, wherein, carved
  211.      in mystic runes, upon the very living rock, the last words of Olfin
  212.      Bedwere of Rheged make plain the last resting place of the most Holy
  213.      Grail.
  214.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  215.  
  216.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  217. ///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
  218. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  219.  \\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
  220.