From 82c9d8be7f698a6f66589fefb61c63d3d50e213f Mon Sep 17 00:00:00 2001 From: tomo Date: Mon, 17 May 1999 09:42:09 +0000 Subject: [PATCH] XEmacs 21.2-b3 --- nt/runemacs.c | 56 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/nt/runemacs.c b/nt/runemacs.c index a516eec..1b5d3e1 100644 --- a/nt/runemacs.c +++ b/nt/runemacs.c @@ -41,6 +41,7 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) int wait_for_child = FALSE; DWORD ret_code = 0; char *new_cmdline; + char *basename; char *p; char modname[MAX_PATH]; @@ -48,6 +49,10 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) 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 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) 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 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) 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; } -- 1.7.10.4