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 / old / 5.4.x7 < prev    next >
Encoding:
Internet Message Format  |  1999-08-20  |  11.5 KB

  1. To: vim-dev@vim.org
  2. Subject: patch 5.4.x7
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Since I didn't get complaints that the test version for the DOS uninstall
  8. program I sent out a week ago caused problems, here is the patch for it.
  9.  
  10. Patch 5.4.x7
  11. Problem:    Win32 GUI: Removing "Edit with Vim" from registry is difficult.
  12. Solution:   Add uninstal program to remove the registry keys.  It is installed
  13.             in the "Add/Remove programs" list for ease of use.
  14.             Also: don't set $VIM when the executable is with the runtime files.
  15.             Also: Add a text file with a step-by-step description of how to
  16.             uninstall Vim for DOS and Windows.
  17. Files:      src/uninstal.c, src/dosinst.c, src/Makefile.w32, uninstal.txt
  18.  
  19.  
  20. *** ../vim-5.4.41/src/uninstal.c    Thu Jan  1 01:00:00 1970
  21. --- ./src/uninstal.c    Sat Aug 14 16:02:19 1999
  22. ***************
  23. *** 0 ****
  24. --- 1,66 ----
  25. + /* vi:set ts=8 sts=4 sw=4:
  26. +  *
  27. +  * VIM - Vi IMproved    by Bram Moolenaar
  28. +  *
  29. +  * Do ":help uganda"  in Vim to read copying and usage conditions.
  30. +  * Do ":help credits" in Vim to see a list of people who contributed.
  31. +  */
  32. + /*
  33. +  * uninstal.c:    Minimalistic uninstall program for Vim on MS-Windows
  34. +  *        Only removes the "Edit with Vim" popup menu entry.
  35. +  *
  36. +  * Compile with Makefile.w32.
  37. +  */
  38. + #include <stdio.h>
  39. + #include <stdlib.h>
  40. + #include <ctype.h>
  41. + #ifdef WIN32
  42. + # include <windows.h>
  43. + #endif
  44. + #include "version.h"
  45. + /*
  46. +  * Return TRUE if the user types a 'y' or 'Y', FALSE otherwise.
  47. +  */
  48. +     int
  49. + confirm(void)
  50. + {
  51. +     char    answer[10];
  52. +     return (scanf(" %c", answer) == 1 && toupper(answer[0]) == 'Y');
  53. + }
  54. +     int
  55. + main(int argc, char *argv[])
  56. + {
  57. +     int        fail = 0;
  58. +     printf("This program will remove the \"Edit with Vim\" entry from the popup menu\n");
  59. +     printf("Continue (y/n)? ");
  60. +     if (confirm())
  61. +     {
  62. +     if (RegDeleteKey(HKEY_CLASSES_ROOT, "*\\shell\\Vim\\command")
  63. +                                   != ERROR_SUCCESS)
  64. +         ++fail;
  65. +     if (RegDeleteKey(HKEY_CLASSES_ROOT, "*\\shell\\Vim") != ERROR_SUCCESS)
  66. +         ++fail;
  67. +     if (RegDeleteKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT) != ERROR_SUCCESS)
  68. +         ++fail;
  69. +     if (fail == 3)
  70. +         printf("No Vim registry entries could be removed\n");
  71. +     else if (fail)
  72. +         printf("Some Vim registry entries could not be removed\n");
  73. +     else
  74. +         printf("The Vim registry entries have been removed\n");
  75. +     }
  76. +     else
  77. +     printf("Nothing changed\n");
  78. +     while (getchar() != '\n')    /* eat the newline for the confirm() above */
  79. +     ;
  80. +     printf("\nHit return to exit...");
  81. +     (void)getchar();
  82. + }
  83. *** ../vim-5.4.41/src/dosinst.c    Sun Jul 25 13:44:55 1999
  84. --- ./src/dosinst.c    Sat Aug 21 15:30:07 1999
  85. ***************
  86. *** 9,15 ****
  87.   /*
  88.    * install.c: Minimalistic install program for Vim on MS-DOS/Windows
  89.    *
  90. !  * Compile with Makefile.bcc or Makefile.djg.
  91.    */
  92.   
  93.   #include <io.h>
  94. --- 9,15 ----
  95.   /*
  96.    * install.c: Minimalistic install program for Vim on MS-DOS/Windows
  97.    *
  98. !  * Compile with Makefile.w32, Makefile.bcc or Makefile.djg.
  99.    */
  100.   
  101.   #include <io.h>
  102. ***************
  103. *** 443,448 ****
  104. --- 443,472 ----
  105.       return exedir;    /* return dir name where exe is */
  106.   }
  107.   
  108. + /*
  109. +  * Copy a directory name from "dir" to "buf", doubling backslashes.
  110. +  */
  111. +     static void
  112. + double_bs(char *dir, char *buf)
  113. + {
  114. +     char *d = buf;
  115. +     char *s;
  116. +     for (s = dir; *s; ++s)
  117. +     {
  118. +     if (*s == '\\')
  119. +         *d++ = '\\';
  120. +     *d++ = *s;
  121. +     }
  122. +     /* when dir is not empty, it must end in a double backslash */
  123. +     if (d > buf && d[-1] != '\\')
  124. +     {
  125. +     *d++ = '\\';
  126. +     *d++ = '\\';
  127. +     }
  128. +     *d = 0;
  129. + }
  130.   #define TABLE_SIZE(s)    sizeof(s) / sizeof(char *)
  131.   
  132.       int
  133. ***************
  134. *** 481,486 ****
  135. --- 505,511 ----
  136.       int        i;
  137.       char    *p;
  138.       int        vimdirend;
  139. +     int        need_vimvar = 1;    /* need to set $VIM */
  140.   
  141.   #ifdef DJGPP
  142.       /*
  143. ***************
  144. *** 657,679 ****
  145.       }
  146.   
  147.       /*
  148. -      * Set $VIM, if it hasn't been set yet.
  149. -      */
  150. -     if (getenv("VIM") == NULL)
  151. -     {
  152. -     printf("\nI can append a command to c:\\autoexec.bat to set $VIM.\n");
  153. -     printf("(this will not work if c:\\autoexec.bat contains sections)\n");
  154. -     printf("Do you want me to append to your c:\\autoexec.bat? (Y/N) ");
  155. -     if (!confirm())
  156. -         printf("Skipping appending to c:\\autoexec.bat\n");
  157. -     else
  158. -     {
  159. -         vimrc[vimdirend - 1] = NUL;
  160. -         append_autoexec("set VIM=%s\n", vimrc);
  161. -     }
  162. -     }
  163. -     /*
  164.        * Set PATH or move executables, unless it's already in the $PATH.
  165.        */
  166.       mch_chdir("C:\\");    /* avoid looking in the "vimrdir" directory */
  167. --- 682,687 ----
  168. ***************
  169. *** 693,698 ****
  170. --- 701,707 ----
  171.       switch (exe)
  172.       {
  173.           case 1: append_autoexec("set PATH=%%PATH%%;%s\n", vimdir);
  174. +             need_vimvar = 0;
  175.               break;
  176.   
  177.           case 2: exedir = move_to_path(vimdir);
  178. ***************
  179. *** 705,710 ****
  180. --- 714,736 ----
  181.       }
  182.   
  183.       /*
  184. +      * Set $VIM, if it hasn't been set yet.
  185. +      */
  186. +     if (need_vimvar && getenv("VIM") == NULL)
  187. +     {
  188. +     printf("\nI can append a command to c:\\autoexec.bat to set $VIM.\n");
  189. +     printf("(this will not work if c:\\autoexec.bat contains sections)\n");
  190. +     printf("Do you want me to append to your c:\\autoexec.bat? (Y/N) ");
  191. +     if (!confirm())
  192. +         printf("Skipping appending to c:\\autoexec.bat\n");
  193. +     else
  194. +     {
  195. +         vimrc[vimdirend - 1] = NUL;
  196. +         append_autoexec("set VIM=%s\n", vimrc);
  197. +     }
  198. +     }
  199. +     /*
  200.        * Add some entries to the registry to add "Edit with Vim" to the context
  201.        * menu.
  202.        */
  203. ***************
  204. *** 726,760 ****
  205.           else
  206.           {
  207.           char    buf[BUFSIZE];
  208. -         char    *s, *d;
  209.   
  210. !         /* double the backslashes in the directory */
  211. !         d = buf;
  212. !         for (s = exedir; *s; ++s)
  213. !         {
  214. !             if (*s == '\\')
  215. !             *d++ = '\\';
  216. !             *d++ = *s;
  217. !         }
  218. !         /* when dir is not empty, it must end in a double backslash */
  219. !         if (d > buf && d[-1] != '\\')
  220. !         {
  221. !             *d++ = '\\';
  222. !             *d++ = '\\';
  223. !         }
  224. !         *d = 0;
  225.           fprintf(fd, "REGEDIT4\n\n");
  226.           fprintf(fd, "[HKEY_CLASSES_ROOT\\*\\shell\\Vim]\n");
  227.           fprintf(fd, "@=\"Edit with &Vim\"\n\n");
  228.           fprintf(fd, "[HKEY_CLASSES_ROOT\\*\\shell\\Vim\\command]\n");
  229. !         fprintf(fd, "@=\"%sgvim.exe \\\"%%L\\\"\"\n", buf);
  230.           fclose(fd);
  231.           system("regedit vim.reg");
  232.           /* Can't delete the file, because regedit detaches itself,
  233. !          * thus we don't know when it is finished */
  234. !         /* unlink("vim.reg"); */
  235.           printf("The registry editor has been started to install Vim in the popup menu.\n");
  236. !         printf("If you want to remove it, see \":help win32-popup-menu\" in Vim.\n");
  237.           }
  238.       }
  239.       }
  240. --- 752,781 ----
  241.           else
  242.           {
  243.           char    buf[BUFSIZE];
  244.   
  245. !         /* The registry entries for the "Edit with Vim" menu */
  246.           fprintf(fd, "REGEDIT4\n\n");
  247.           fprintf(fd, "[HKEY_CLASSES_ROOT\\*\\shell\\Vim]\n");
  248.           fprintf(fd, "@=\"Edit with &Vim\"\n\n");
  249.           fprintf(fd, "[HKEY_CLASSES_ROOT\\*\\shell\\Vim\\command]\n");
  250. !         double_bs(exedir, buf); /* double the backslashes */
  251. !         fprintf(fd, "@=\"%sgvim.exe \\\"%%L\\\"\"\n\n", buf);
  252. !         /* The registry entries for uninstalling the menu */
  253. !         fprintf(fd, "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\vim %s]\n", VIM_VERSION_SHORT);
  254. !         fprintf(fd, "\"DisplayName\"=\"Vim %s: Edit with Vim popup menu entry\"\n", VIM_VERSION_SHORT);
  255. !         double_bs(vimdir, buf); /* double the backslashes */
  256. !         fprintf(fd, "\"UninstallString\"=\"%suninstal.exe\"\n", buf);
  257.           fclose(fd);
  258.           system("regedit vim.reg");
  259.           /* Can't delete the file, because regedit detaches itself,
  260. !          * thus we don't know when it is finished. */
  261.           printf("The registry editor has been started to install Vim in the popup menu.\n");
  262. !         printf("Hit the \"Yes\" button in the dialog to confirm this.\n\n");
  263. !         printf("Use uninstal.exe if you want to remove it again.\n");
  264. !         printf("Also see \":help win32-popup-menu\" in Vim.\n");
  265.           }
  266.       }
  267.       }
  268. *** ../vim-5.4.41/src/Makefile.w32    Sun Jun  6 18:51:26 1999
  269. --- ./src/Makefile.w32    Sat Aug 21 15:35:08 1999
  270. ***************
  271. *** 280,286 ****
  272. --- 280,290 ----
  273.   
  274.   install.exe: dosinst.c
  275.       $(CC) -DWIN32 dosinst.c kernel32.lib shell32.lib
  276. +     - del install.exe
  277.       ren dosinst.exe install.exe
  278. + uninstal.exe: uninstal.c
  279. +     $(CC) -DWIN32 uninstal.c advapi32.lib
  280.   
  281.   vimrun.exe: vimrun.c
  282.       $(CC) vimrun.c
  283. *** ../vim-5.4.41/uninstal.txt    Thu Jan  1 01:00:00 1970
  284. --- ./uninstal.txt    Sat Aug 21 15:14:08 1999
  285. ***************
  286. *** 0 ****
  287. --- 1,48 ----
  288. + Uninstalling Vim on Dos and MS-Windows.
  289. + To remove a version of Vim you must do some handwork.  But it isn't difficult,
  290. + just follow these steps:
  291. + 1. Remove the "Edit with Vim" popup menu entry, if it exists.  This will only
  292. +    be on MS-Windows 95/98/NT.  This is done by running the uninstal.exe
  293. +    program.  It removes the registry entries for the "Edit with Vim" popup
  294. +    menu entry.  You only need to run uninstal.exe when you have installed the
  295. +    menu entry.  You can also run uninstal.exe from the Control panel with the
  296. +    Add/Remove programs application.
  297. + 2. Only if you have used the OLE version of gvim: Remove the registration of
  298. +    this program by running "gvim -unregister" in a console window.
  299. + 3. Delete the executables.  If you copied the executables to another location,
  300. +    you will have to delete them from where you copied them to.  If you don't
  301. +    remember where they are, look in the directories from the $PATH environment
  302. +    variable.
  303. + 4. If you completely want to delete vim, and are not going to install another
  304. +    version, you can delete the vimrc files that you created.  These are
  305. +    normally located in a directory like "C:\vim".  If the $VIM environment
  306. +    variable is set, it will tell the name of the directory.  Normally you can
  307. +    delete everything in this directory.  Warning: You might have put some
  308. +    files there that you would like to save.  If you did remove it all, you can
  309. +    skip the next step.
  310. + 5. Delete the distributed files.  If you followed the directions, these will
  311. +    be located in a directory like "C:\vim\vim54".  If the $VIM environment
  312. +    variable is set, the directory will be $VIM\vim54.  Delete the "vim54"
  313. +    directory and all that is in it.  Warning: If you changed any of the
  314. +    distributed files, or added some of your own files, you might want to save
  315. +    these first.  But normally you would not have changed or added files here.
  316. + 6. Remove setting the $VIM and $VIMRUNTIME environment variable and adjust
  317. +    $PATH.  $VIM only needs to be removed if you are not going to install
  318. +    another version of Vim.  $VIMRUNTIME is mostly not set.  Check if $PATH
  319. +    contains the path of the vim directory.  Note that $PATH may be set in
  320. +    several places, you will have to find the right one, and only delete the
  321. +    Vim path from it.  You can most likely find the lines that set $PATH, $VIM
  322. +    and/or $VIMRUNTIME in C:\autoexec.bat.  Under Windows NT you might need to
  323. +    use the "System Properties" editor to change the environment variables, if
  324. +    they are not in the C:\autoexec.bat file.  You can start it by selecting
  325. +    Start/Settings/Control Panel and then "System".
  326. + Vim does not use .dll or .ini files.  The above should remove all Vim files,
  327. + except the ones that you moved elsewhere yourself.
  328.  
  329. --
  330. hundred-and-one symptoms of being an internet addict:
  331. 176. You lie, even to user-friends, about how long you were online yesterday.
  332.  
  333. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  334.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  335.