diff options
| author | Geoff Voelker | 1997-08-17 01:44:27 +0000 |
|---|---|---|
| committer | Geoff Voelker | 1997-08-17 01:44:27 +0000 |
| commit | 65cd66876a0d2a0a76718ce17909797e7d662771 (patch) | |
| tree | 389066dcf4e187246f07d9afb5ac7f640718db88 | |
| parent | 850101edca5460c14e246a6e5f2f77e553a8acec (diff) | |
| download | emacs-65cd66876a0d2a0a76718ce17909797e7d662771.tar.gz emacs-65cd66876a0d2a0a76718ce17909797e7d662771.zip | |
(env_vars): Set SHELL to cmdproxy.
(main): Initialize idDde to 0.
Determine emacs_path from module file name.
Prompt for install.
| -rw-r--r-- | nt/addpm.c | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/nt/addpm.c b/nt/addpm.c index 2138143ccd9..56718f9a76b 100644 --- a/nt/addpm.c +++ b/nt/addpm.c | |||
| @@ -55,7 +55,7 @@ env_vars[] = | |||
| 55 | { | 55 | { |
| 56 | {"emacs_dir", NULL}, | 56 | {"emacs_dir", NULL}, |
| 57 | {"EMACSLOADPATH", "%emacs_dir%/lisp;%emacs_dir%/site-lisp"}, | 57 | {"EMACSLOADPATH", "%emacs_dir%/lisp;%emacs_dir%/site-lisp"}, |
| 58 | {"SHELL", "%COMSPEC%"}, | 58 | {"SHELL", "%emacs_dir/bin/cmdproxy.exe%"}, |
| 59 | {"EMACSDATA", "%emacs_dir%/etc"}, | 59 | {"EMACSDATA", "%emacs_dir%/etc"}, |
| 60 | {"EMACSPATH", "%emacs_dir%/bin"}, | 60 | {"EMACSPATH", "%emacs_dir%/bin"}, |
| 61 | {"EMACSLOCKDIR", "%emacs_dir%/lock"}, | 61 | {"EMACSLOCKDIR", "%emacs_dir%/lock"}, |
| @@ -106,19 +106,61 @@ main (argc, argv) | |||
| 106 | int argc; | 106 | int argc; |
| 107 | char *argv[]; | 107 | char *argv[]; |
| 108 | { | 108 | { |
| 109 | DWORD idDde; | 109 | DWORD idDde = 0; |
| 110 | HCONV HConversation; | 110 | HCONV HConversation; |
| 111 | HSZ ProgMan; | 111 | HSZ ProgMan; |
| 112 | char modname[MAX_PATH]; | ||
| 112 | char additem[MAX_PATH*2 + 100]; | 113 | char additem[MAX_PATH*2 + 100]; |
| 113 | char *lpext; | 114 | char *lpext; |
| 115 | char *emacs_path; | ||
| 116 | char *p; | ||
| 114 | 117 | ||
| 118 | /* If no args specified, use our location to set emacs_path. */ | ||
| 119 | #if 0 | ||
| 115 | if (argc < 2 || argc > 3) | 120 | if (argc < 2 || argc > 3) |
| 116 | { | 121 | { |
| 117 | fprintf (stderr, "usage: addpm emacs_path [icon_path]\n"); | 122 | fprintf (stderr, "usage: addpm emacs_path [icon_path]\n"); |
| 118 | exit (1); | 123 | exit (1); |
| 119 | } | 124 | } |
| 125 | #endif | ||
| 120 | 126 | ||
| 121 | lpext = add_registry (argv[1]) ? "exe" : "bat"; | 127 | if (argc > 1) |
| 128 | emacs_path = argv[1]; | ||
| 129 | else | ||
| 130 | { | ||
| 131 | if (!GetModuleFileName (NULL, modname, MAX_PATH) || | ||
| 132 | (p = strrchr (modname, '\\')) == NULL) | ||
| 133 | { | ||
| 134 | fprintf (stderr, "fatal error"); | ||
| 135 | exit (1); | ||
| 136 | } | ||
| 137 | *p = 0; | ||
| 138 | |||
| 139 | /* Set emacs_path to emacs_dir if we are in "%emacs_dir%\bin". */ | ||
| 140 | if ((p = strrchr (modname, '\\')) && stricmp (p, "\\bin") == 0) | ||
| 141 | { | ||
| 142 | *p = 0; | ||
| 143 | emacs_path = modname; | ||
| 144 | } | ||
| 145 | else | ||
| 146 | { | ||
| 147 | fprintf (stderr, "usage: addpm emacs_path [icon_path]\n"); | ||
| 148 | exit (1); | ||
| 149 | } | ||
| 150 | |||
| 151 | /* Tell user what we are going to do. */ | ||
| 152 | { | ||
| 153 | char msg[ MAX_PATH ]; | ||
| 154 | sprintf (msg, "Install Emacs at %s?\n", emacs_path); | ||
| 155 | if (!MessageBox (NULL, msg, "Install Emacs", MB_OKCANCEL | MB_ICONQUESTION)) | ||
| 156 | { | ||
| 157 | fprintf (stderr, "Install cancelled\n"); | ||
| 158 | exit (1); | ||
| 159 | } | ||
| 160 | } | ||
| 161 | } | ||
| 162 | |||
| 163 | lpext = add_registry (emacs_path) ? "exe" : "bat"; | ||
| 122 | 164 | ||
| 123 | DdeInitialize (&idDde, (PFNCALLBACK)DdeCallback, APPCMD_CLIENTONLY, 0); | 165 | DdeInitialize (&idDde, (PFNCALLBACK)DdeCallback, APPCMD_CLIENTONLY, 0); |
| 124 | 166 | ||
| @@ -129,7 +171,7 @@ main (argc, argv) | |||
| 129 | DdeCommand ("[CreateGroup (Gnu Emacs)]"); | 171 | DdeCommand ("[CreateGroup (Gnu Emacs)]"); |
| 130 | DdeCommand ("[ReplaceItem (Emacs)]"); | 172 | DdeCommand ("[ReplaceItem (Emacs)]"); |
| 131 | sprintf (additem, "[AddItem (%s\\bin\\runemacs.%s, Emacs%c%s)]", | 173 | sprintf (additem, "[AddItem (%s\\bin\\runemacs.%s, Emacs%c%s)]", |
| 132 | argv[1], lpext, (argc>2 ? ',' : ' '), | 174 | emacs_path, lpext, (argc>2 ? ',' : ' '), |
| 133 | (argc>2 ? argv[2] : "")); | 175 | (argc>2 ? argv[2] : "")); |
| 134 | DdeCommand (additem); | 176 | DdeCommand (additem); |
| 135 | 177 | ||