aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorDan Nicolaescu2007-05-16 16:14:26 +0000
committerDan Nicolaescu2007-05-16 16:14:26 +0000
commit105faa8427cdb6738c01c3c3b0f7274749f8f259 (patch)
tree46d54158020a151d6e75d2367a6d9610df7d8570 /lib-src
parentfa7a701fe384e93dcefee2623dd813d685089faf (diff)
downloademacs-105faa8427cdb6738c01c3c3b0f7274749f8f259.tar.gz
emacs-105faa8427cdb6738c01c3c3b0f7274749f8f259.zip
* emacsclient.c (s): Restore.
(main): Don't define s here. (w32_execvp): Move definition before use.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog.multi-tty6
-rw-r--r--lib-src/emacsclient.c76
2 files changed, 42 insertions, 40 deletions
diff --git a/lib-src/ChangeLog.multi-tty b/lib-src/ChangeLog.multi-tty
index 1c55d3d9845..21862e5ed32 100644
--- a/lib-src/ChangeLog.multi-tty
+++ b/lib-src/ChangeLog.multi-tty
@@ -1,3 +1,9 @@
12007-05-16 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * emacsclient.c (s): Restore.
4 (main): Don't define s here.
5 (w32_execvp): Move definition before use.
6
12007-05-16 Jason Rumney <jasonr@gnu.org> 72007-05-16 Jason Rumney <jasonr@gnu.org>
2 8
3 * emacsclient.c (s): Remove. 9 * emacsclient.c (s): Remove.
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index b155035f760..cf03430e9c5 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -172,7 +172,7 @@ char *server_file = NULL;
172int emacs_pid = 0; 172int emacs_pid = 0;
173 173
174/* Socket used to communicate with the Emacs server process. */ 174/* Socket used to communicate with the Emacs server process. */
175/*HSOCKET s;*/ 175HSOCKET s;
176 176
177void print_help_and_exit () NO_RETURN; 177void print_help_and_exit () NO_RETURN;
178 178
@@ -314,7 +314,41 @@ w32_window_app ()
314 314
315 return window_app; 315 return window_app;
316} 316}
317#endif 317
318/*
319 execvp wrapper for Windows. Quotes arguments with embedded spaces.
320
321 This is necessary due to the broken implementation of exec* routines in
322 the Microsoft libraries: they concatenate the arguments together without
323 quoting special characters, and pass the result to CreateProcess, with
324 predictably bad results. By contrast, Posix execvp passes the arguments
325 directly into the argv array of the child process.
326*/
327int
328w32_execvp (path, argv)
329 char *path;
330 char **argv;
331{
332 int i;
333
334 /* Required to allow a .BAT script as alternate editor. */
335 argv[0] = (char *) alternate_editor;
336
337 for (i = 0; argv[i]; i++)
338 if (strchr (argv[i], ' '))
339 {
340 char *quoted = alloca (strlen (argv[i]) + 3);
341 sprintf (quoted, "\"%s\"", argv[i]);
342 argv[i] = quoted;
343 }
344
345 return execvp (path, argv);
346}
347
348#undef execvp
349#define execvp w32_execvp
350
351#endif /* WINDOWSNT */
318 352
319void 353void
320message (int is_error, char *message, ...) 354message (int is_error, char *message, ...)
@@ -736,43 +770,6 @@ initialize_sockets ()
736#endif /* WINDOWSNT */ 770#endif /* WINDOWSNT */
737 771
738 772
739#ifdef WINDOWSNT
740
741/*
742 execvp wrapper for Windows. Quotes arguments with embedded spaces.
743
744 This is necessary due to the broken implementation of exec* routines in
745 the Microsoft libraries: they concatenate the arguments together without
746 quoting special characters, and pass the result to CreateProcess, with
747 predictably bad results. By contrast, Posix execvp passes the arguments
748 directly into the argv array of the child process.
749*/
750int
751w32_execvp (path, argv)
752 char *path;
753 char **argv;
754{
755 int i;
756
757 /* Required to allow a .BAT script as alternate editor. */
758 argv[0] = (char *) alternate_editor;
759
760 for (i = 0; argv[i]; i++)
761 if (strchr (argv[i], ' '))
762 {
763 char *quoted = alloca (strlen (argv[i]) + 3);
764 sprintf (quoted, "\"%s\"", argv[i]);
765 argv[i] = quoted;
766 }
767
768 return execvp (path, argv);
769}
770
771#undef execvp
772#define execvp w32_execvp
773
774#endif /* WINDOWSNT */
775
776/* 773/*
777 * Read the information needed to set up a TCP comm channel with 774 * Read the information needed to set up a TCP comm channel with
778 * the Emacs server: host, port, pid and authentication string. 775 * the Emacs server: host, port, pid and authentication string.
@@ -1265,7 +1262,6 @@ main (argc, argv)
1265 int argc; 1262 int argc;
1266 char **argv; 1263 char **argv;
1267{ 1264{
1268 HSOCKET s;
1269 int i, rl, needlf = 0; 1265 int i, rl, needlf = 0;
1270 char *cwd, *str; 1266 char *cwd, *str;
1271 char string[BUFSIZ+1]; 1267 char string[BUFSIZ+1];