aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog15
-rw-r--r--lib-src/emacsclient.c52
2 files changed, 54 insertions, 13 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 97266d8a66e..f15644050d9 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,10 @@
12006-12-15 Juanma Barranquero <lekktu@gmail.com>
2
3 * emacsclient.c (w32_execvp): New function; wrapper for `execvp'.
4 (execvp) [WINDOWSNT]: Redefine to `w32_execvp'.
5 (fail): Remove Windows-specific fix (subsumed into w32_execvp).
6 Suggestions and comment by Eli Zaretskii.
7
12006-12-06 Christoph Conrad <christoph.conrad@gmx.de> 82006-12-06 Christoph Conrad <christoph.conrad@gmx.de>
2 9
3 * makefile.w32-in ($(BLD)/emacsclient.exe, $(BLD)/emacsclientw.exe): 10 * makefile.w32-in ($(BLD)/emacsclient.exe, $(BLD)/emacsclientw.exe):
@@ -19,11 +26,11 @@
19 (set_tcp_socket): Make the message for non-local connections 26 (set_tcp_socket): Make the message for non-local connections
20 informational rather than an error. 27 informational rather than an error.
21 28
222006-11-28 Kevin Ryde <user42@zip.com.au> (tiny change) 292006-11-28 Kevin Ryde <user42@zip.com.au> (tiny change)
23 30
24 * etags.c (readline): Check for double quote after #line. 31 * etags.c (readline): Check for double quote after #line.
25 32
262006-11-28 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> (tiny change) 332006-11-28 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
27 34
28 * etags.c (readline): sscanf could in principle return 2. 35 * etags.c (readline): sscanf could in principle return 2.
29 36
@@ -55,8 +62,8 @@
55 62
562006-11-24 Michael Mauger <mmaug@yahoo.com> 632006-11-24 Michael Mauger <mmaug@yahoo.com>
57 64
58 * emacsclient.c (file_name_absolute_p) [WINDOWSNT]: Support 65 * emacsclient.c (file_name_absolute_p) [WINDOWSNT]: Support absolute
59 absolute file names with forward slashes. 66 file names with forward slashes.
60 67
612006-11-23 Juanma Barranquero <lekktu@gmail.com> 682006-11-23 Juanma Barranquero <lekktu@gmail.com>
62 69
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index f05b98eccee..bbd6cbe239b 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -152,16 +152,15 @@ struct option longopts[] =
152/* Message functions. */ 152/* Message functions. */
153 153
154#ifdef WINDOWSNT 154#ifdef WINDOWSNT
155/* I first tried to check for STDOUT. The check did not work,
156 I get a valid handle also in nonconsole apps.
157 Instead I test for console title, which seems to work. */
158int 155int
159w32_window_app() 156w32_window_app ()
160{ 157{
161 static int window_app = -1; 158 static int window_app = -1;
162 char szTitle[MAX_PATH]; 159 char szTitle[MAX_PATH];
163 160
164 if (window_app < 0) 161 if (window_app < 0)
162 /* Checking for STDOUT does not work; it's a valid handle also in
163 nonconsole apps. Testing for the console title seems to work. */
165 window_app = (GetConsoleTitleA (szTitle, MAX_PATH) == 0); 164 window_app = (GetConsoleTitleA (szTitle, MAX_PATH) == 0);
166 165
167 return window_app; 166 return window_app;
@@ -298,6 +297,43 @@ Report bugs to bug-gnu-emacs@gnu.org.\n", progname);
298} 297}
299 298
300 299
300#ifdef WINDOWSNT
301
302/*
303 execvp wrapper for Windows. Quotes arguments with embedded spaces.
304
305 This is necessary due to the broken implementation of exec* routines in
306 the Microsoft libraries: they concatenate the arguments together without
307 quoting special characters, and pass the result to CreateProcess, with
308 predictably bad results. By contrast, Posix execvp passes the arguments
309 directly into the argv array of the child process.
310*/
311int
312w32_execvp (path, argv)
313 char *path;
314 char **argv;
315{
316 int i;
317
318 /* Required to allow a .BAT script as alternate editor. */
319 argv[0] = (char *) alternate_editor;
320
321 for (i = 0; argv[i]; i++)
322 if (strchr (argv[i], ' '))
323 {
324 char *quoted = alloca (strlen (argv[i]) + 3);
325 sprintf (quoted, "\"%s\"", argv[i]);
326 argv[i] = quoted;
327 }
328
329 return execvp (path, argv);
330}
331
332#undef execvp
333#define execvp w32_execvp
334
335#endif /* WINDOWSNT */
336
301/* 337/*
302 Try to run a different command, or --if no alternate editor is 338 Try to run a different command, or --if no alternate editor is
303 defined-- exit with an errorcode. 339 defined-- exit with an errorcode.
@@ -310,9 +346,7 @@ fail (argc, argv)
310 if (alternate_editor) 346 if (alternate_editor)
311 { 347 {
312 int i = optind - 1; 348 int i = optind - 1;
313#ifdef WINDOWSNT 349
314 argv[i] = (char *)alternate_editor;
315#endif
316 execvp (alternate_editor, argv + i); 350 execvp (alternate_editor, argv + i);
317 message (TRUE, "%s: error executing alternate editor \"%s\"\n", 351 message (TRUE, "%s: error executing alternate editor \"%s\"\n",
318 progname, alternate_editor); 352 progname, alternate_editor);
@@ -463,7 +497,7 @@ file_name_absolute_p (filename)
463} 497}
464 498
465#ifdef WINDOWSNT 499#ifdef WINDOWSNT
466/* Wrapper to make WSACleanup a cdecl, as required by atexit(). */ 500/* Wrapper to make WSACleanup a cdecl, as required by atexit. */
467void 501void
468__cdecl close_winsock () 502__cdecl close_winsock ()
469{ 503{
@@ -858,7 +892,7 @@ main (argc, argv)
858 /* 892 /*
859 Modern Windows restrict which processes can set the foreground window. 893 Modern Windows restrict which processes can set the foreground window.
860 emacsclient can allow Emacs to grab the focus by calling the function 894 emacsclient can allow Emacs to grab the focus by calling the function
861 AllowSetForegroundWindow(). Unfortunately, older Windows (W95, W98 895 AllowSetForegroundWindow. Unfortunately, older Windows (W95, W98
862 and NT) lack this function, so we have to check its availability. 896 and NT) lack this function, so we have to check its availability.
863 */ 897 */
864 if (emacs_pid) 898 if (emacs_pid)