To: [email protected]
Subject: Patch 6.2f.034
Fcc: outbox
From: Bram Moolenaar <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 6.2f.034
Problem:    The netbeans interface cannot be used on systems without
           vsnprintf(). (Tony Leneis)
Solution:   Use EMSG(), EMSGN() and EMSG2() instead.
Files:      src/auto/configure, src/configure.in, src/netbeans.c


*** ../vim-6.2f.033/src/auto/configure  Thu May 29 16:11:03 2003
--- src/auto/configure  Sat May 31 11:55:34 2003
***************
*** 2133,2147 ****
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-       /* Check use of vsnprintf() */
-       void warn(char *fmt, ...);
-       void warn(char *fmt, ...)
-       {
-         va_list ap; char *buf = NULL;
-         va_start(ap, fmt);
-         vsnprintf(buf, 100, fmt, ap);
-         va_end(ap);
-       }
       /* Check bitfields */
       struct nbbuf {
       unsigned int  initDone:1;
--- 2133,2138 ----
*** ../vim-6.2f.033/src/configure.in    Thu May 29 16:11:03 2003
--- src/configure.in    Sat May 31 11:55:31 2003
***************
*** 641,655 ****
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-       /* Check use of vsnprintf() */
-       void warn(char *fmt, ...);
-       void warn(char *fmt, ...)
-       {
-         va_list ap; char *buf = NULL;
-         va_start(ap, fmt);
-         vsnprintf(buf, 100, fmt, ap);
-         va_end(ap);
-       }
       /* Check bitfields */
       struct nbbuf {
       unsigned int  initDone:1;
--- 641,646 ----
*** ../vim-6.2f.033/src/netbeans.c      Mon May 26 22:15:06 2003
--- src/netbeans.c      Sat May 31 11:49:36 2003
***************
*** 58,64 ****
 static void nb_parse_cmd __ARGS((char_u *));
 static int  nb_do_cmd __ARGS((int, char_u *, int, int, char_u *));
 static void nb_send __ARGS((char *buf, char *fun));
- static void warn __ARGS((char *fmt, ...));
 #ifdef FEAT_BEVAL
 static void netbeans_beval_cb __ARGS((BalloonEval *beval, int state));
 #endif
--- 58,63 ----
***************
*** 574,618 ****
 }

 /*
-  * Issue a warning.  This used to go to stderr but that doesn't show up when
-  * started from a GUI.
-  */
-     static void
- warn(char *fmt, ...)
- {
-     va_list ap;
-     char    buf[1000];
-
-     va_start(ap, fmt);
-     vsnprintf(buf, 1000, fmt, ap);
-     va_end(ap);
-     EMSG(buf);
- }
-
- /*
-  * Issue a warning to stderr and possibly abort.
-  */
- #if 0 /* we should never abort, changed files could be lost! */
- static void die __ARGS((char *fmt, ...));
-
-     static void
- die(char *fmt, ...)
- {
-     va_list ap;
-
-     va_start(ap, fmt);
-     vfprintf(stderr, fmt, ap);
-     va_end(ap);
-     fprintf(stderr, "\n");
- /*     exit(1); */
-     if (getenv("__NETBEANS_INTG_ABORT"))
-       abort();
- }
- #else
- # define die warn
- #endif
-
- /*
  * Handle one NUL terminated command.
  *
  * format of a command from netbeans:
--- 573,578 ----
***************
*** 661,667 ****

     if (*verb != ':')
     {
!       warn("missing colon: %s", cmd);
       return;
     }
     ++verb; /* skip colon */
--- 621,627 ----

     if (*verb != ':')
     {
!       EMSG2("missing colon: %s", cmd);
       return;
     }
     ++verb; /* skip colon */
***************
*** 684,690 ****

     if (isfunc < 0)
     {
!       warn("missing ! or / in: %s", cmd);
       return;
     }

--- 644,650 ----

     if (isfunc < 0)
     {
!       EMSG2("missing ! or / in: %s", cmd);
       return;
     }

***************
*** 693,699 ****
     if (nb_do_cmd(bufno, verb, isfunc, cmdno, q) == FAIL)
     {
       nbdebug(("nb_parse_cmd: Command error for \"%s\"\n", cmd));
!       die("bad return from nb_do_cmd");
     }
 }

--- 653,659 ----
     if (nb_do_cmd(bufno, verb, isfunc, cmdno, q) == FAIL)
     {
       nbdebug(("nb_parse_cmd: Command error for \"%s\"\n", cmd));
!       EMSG("bad return from nb_do_cmd");
     }
 }

