diff options
| author | Juanma Barranquero | 2006-12-15 14:53:44 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2006-12-15 14:53:44 +0000 |
| commit | 4472aef4c3bd2a802f4381477d747d88c867ff3d (patch) | |
| tree | 4e7c068819941700384c115dcc1fcc152cc2774d /lib-src | |
| parent | c6e87e896823db85f227377dfb76e2750fd5d109 (diff) | |
| download | emacs-4472aef4c3bd2a802f4381477d747d88c867ff3d.tar.gz emacs-4472aef4c3bd2a802f4381477d747d88c867ff3d.zip | |
(w32_execvp): New function; wrapper for `execvp'.
(execvp) [WINDOWSNT]: Redefine to `w32_execvp'.
(fail): Remove Windows-specific fix (subsumed in w32_execvp).
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 15 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 40 |
2 files changed, 48 insertions, 7 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 @@ | |||
| 1 | 2006-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 | |||
| 1 | 2006-12-06 Christoph Conrad <christoph.conrad@gmx.de> | 8 | 2006-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 | ||
| 22 | 2006-11-28 Kevin Ryde <user42@zip.com.au> (tiny change) | 29 | 2006-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 | ||
| 26 | 2006-11-28 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> (tiny change) | 33 | 2006-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 | ||
| 56 | 2006-11-24 Michael Mauger <mmaug@yahoo.com> | 63 | 2006-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 | ||
| 61 | 2006-11-23 Juanma Barranquero <lekktu@gmail.com> | 68 | 2006-11-23 Juanma Barranquero <lekktu@gmail.com> |
| 62 | 69 | ||
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index f05b98eccee..429d4b5bdc4 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -298,6 +298,42 @@ Report bugs to bug-gnu-emacs@gnu.org.\n", progname); | |||
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | 300 | ||
| 301 | #ifdef WINDOWSNT | ||
| 302 | |||
| 303 | /* | ||
| 304 | execvp() wrapper for Windows. Quotes arguments with embedded spaces. | ||
| 305 | |||
| 306 | This is necessary due to the broken implementation of exec* routines in | ||
| 307 | the Microsoft libraries: they concatenate the arguments together without | ||
| 308 | quoting special characters, and pass the result to CreateProcess, with | ||
| 309 | predictably bad results. By contrast, Posix execvp passes the arguments | ||
| 310 | directly into the argv[] array of the child process. | ||
| 311 | */ | ||
| 312 | int | ||
| 313 | w32_execvp (path, argv) | ||
| 314 | char *path; | ||
| 315 | char **argv; | ||
| 316 | { | ||
| 317 | int i; | ||
| 318 | |||
| 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); |