+ if (argc > 1)
+ emacs_path = argv[1];
+ else
+ {
+ if (!GetModuleFileName (NULL, modname, MAX_PATH) ||
+ (p = strrchr (modname, '\\')) == NULL)
+ {
+ fprintf (stderr, "fatal error");
+ exit (1);
+ }
+ *p = 0;
+
+ /* Set emacs_path to emacs_dir if we are in "%emacs_dir%\bin". */
+ if ((p = strrchr (modname, '\\')) && stricmp (p, "\\bin") == 0)
+ {
+ *p = 0;
+ emacs_path = modname;
+ }
+ else
+ {
+ fprintf (stderr, "usage: addpm emacs_path [icon_path]\n");
+ exit (1);
+ }
+
+ /* Tell user what we are going to do. */
+ if (!quiet)
+ {
+ int result;
+
+ char msg[ MAX_PATH ];
+ sprintf (msg, "Install Emacs at %s?\n", emacs_path);
+ result = MessageBox (NULL, msg, "Install Emacs",
+ MB_OKCANCEL | MB_ICONQUESTION);
+ if (result != IDOK)
+ {
+ fprintf (stderr, "Install cancelled\n");
+ exit (1);
+ }
+ }
+ }
+
+ add_registry (emacs_path);
+ prog_name = "runemacs.exe";