***************
*** 852,860 ****
 nb_send(char *buf, char *fun)
 {
     if (sd < 0)
!       warn("%s(): write while not connected", fun);
     else if (write(sd, buf, STRLEN(buf)) != STRLEN(buf))
!       warn("%s(): write failed", fun);
 }

 /*
--- 812,820 ----
 nb_send(char *buf, char *fun)
 {
     if (sd < 0)
!       EMSG2("%s(): write while not connected", fun);
     else if (write(sd, buf, STRLEN(buf)) != STRLEN(buf))
!       EMSG2("%s(): write failed", fun);
 }

 /*
***************
*** 1083,1089 ****
           if (buf == NULL || buf->bufp == NULL)
           {
               nbdebug(("    null bufp in getLength"));
!               die("null bufp in getLength");
               retval = FAIL;
           }
           else
--- 1043,1049 ----
           if (buf == NULL || buf->bufp == NULL)
           {
               nbdebug(("    null bufp in getLength"));
!               EMSG("null bufp in getLength");
               retval = FAIL;
           }
           else
***************
*** 1112,1118 ****
           if (buf == NULL || buf->bufp == NULL)
           {
               nbdebug(("    null bufp in getText"));
!               die("null bufp in getText");
               retval = FAIL;
           }
           else
--- 1072,1078 ----
           if (buf == NULL || buf->bufp == NULL)
           {
               nbdebug(("    null bufp in getText"));
!               EMSG("null bufp in getText");
               retval = FAIL;
           }
           else
***************
*** 1174,1180 ****
           if (buf == NULL || buf->bufp == NULL)
           {
               nbdebug(("    null bufp in remove"));
!               die("null bufp in remove");
               retval = FAIL;
           }
           else
--- 1134,1140 ----
           if (buf == NULL || buf->bufp == NULL)
           {
               nbdebug(("    null bufp in remove"));
!               EMSG("null bufp in remove");
               retval = FAIL;
           }
           else
***************
*** 1278,1284 ****
           if (buf == NULL || buf->bufp == NULL)
           {
               nbdebug(("    null bufp in insert"));
!               die("null bufp in insert");
               retval = FAIL;
           }
           else if (args != NULL)
--- 1238,1244 ----
           if (buf == NULL || buf->bufp == NULL)
           {
               nbdebug(("    null bufp in insert"));
!               EMSG("null bufp in insert");
               retval = FAIL;
           }
           else if (args != NULL)
***************
*** 1383,1389 ****
           /* Create a buffer without a name. */
           if (buf == NULL)
           {
!               die("null buf in create");
               return FAIL;
           }
           vim_free(buf->displayname);
--- 1343,1349 ----
           /* Create a buffer without a name. */
           if (buf == NULL)
           {
!               EMSG("null buf in create");
               return FAIL;
           }
           vim_free(buf->displayname);
