On 12/15/06, Eli Zaretskii wrote: > Actually, a cleaner way of fixing this would be to have a > WINDOWSNT-only wrapper for execvp, called, say w32_execvp, that does > TRT with quoting the arguments. You like this one better, then? /L/e/k/t/u Index: lib-src/emacsclient.c =================================================================== RCS file: /cvsroot/emacs/emacs/lib-src/emacsclient.c,v retrieving revision 1.98 diff -u -2 -r1.98 emacsclient.c --- lib-src/emacsclient.c 30 Nov 2006 22:49:38 -0000 1.98 +++ lib-src/emacsclient.c 15 Dec 2006 11:49:57 -0000 @@ -299,4 +299,35 @@ +#ifdef WINDOWSNT + +/* + execvp() wrapper for Windows. + Quotes arguments with embedded spaces. +*/ +int +w32_execvp (path, argv) + char *path; + char **argv; +{ + int i; + + argv[0] = (char *) alternate_editor; + + for (i = 0; argv[i]; i++) + if (strchr (argv[i], ' ')) + { + char *quoted = alloca (strlen (argv[i]) + 3); + sprintf (quoted, "\"%s\"", argv[i]); + argv[i] = quoted; + } + + return execvp (path, argv); +} + +#undef execvp +#define execvp w32_execvp + +#endif /* WINDOWSNT */ + /* Try to run a different command, or --if no alternate editor is @@ -311,7 +342,5 @@ { int i = optind - 1; -#ifdef WINDOWSNT - argv[i] = (char *)alternate_editor; -#endif + execvp (alternate_editor, argv + i); message (TRUE, "%s: error executing alternate editor \"%s\"\n",