Mercurial > hg > xemacs-beta
diff nt/runemacs.c @ 321:19dcec799385 r21-0-58
Import from CVS: tag r21-0-58
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:46:44 +0200 |
parents | c9fe270a4101 |
children | a4f53d9b3154 |
line wrap: on
line diff
--- a/nt/runemacs.c Mon Aug 13 10:46:01 2007 +0200 +++ b/nt/runemacs.c Mon Aug 13 10:46:44 2007 +0200 @@ -41,6 +41,7 @@ int wait_for_child = FALSE; DWORD ret_code = 0; char *new_cmdline; + char *basename; char *p; char modname[MAX_PATH]; @@ -48,6 +49,10 @@ goto error; if ((p = strrchr (modname, '\\')) == NULL) goto error; + + basename = alloca(strlen(p) + 1); + strcpy (basename, p + 1); + *p = 0; new_cmdline = alloca (MAX_PATH + strlen (cmdline) + 1); @@ -90,36 +95,45 @@ char sym_link_name[MAX_PATH+1], real_name[MAX_PATH+1]; strcpy(sym_link_name, new_cmdline); - strcat(sym_link_name, "\\xemacs"); - if (lstat(sym_link_name, &stbuf) == 0) + if (strcmp(basename, "rungnuclient.exe") == 0) + strcat(new_cmdline, "\\gnuclient.exe "); + else if (strcmp(basename, "runemacs.exe") == 0) { - if ((stbuf.st_mode & S_IFLNK) == S_IFLNK) + strcat(sym_link_name, "\\xemacs"); + + if (lstat(sym_link_name, &stbuf) == 0) { - if (readlink(sym_link_name, real_name, sizeof(real_name)) == -1) + if ((stbuf.st_mode & S_IFLNK) == S_IFLNK) { - MessageBox (NULL, "Error reading symbolic link for xemacs", - "Error", MB_ICONSTOP); - return 1; + if (readlink(sym_link_name, real_name, sizeof(real_name)) == -1) + { + MessageBox (NULL, "Error reading symbolic link for xemacs", + "Error", MB_ICONSTOP); + return 1; + } + else + { + strcat(new_cmdline, "\\"); + strcat(new_cmdline, real_name); + strcat(new_cmdline, " "); + } } else - { - strcat(new_cmdline, "\\"); - strcat(new_cmdline, real_name); - strcat(new_cmdline, " "); - } + strcat(new_cmdline, "\\xemacs "); } else - strcat(new_cmdline, "\\xemacs "); - } - else - { - MessageBox (NULL, "can't locate XEmacs executable", - "Error", MB_ICONSTOP); - return 1; + { + MessageBox (NULL, "can't locate XEmacs executable", + "Error", MB_ICONSTOP); + return 1; + } } } #else - strcat (new_cmdline, "\\xemacs.exe "); + if (strcmp(basename, "rungnuclient.exe") == 0) + strcat (new_cmdline, "\\gnuclient.exe "); + else + strcat (new_cmdline, "\\xemacs.exe "); #endif #endif @@ -166,6 +180,6 @@ return (int) ret_code; error: - MessageBox (NULL, "Could not start XEmacs.", "Error", MB_ICONSTOP); + MessageBox (NULL, "Could not start XEmacs or gnuclient.", "Error", MB_ICONSTOP); return 1; }