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.0.162 < prev    next >
Encoding:
Internet Message Format  |  2002-02-02  |  19.4 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.0.162 (extra)
  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.0.162
  11. Problem:    Client-server: An error message for a wrong expression appears in
  12.         the server instead of the cient.
  13. Solution:   Pass the error message from the server to the client.  Also
  14.         adjust the example code. (Flemming Madsen)
  15. Files:        src/globals.h, src/if_xcmdsrv.c, src/main.c, src/os_mswin.c,
  16.         src/proto/if_xcmdsrv.pro, src/proto/os_mswin.pro,
  17.         runtime/doc/eval.txt, runtime/tools/xcmdsrv_client.c
  18.  
  19.  
  20. *** ../vim60.161/src/globals.h    Fri Nov  2 16:29:44 2001
  21. --- src/globals.h    Sun Feb  3 11:57:48 2002
  22. ***************
  23. *** 1132,1137 ****
  24. --- 1133,1141 ----
  25.   EXTERN char_u e_zerocount[]    INIT(=N_("Zero count"));
  26.   #ifdef FEAT_EVAL
  27.   EXTERN char_u e_usingsid[]    INIT(=N_("E81: Using <SID> not in a script context"));
  28. + #endif
  29. + #ifdef FEAT_CLIENTSERVER
  30. + EXTERN char_u e_invexprmsg[]    INIT(=N_("E449: Invalid expression received"));
  31.   #endif
  32.   
  33.   /*
  34. *** ../vim60.161/src/if_xcmdsrv.c    Sat Nov  3 14:16:30 2001
  35. --- src/if_xcmdsrv.c    Sun Feb  3 12:18:33 2002
  36. ***************
  37. *** 70,75 ****
  38. --- 70,76 ----
  39.   typedef struct PendingCommand
  40.   {
  41.       int        serial;    /* Serial number expected in result. */
  42. +     int        code;    /* Result Code. 0 is OK */
  43.       char_u  *result;    /* String result for command (malloc'ed).
  44.                * NULL means command still pending. */
  45.       struct PendingCommand *nextPtr;
  46. ***************
  47. *** 136,141 ****
  48. --- 137,145 ----
  49.    *    defaults to an empty string.
  50.    *
  51.    * -c code
  52. +  *    0: for OK. This is the default.
  53. +  *    1: for error: Result is the last error
  54. +  *
  55.    * -i errorInfo
  56.    * -e errorCode
  57.    *    Not applicable for Vim
  58. ***************
  59. *** 385,393 ****
  60.           ret = eval_to_string(cmd, NULL);
  61.           --emsg_skip;
  62.           if (result != NULL)
  63. !         *result = ret;
  64.           else
  65.           vim_free(ret);
  66.       }
  67.       else
  68.           server_to_input_buf(cmd);
  69. --- 389,403 ----
  70.           ret = eval_to_string(cmd, NULL);
  71.           --emsg_skip;
  72.           if (result != NULL)
  73. !         {
  74. !         if (ret == NULL)
  75. !             *result = vim_strsave(_(e_invexprmsg));
  76. !         else
  77. !             *result = ret;
  78. !         }
  79.           else
  80.           vim_free(ret);
  81. +         return ret == NULL ? -1 : 0;
  82.       }
  83.       else
  84.           server_to_input_buf(cmd);
  85. ***************
  86. *** 461,466 ****
  87. --- 471,477 ----
  88.        * AppendErrorProc to pass back the command's results).
  89.        */
  90.       pending.serial = serial;
  91. +     pending.code = 0;
  92.       pending.result = NULL;
  93.       pending.nextPtr = pendingCommands;
  94.       pendingCommands = &pending;
  95. ***************
  96. *** 489,495 ****
  97.       else
  98.       vim_free(pending.result);
  99.   
  100. !     return 0;
  101.   }
  102.   
  103.       static int
  104. --- 500,506 ----
  105.       else
  106.       vim_free(pending.result);
  107.   
  108. !     return pending.code == 0 ? 0 : -1;
  109.   }
  110.   
  111.       static int
  112. ***************
  113. *** 1092,1098 ****
  114.   {
  115.       char_u    *propInfo;
  116.       char_u    *p;
  117. !     int        result, actualFormat;
  118.       long_u    numItems, bytesAfter;
  119.       Atom    actualType;
  120.   
  121. --- 1103,1109 ----
  122.   {
  123.       char_u    *propInfo;
  124.       char_u    *p;
  125. !     int        result, actualFormat, code;
  126.       long_u    numItems, bytesAfter;
  127.       Atom    actualType;
  128.   
  129. ***************
  130. *** 1223,1228 ****
  131. --- 1234,1245 ----
  132.           {
  133.           if (res != NULL)
  134.               ga_concat(&reply, res);
  135. +         else if (asKeys == 0)
  136. +         {
  137. +             ga_concat(&reply, _(e_invexprmsg));
  138. +             ga_append(&reply, 0);
  139. +             ga_concat(&reply, "-c 1");
  140. +         }
  141.           ga_append(&reply, 0);
  142.           (void)AppendPropCarefully(dpy, resWindow, commProperty,
  143.                          reply.ga_data, reply.ga_len);
  144. ***************
  145. *** 1243,1248 ****
  146. --- 1260,1266 ----
  147.           p += 2;
  148.           gotSerial = 0;
  149.           res = (char_u *)"";
  150. +         code = 0;
  151.           while ((p-propInfo) < numItems && *p == '-')
  152.           {
  153.           switch (p[1])
  154. ***************
  155. *** 1255,1260 ****
  156. --- 1273,1282 ----
  157.               if (sscanf((char *)p + 2, " %d", &serial) == 1)
  158.                   gotSerial = 1;
  159.               break;
  160. +             case 'c':
  161. +             if (sscanf((char *)p + 2, " %d", &code) != 1)
  162. +                 code = 0;
  163. +             break;
  164.           }
  165.           while (*p != 0)
  166.               p++;
  167. ***************
  168. *** 1273,1278 ****
  169. --- 1295,1301 ----
  170.           if (serial != pcPtr->serial || pcPtr->result != NULL)
  171.               continue;
  172.   
  173. +         pcPtr->code = code;
  174.           if (res != NULL)
  175.               pcPtr->result = vim_strsave(res);
  176.           else
  177. *** ../vim60.161/src/main.c    Mon Nov  5 22:06:57 2001
  178. --- src/main.c    Sun Feb  3 11:45:33 2002
  179. ***************
  180. *** 2628,2634 ****
  181.               while (memchr(done, 0, numFiles) != NULL)
  182.               {
  183.   # ifdef WIN32
  184. !             p = serverGetReply(srv, FALSE, TRUE, TRUE);
  185.               if (p == NULL)
  186.                   break;
  187.   # else
  188. --- 2628,2634 ----
  189.               while (memchr(done, 0, numFiles) != NULL)
  190.               {
  191.   # ifdef WIN32
  192. !             p = serverGetReply(srv, NULL, TRUE, TRUE);
  193.               if (p == NULL)
  194.                   break;
  195.   # else
  196. *** ../vim60.161/src/os_mswin.c    Sun Dec 30 21:52:17 2001
  197. --- src/os_mswin.c    Sun Feb  3 11:57:57 2002
  198. ***************
  199. *** 1716,1725 ****
  200.   
  201.   /* Communication is via WM_COPYDATA messages. The message type is send in
  202.    * the dwData parameter. Types are defined here. */
  203. ! #define COPYDATA_KEYS    0
  204. ! #define COPYDATA_REPLY    1
  205. ! #define COPYDATA_EXPR    10
  206. ! #define COPYDATA_RESULT    11
  207.   
  208.   /* This is a structure containing a server HWND and its name. */
  209.   struct server_id
  210. --- 1716,1726 ----
  211.   
  212.   /* Communication is via WM_COPYDATA messages. The message type is send in
  213.    * the dwData parameter. Types are defined here. */
  214. ! #define COPYDATA_KEYS        0
  215. ! #define COPYDATA_REPLY        1
  216. ! #define COPYDATA_EXPR        10
  217. ! #define COPYDATA_RESULT        11
  218. ! #define COPYDATA_ERROR_RESULT    12
  219.   
  220.   /* This is a structure containing a server HWND and its name. */
  221.   struct server_id
  222. ***************
  223. *** 1775,1780 ****
  224. --- 1776,1784 ----
  225.        *   COPYDATA_RESULT:
  226.        *    A reply. We are a client, and a server has sent this message
  227.        *    in response to a COPYDATA_EXPR.
  228. +      *   COPYDATA_ERROR_RESULT:
  229. +      *    A reply. We are a client, and a server has sent this message
  230. +      *    in response to a COPYDATA_EXPR that failed to evaluate.
  231.        */
  232.       COPYDATASTRUCT    *data = (COPYDATASTRUCT*)lParam;
  233.       HWND        sender = (HWND)wParam;
  234. ***************
  235. *** 1808,1815 ****
  236.           res = eval_to_string(data->lpData, NULL);
  237.           --emsg_skip;
  238.           if (res == NULL)
  239. !         res = vim_strsave((char_u *)"");
  240. !         reply.dwData = COPYDATA_RESULT;
  241.           reply.lpData = res;
  242.           reply.cbData = STRLEN(res) + 1;
  243.   
  244. --- 1812,1823 ----
  245.           res = eval_to_string(data->lpData, NULL);
  246.           --emsg_skip;
  247.           if (res == NULL)
  248. !         {
  249. !         res = vim_strsave(_(e_invexprmsg));
  250. !         reply.dwData = COPYDATA_ERROR_RESULT;
  251. !         }
  252. !         else
  253. !         reply.dwData = COPYDATA_RESULT;
  254.           reply.lpData = res;
  255.           reply.cbData = STRLEN(res) + 1;
  256.   
  257. ***************
  258. *** 1820,1829 ****
  259.   
  260.       case COPYDATA_REPLY:
  261.       case COPYDATA_RESULT:
  262.           if (data->lpData != NULL)
  263.           {
  264.           save_reply(sender, data->lpData,
  265. !                          data->dwData == COPYDATA_RESULT);
  266.   #ifdef FEAT_AUTOCMD
  267.           if (data->dwData == COPYDATA_REPLY)
  268.           {
  269. --- 1828,1840 ----
  270.   
  271.       case COPYDATA_REPLY:
  272.       case COPYDATA_RESULT:
  273. +     case COPYDATA_ERROR_RESULT:
  274.           if (data->lpData != NULL)
  275.           {
  276.           save_reply(sender, data->lpData,
  277. !                (data->dwData == COPYDATA_REPLY ?  0 :
  278. !                (data->dwData == COPYDATA_RESULT ? 1 :
  279. !                                   2)));
  280.   #ifdef FEAT_AUTOCMD
  281.           if (data->dwData == COPYDATA_REPLY)
  282.           {
  283. ***************
  284. *** 2071,2076 ****
  285. --- 2082,2088 ----
  286.       HWND    target = findServer(name);
  287.       COPYDATASTRUCT data;
  288.       char_u    *retval = NULL;
  289. +     int        retcode = 0;
  290.   
  291.       if (ptarget)
  292.       *(HWND *)ptarget = target;
  293. ***************
  294. *** 2084,2097 ****
  295.       return -1;
  296.   
  297.       if (asExpr)
  298. !     retval = serverGetReply(target, TRUE, TRUE, TRUE);
  299.   
  300.       if (result == NULL)
  301.       vim_free(retval);
  302.       else
  303.       *result = retval; /* Caller assumes responsibility for freeing */
  304.   
  305. !     return 0;
  306.   }
  307.   
  308.   /*
  309. --- 2096,2109 ----
  310.       return -1;
  311.   
  312.       if (asExpr)
  313. !     retval = serverGetReply(target, &retcode, TRUE, TRUE);
  314.   
  315.       if (result == NULL)
  316.       vim_free(retval);
  317.       else
  318.       *result = retval; /* Caller assumes responsibility for freeing */
  319.   
  320. !     return retcode;
  321.   }
  322.   
  323.   /*
  324. ***************
  325. *** 2119,2125 ****
  326.   {
  327.       HWND    server;        /* server window */
  328.       char_u    *reply;        /* reply string */
  329. !     int        expr_result;    /* TRUE for COPYDATA_RESULT */
  330.   }
  331.   reply_T;
  332.   
  333. --- 2131,2137 ----
  334.   {
  335.       HWND    server;        /* server window */
  336.       char_u    *reply;        /* reply string */
  337. !     int        expr_result;    /* 0 for REPLY, 1 for RESULT 2 for error */
  338.   }
  339.   reply_T;
  340.   
  341. ***************
  342. *** 2155,2167 ****
  343.   
  344.   /*
  345.    * Get a reply from server "server".
  346. !  * When "expr" is TRUE, get the result of an expression, otherwise a
  347.    * server2client() message.
  348.    * If "remove" is TRUE, consume the message, the caller must free it then.
  349.    * if "wait" is TRUE block until a message arrives (or the server exits).
  350.    */
  351.       char_u *
  352. ! serverGetReply(HWND server, int expr, int remove, int wait)
  353.   {
  354.       int        i;
  355.       char_u    *reply;
  356. --- 2167,2180 ----
  357.   
  358.   /*
  359.    * Get a reply from server "server".
  360. !  * When "expr_res" is non NULL, get the result of an expression, otherwise a
  361.    * server2client() message.
  362. +  * When non NULL, point to return code. 0 => OK, -1 => ERROR
  363.    * If "remove" is TRUE, consume the message, the caller must free it then.
  364.    * if "wait" is TRUE block until a message arrives (or the server exits).
  365.    */
  366.       char_u *
  367. ! serverGetReply(HWND server, int *expr_res, int remove, int wait)
  368.   {
  369.       int        i;
  370.       char_u    *reply;
  371. ***************
  372. *** 2177,2186 ****
  373.       for (i = 0; i < REPLY_COUNT; ++i)
  374.       {
  375.           rep = REPLY_ITEM(i);
  376. !         if (rep->server == server && rep->expr_result == expr)
  377.           {
  378.           /* Save the values we've found for later */
  379.           reply = rep->reply;
  380.   
  381.           if (remove)
  382.           {
  383. --- 2190,2202 ----
  384.       for (i = 0; i < REPLY_COUNT; ++i)
  385.       {
  386.           rep = REPLY_ITEM(i);
  387. !         if (rep->server == server
  388. !             && ((rep->expr_result != 0) == (expr_res != NULL)))
  389.           {
  390.           /* Save the values we've found for later */
  391.           reply = rep->reply;
  392. +         if (expr_res != NULL)
  393. +             *expr_res = rep->expr_result == 1 ? 0 : -1;
  394.   
  395.           if (remove)
  396.           {
  397. *** ../vim60.161/src/proto/os_mswin.pro    Tue Sep 25 21:49:35 2001
  398. --- src/proto/os_mswin.pro    Sun Feb  3 11:45:33 2002
  399. ***************
  400. *** 47,53 ****
  401.   int serverSendReply __ARGS((char_u *name, char_u *reply));
  402.   int serverSendToVim __ARGS((char_u *name, char_u *cmd, char_u **result, void *ptarget, int asExpr));
  403.   void serverForeground __ARGS((char_u *name));
  404. ! char_u *serverGetReply __ARGS((HWND server, int expr, int remove, int wait));
  405.   void serverProcessPendingMessages __ARGS((void));
  406.   char *charset_id2name __ARGS((int id));
  407.   int get_logfont __ARGS((LOGFONT *lf, char_u *name, HDC printer_dc));
  408. --- 47,53 ----
  409.   int serverSendReply __ARGS((char_u *name, char_u *reply));
  410.   int serverSendToVim __ARGS((char_u *name, char_u *cmd, char_u **result, void *ptarget, int asExpr));
  411.   void serverForeground __ARGS((char_u *name));
  412. ! char_u *serverGetReply __ARGS((HWND server, int *expr_res, int remove, int wait));
  413.   void serverProcessPendingMessages __ARGS((void));
  414.   char *charset_id2name __ARGS((int id));
  415.   int get_logfont __ARGS((LOGFONT *lf, char_u *name, HDC printer_dc));
  416. *** ../vim60.161/runtime/doc/eval.txt    Tue Sep 25 21:40:34 2001
  417. --- runtime/doc/eval.txt    Sun Feb  3 11:51:14 2002
  418. ***************
  419. *** 671,676 ****
  420. --- 679,685 ----
  421.   
  422.                       *v:servername* *servername-variable*
  423.   v:servername    The resulting registered |x11-clientserver| name if any.
  424. +         Read-only.
  425.   
  426.                       *v:shell_error* *shell_error-variable*
  427.   v:shell_error    Result of the last shell command.  When non-zero, the last
  428. ***************
  429. *** 1189,1195 ****
  430.               <sfile>        sourced script file name
  431.               <cword>        word under the cursor
  432.               <cWORD>        WORD under the cursor
  433. !             <client>    The {serverid} of the las
  434.           Modifiers:
  435.               :p        expand to full path
  436.               :h        head (last path component removed)
  437. --- 1205,1212 ----
  438.               <sfile>        sourced script file name
  439.               <cword>        word under the cursor
  440.               <cWORD>        WORD under the cursor
  441. !             <client>    the {clientid} of the last received
  442. !                     message |server2client()|
  443.           Modifiers:
  444.               :p        expand to full path
  445.               :h        head (last path component removed)
  446. ***************
  447. *** 1864,1870 ****
  448.   <        When {lnum} is invalid or there is no non-blank line at or
  449.           above it, zero is returned.
  450.   
  451. !                             *remote_expr()*
  452.   remote_expr({server}, {string} [, {idvar}])
  453.           Send the {string} to {server}.  The string is sent as an
  454.           expression and the result is returned after evaluation.
  455. --- 1874,1880 ----
  456.   <        When {lnum} is invalid or there is no non-blank line at or
  457.           above it, zero is returned.
  458.   
  459. !                             *remote_expr()* *E449*
  460.   remote_expr({server}, {string} [, {idvar}])
  461.           Send the {string} to {server}.  The string is sent as an
  462.           expression and the result is returned after evaluation.
  463. ***************
  464. *** 1873,1883 ****
  465.           remote_read() is stored there.
  466.           See also |clientserver| |RemoteReply|.
  467.           {only available when compiled with the |+clientserver| feature}
  468. !         Note: Any errors will be reported in the server and may mess
  469. !         up the display.
  470.           Examples: >
  471.               :echo remote_expr("gvim", "2+2")
  472. !             :echo remote_expr("gvim-001", "b:current_syntax")
  473.   <
  474.   
  475.   remote_foreground({server})                *remote_foreground()*
  476. --- 1883,1893 ----
  477.           remote_read() is stored there.
  478.           See also |clientserver| |RemoteReply|.
  479.           {only available when compiled with the |+clientserver| feature}
  480. !         Note: Any errors will cause a local error message to be issued
  481. !         and the result will be the empty string.
  482.           Examples: >
  483.               :echo remote_expr("gvim", "2+2")
  484. !             :echo remote_expr("gvim1", "b:current_syntax")
  485.   <
  486.   
  487.   remote_foreground({server})                *remote_foreground()*
  488. *** ../vim60.161/runtime/tools/xcmdsrv_client.c    Sun Sep  2 14:51:52 2001
  489. --- runtime/tools/xcmdsrv_client.c    Sun Feb  3 11:45:33 2002
  490. ***************
  491. *** 32,50 ****
  492.   #define __ARGS(x) x
  493.   
  494.   /* Client API */
  495. ! char * sendToVim __ARGS((Display *dpy, char *name, char *cmd, int asKeys));
  496.   
  497.   #ifdef MAIN
  498.   /* A sample program */
  499.   main(int argc, char **argv)
  500.   {
  501. !     char *res;
  502.   
  503.       if (argc == 4)
  504.       {
  505. !     if ((res = sendToVim(XOpenDisplay(NULL),
  506. !                  argv[2], argv[3], argv[1][0] != 'e')) != NULL)
  507.           puts(res);
  508.       exit(0);
  509.       }
  510.       else
  511. --- 32,55 ----
  512.   #define __ARGS(x) x
  513.   
  514.   /* Client API */
  515. ! char * sendToVim __ARGS((Display *dpy, char *name, char *cmd, int asKeys, int *code));
  516.   
  517.   #ifdef MAIN
  518.   /* A sample program */
  519.   main(int argc, char **argv)
  520.   {
  521. !     char    *res;
  522. !     int        code;
  523.   
  524.       if (argc == 4)
  525.       {
  526. !     if ((res = sendToVim(XOpenDisplay(NULL), argv[2], argv[3],
  527. !                  argv[1][0] != 'e', &code)) != NULL)
  528. !     {
  529. !         if (code)
  530. !         printf("Error code returned: %d\n", code);
  531.           puts(res);
  532. +     }
  533.       exit(0);
  534.       }
  535.       else
  536. ***************
  537. *** 72,78 ****
  538.               int delete, char **loose));
  539.   static int    SendInit __ARGS((Display *dpy));
  540.   static char    *SendEventProc __ARGS((Display *dpy, XEvent *eventPtr,
  541. !                       int expect));
  542.   static int    IsSerialName __ARGS((char *name));
  543.   
  544.   /* Private variables */
  545. --- 77,83 ----
  546.               int delete, char **loose));
  547.   static int    SendInit __ARGS((Display *dpy));
  548.   static char    *SendEventProc __ARGS((Display *dpy, XEvent *eventPtr,
  549. !                       int expect, int *code));
  550.   static int    IsSerialName __ARGS((char *name));
  551.   
  552.   /* Private variables */
  553. ***************
  554. *** 91,101 ****
  555.    */
  556.   
  557.       char *
  558. ! sendToVim(dpy, name, cmd, asKeys)
  559.       Display    *dpy;            /* Where to send. */
  560.       char    *name;            /* Where to send. */
  561.       char    *cmd;            /* What to send. */
  562.       int        asKeys;            /* Interpret as keystrokes or expr ? */
  563.   {
  564.       Window        w;
  565.       Atom        *plist;
  566. --- 96,107 ----
  567.    */
  568.   
  569.       char *
  570. ! sendToVim(dpy, name, cmd, asKeys, code)
  571.       Display    *dpy;            /* Where to send. */
  572.       char    *name;            /* Where to send. */
  573.       char    *cmd;            /* What to send. */
  574.       int        asKeys;            /* Interpret as keystrokes or expr ? */
  575. +     int        *code;            /* Return code. 0 => OK */
  576.   {
  577.       Window        w;
  578.       Atom        *plist;
  579. ***************
  580. *** 225,231 ****
  581.       {
  582.           XNextEvent(dpy, &event);
  583.           if (event.type == PropertyNotify && e->window == commWindow)
  584. !         if ((result = SendEventProc(dpy, &event, serial)) != NULL)
  585.               return result;
  586.       }
  587.       }
  588. --- 231,237 ----
  589.       {
  590.           XNextEvent(dpy, &event);
  591.           if (event.type == PropertyNotify && e->window == commWindow)
  592. !         if ((result = SendEventProc(dpy, &event, serial, code)) != NULL)
  593.               return result;
  594.       }
  595.       }
  596. ***************
  597. *** 335,341 ****
  598.       entry = p;
  599.       while ((*p != 0) && (!isspace(*p)))
  600.           p++;
  601. !     if ((*p != 0) && (strcmp(name, p + 1) == 0))
  602.       {
  603.           sscanf(entry, "%x", (uint*) &returnValue);
  604.           break;
  605. --- 341,347 ----
  606.       entry = p;
  607.       while ((*p != 0) && (!isspace(*p)))
  608.           p++;
  609. !     if ((*p != 0) && (strcasecmp(name, p + 1) == 0))
  610.       {
  611.           sscanf(entry, "%x", (uint*) &returnValue);
  612.           break;
  613. ***************
  614. *** 392,405 ****
  615.   }
  616.   
  617.       static char *
  618. ! SendEventProc(dpy, eventPtr, expected)
  619.       Display       *dpy;
  620.       XEvent        *eventPtr;        /* Information about event. */
  621.       int            expected;        /* The one were waiting for */
  622.   {
  623.       unsigned char   *propInfo;
  624.       unsigned char   *p;
  625.       int            result, actualFormat;
  626.       unsigned long   numItems, bytesAfter;
  627.       Atom        actualType;
  628.   
  629. --- 398,413 ----
  630.   }
  631.   
  632.       static char *
  633. ! SendEventProc(dpy, eventPtr, expected, code)
  634.       Display       *dpy;
  635.       XEvent        *eventPtr;        /* Information about event. */
  636.       int            expected;        /* The one were waiting for */
  637. +     int            *code;              /* Return code. 0 => OK */
  638.   {
  639.       unsigned char   *propInfo;
  640.       unsigned char   *p;
  641.       int            result, actualFormat;
  642. +     int            retCode;
  643.       unsigned long   numItems, bytesAfter;
  644.       Atom        actualType;
  645.   
  646. ***************
  647. *** 469,474 ****
  648. --- 477,483 ----
  649.           p += 2;
  650.           gotSerial = 0;
  651.           res = "";
  652. +         retCode = 0;
  653.           while (((p-propInfo) < numItems) && (*p == '-'))
  654.           {
  655.           switch (p[1])
  656. ***************
  657. *** 481,486 ****
  658. --- 490,499 ----
  659.               if (sscanf(p + 2, " %d", &serial) == 1)
  660.                   gotSerial = 1;
  661.               break;
  662. +             case 'c':
  663. +             if (sscanf(p + 2, " %d", &retCode) != 1)
  664. +                 retCode = 0;
  665. +             break;
  666.           }
  667.           while (*p != 0)
  668.               p++;
  669. ***************
  670. *** 490,495 ****
  671. --- 503,510 ----
  672.           if (!gotSerial)
  673.           continue;
  674.   
  675. +         if (code != NULL)
  676. +         *code = retCode;
  677.           return serial == expected ? strdup(res) : NULL;
  678.       }
  679.       else
  680. ***************
  681. *** 556,578 ****
  682.   }
  683.   
  684.   /*
  685. !  * Check if name looks like it had a 3 digit serial number appended
  686.    */
  687.       static int
  688.   IsSerialName(str)
  689. !     char    *str;
  690.   {
  691. !     if (strlen(str) < 5)
  692. !     return FALSE;
  693. !     str = str + strlen(str) - 4;
  694. !     if (*str++ != '-')
  695. !     return FALSE;
  696. !     if (!isdigit(*str++))
  697. !     return FALSE;
  698. !     if (!isdigit(*str++))
  699. !     return FALSE;
  700. !     if (!isdigit(*str++))
  701. !     return FALSE;
  702.   
  703. !     return TRUE;
  704.   }
  705. --- 571,584 ----
  706.   }
  707.   
  708.   /*
  709. !  * Check if "str" looks like it had a serial number appended.
  710. !  * Actually just checks if the name ends in a digit.
  711.    */
  712.       static int
  713.   IsSerialName(str)
  714. !     char   *str;
  715.   {
  716. !     int len = strlen(str);
  717.   
  718. !     return (len > 1 && isdigit(str[len - 1]));
  719.   }
  720. *** ../vim60.161/src/version.c    Sun Feb  3 12:33:39 2002
  721. --- src/version.c    Sun Feb  3 12:29:58 2002
  722. ***************
  723. *** 608,609 ****
  724. --- 608,611 ----
  725.   {   /* Add new patch number below this line */
  726. + /**/
  727. +     162,
  728.   /**/
  729.  
  730. -- 
  731. hundred-and-one symptoms of being an internet addict:
  732. 167. You have more than 100 websites in your Bookmark.
  733.  
  734.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  735. (((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
  736.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  737.