***************
*** 1402,1408 ****
       {
           if (buf == NULL)
           {
!               die("null buf in startDocumentListen");
               return FAIL;
           }
           buf->fireChanges = 1;
--- 1362,1368 ----
       {
           if (buf == NULL)
           {
!               EMSG("null buf in startDocumentListen");
               return FAIL;
           }
           buf->fireChanges = 1;
***************
*** 1412,1418 ****
       {
           if (buf == NULL)
           {
!               die("null buf in stopDocumentListen");
               return FAIL;
           }
           buf->fireChanges = 0;
--- 1372,1378 ----
       {
           if (buf == NULL)
           {
!               EMSG("null buf in stopDocumentListen");
               return FAIL;
           }
           buf->fireChanges = 0;
***************
*** 1422,1428 ****
       {
           if (buf == NULL)
           {
!               die("null buf in setTitle");
               return FAIL;
           }
           vim_free(buf->displayname);
--- 1382,1388 ----
       {
           if (buf == NULL)
           {
!               EMSG("null buf in setTitle");
               return FAIL;
           }
           vim_free(buf->displayname);
***************
*** 1434,1440 ****
       {
           if (buf == NULL || buf->bufp == NULL)
           {
!               die("null buf in initDone");
               return FAIL;
           }
           doupdate = 1;
--- 1394,1400 ----
       {
           if (buf == NULL || buf->bufp == NULL)
           {
!               EMSG("null buf in initDone");
               return FAIL;
           }
           doupdate = 1;
***************
*** 1457,1463 ****

           if (buf == NULL)
           {
!               die("null buf in setBufferNumber");
               return FAIL;
           }
           to_free = (char_u *)nb_unquote(++args, NULL);
--- 1417,1423 ----

           if (buf == NULL)
           {
!               EMSG("null buf in setBufferNumber");
               return FAIL;
           }
           to_free = (char_u *)nb_unquote(++args, NULL);
***************
*** 1467,1473 ****
           vim_free(to_free);
           if (bufp == NULL)
           {
!               warn("File %s not found in setBufferNumber", args);
               return FAIL;
           }
           buf->bufp = bufp;
--- 1427,1433 ----
           vim_free(to_free);
           if (bufp == NULL)
           {
!               EMSG2("File %s not found in setBufferNumber", args);
               return FAIL;
           }
           buf->bufp = bufp;
***************
*** 1495,1501 ****
       {
           if (buf == NULL)
           {
!               die("null buf in setFullName");
               return FAIL;
           }
           vim_free(buf->displayname);
--- 1455,1461 ----
       {
           if (buf == NULL)
           {
!               EMSG("null buf in setFullName");
               return FAIL;
           }
           vim_free(buf->displayname);
***************
*** 1515,1521 ****
       {
           if (buf == NULL)
           {
!               die("null buf in editFile");
               return FAIL;
           }
           /* Edit a file: like create + setFullName + read the file. */
--- 1475,1481 ----
       {
           if (buf == NULL)
           {
!               EMSG("null buf in editFile");
               return FAIL;
           }
           /* Edit a file: like create + setFullName + read the file. */
***************
*** 1538,1544 ****
           ++args;
           if (buf == NULL || buf->bufp == NULL)
           {
! /*            warn("null bufp in setVisible"); */
               return FAIL;
           }
           if (streq((char *)args, "T"))
--- 1498,1504 ----
           ++args;
           if (buf == NULL || buf->bufp == NULL)
           {
! /*            EMSG("null bufp in setVisible"); */
               return FAIL;
           }
           if (streq((char *)args, "T"))
***************
*** 1571,1577 ****
           ++args;
           if (buf == NULL || buf->bufp == NULL)
           {
! /*            warn("null bufp in setModified"); */
               return FAIL;
           }
           if (streq((char *)args, "T"))
--- 1531,1537 ----
           ++args;
           if (buf == NULL || buf->bufp == NULL)
           {
! /*            EMSG("null bufp in setModified"); */
               return FAIL;
           }
           if (streq((char *)args, "T"))
***************
*** 1616,1622 ****
           ++args;
           if (buf == NULL || buf->bufp == NULL)
           {
!               die("null bufp in setDot");
               return FAIL;
           }

--- 1576,1582 ----
           ++args;
           if (buf == NULL || buf->bufp == NULL)
           {
!               EMSG("null bufp in setDot");
               return FAIL;
           }

***************
*** 1657,1663 ****

           if (buf == NULL)
           {
!               die("null buf in close");
               return FAIL;
           }

--- 1617,1623 ----

           if (buf == NULL)
           {
!               EMSG("null buf in close");
               return FAIL;
           }

***************
*** 1666,1672 ****
               name = buf->displayname;
 #endif
 /*        if (buf->bufp == NULL) */
! /*            die("null bufp in close"); */
           nbdebug(("    CLOSE %d: %s\n", bufno, name));
           need_mouse_correct = TRUE;
           if (buf->bufp != NULL)
--- 1626,1632 ----
               name = buf->displayname;
 #endif
 /*        if (buf->bufp == NULL) */
! /*            EMSG("null bufp in close"); */
           nbdebug(("    CLOSE %d: %s\n", bufno, name));
           need_mouse_correct = TRUE;
           if (buf->bufp != NULL)
***************
*** 1699,1705 ****

           if (buf == NULL)
           {
!               die("null buf in defineAnnoType");
               return FAIL;
           }

--- 1659,1665 ----

           if (buf == NULL)
           {
!               EMSG("null buf in defineAnnoType");
               return FAIL;
           }

***************
*** 1751,1757 ****

           if (buf == NULL || buf->bufp == NULL)
           {
!               die("null bufp in addAnno");
               return FAIL;
           }

--- 1711,1717 ----

           if (buf == NULL || buf->bufp == NULL)
           {
!               EMSG("null bufp in addAnno");
               return FAIL;
           }

***************
*** 1983,1989 ****

       if (len < 0 || len == MAXPATHLEN)
       {
!           die("readlink() failed, errno = %d\n", errno);
       }
       else
       {
--- 1943,1949 ----

       if (len < 0 || len == MAXPATHLEN)
       {
!           EMSGN("readlink() failed, errno = %ld\n", errno);
       }
       else
       {
***************
*** 2000,2009 ****
               char *p = strrchr(filename, '/');

               if (p == 0)
!                   die("missing slash!?!");
               else
                   if ((p - filename) + strlen(buf) > MAXPATHLEN)
!                       die("buffer overflow in resolve_symlinks()");
                   else
                       strcpy(p+1, buf);
           }
--- 1960,1969 ----
               char *p = strrchr(filename, '/');

               if (p == 0)
!                   EMSG("missing slash!?!");
               else
                   if ((p - filename) + strlen(buf) > MAXPATHLEN)
!                       EMSG("buffer overflow in resolve_symlinks()");
                   else
                       strcpy(p+1, buf);
           }
*** ../vim-6.2f.033/src/version.c       Fri May 30 23:31:47 2003
--- src/version.c       Sat May 31 11:57:17 2003
***************
*** 632,633 ****
--- 632,635 ----
 {   /* Add new patch number below this line */
+ /**/
+     34,
 /**/

--
hundred-and-one symptoms of being an internet addict:
33. You name your children Eudora, Mozilla and Dotcom.

/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
\\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///