comparison nt/runemacs.c @ 290:c9fe270a4101 r21-0b43

Import from CVS: tag r21-0b43
author cvs
date Mon, 13 Aug 2007 10:36:47 +0200
parents e121b013d1f0
children 19dcec799385
comparison
equal deleted inserted replaced
289:6e6992ccc4b6 290:c9fe270a4101
23 #define WIN32 23 #define WIN32
24 24
25 #include <windows.h> 25 #include <windows.h>
26 #include <string.h> 26 #include <string.h>
27 #include <malloc.h> 27 #include <malloc.h>
28
29 #if defined(__CYGWIN32__)
30 #include <sys/types.h>
31 #include <sys/stat.h>
32 #endif
28 33
29 int WINAPI 34 int WINAPI
30 WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) 35 WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
31 { 36 {
32 STARTUPINFO start; 37 STARTUPINFO start;
77 *p++ = '\\'; 82 *p++ = '\\';
78 strcpy (p, best_name); 83 strcpy (p, best_name);
79 strcat (p, " "); 84 strcat (p, " ");
80 } 85 }
81 #else 86 #else
87 #if defined(__CYGWIN32__)
88 {
89 struct stat stbuf;
90 char sym_link_name[MAX_PATH+1], real_name[MAX_PATH+1];
91
92 strcpy(sym_link_name, new_cmdline);
93 strcat(sym_link_name, "\\xemacs");
94 if (lstat(sym_link_name, &stbuf) == 0)
95 {
96 if ((stbuf.st_mode & S_IFLNK) == S_IFLNK)
97 {
98 if (readlink(sym_link_name, real_name, sizeof(real_name)) == -1)
99 {
100 MessageBox (NULL, "Error reading symbolic link for xemacs",
101 "Error", MB_ICONSTOP);
102 return 1;
103 }
104 else
105 {
106 strcat(new_cmdline, "\\");
107 strcat(new_cmdline, real_name);
108 strcat(new_cmdline, " ");
109 }
110 }
111 else
112 strcat(new_cmdline, "\\xemacs ");
113 }
114 else
115 {
116 MessageBox (NULL, "can't locate XEmacs executable",
117 "Error", MB_ICONSTOP);
118 return 1;
119 }
120 }
121 #else
82 strcat (new_cmdline, "\\xemacs.exe "); 122 strcat (new_cmdline, "\\xemacs.exe ");
123 #endif
83 #endif 124 #endif
84 125
85 /* Append original arguments if any; first look for -wait as first 126 /* Append original arguments if any; first look for -wait as first
86 argument, and apply that ourselves. */ 127 argument, and apply that ourselves. */
87 if (strncmp (cmdline, "-wait", 5) == 0) 128 if (strncmp (cmdline, "-wait", 5) == 0)