aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/emacsclient.c
diff options
context:
space:
mode:
authorStefan Monnier2010-09-13 16:40:48 +0200
committerStefan Monnier2010-09-13 16:40:48 +0200
commitcc390e46c7ba95b76ea133d98fd386214cd01709 (patch)
treeead4400d22bd07214b782ff7e46e79d473fac419 /lib-src/emacsclient.c
parentc566235d981eba73c88bbff00b6a1d88360b6e9f (diff)
parentc5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d (diff)
downloademacs-cc390e46c7ba95b76ea133d98fd386214cd01709.tar.gz
emacs-cc390e46c7ba95b76ea133d98fd386214cd01709.zip
Merge from trunk
Diffstat (limited to 'lib-src/emacsclient.c')
-rw-r--r--lib-src/emacsclient.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index cbc1dfe3f6a..e8ffbe7c562 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -134,7 +134,7 @@ int eval = 0;
134int current_frame = 1; 134int current_frame = 1;
135 135
136/* The display on which Emacs should work. --display. */ 136/* The display on which Emacs should work. --display. */
137char *display = NULL; 137const char *display = NULL;
138 138
139/* The parent window ID, if we are opening a frame via XEmbed. */ 139/* The parent window ID, if we are opening a frame via XEmbed. */
140char *parent_id = NULL; 140char *parent_id = NULL;
@@ -150,7 +150,7 @@ const char *alternate_editor = NULL;
150char *socket_name = NULL; 150char *socket_name = NULL;
151 151
152/* If non-NULL, the filename of the authentication file. */ 152/* If non-NULL, the filename of the authentication file. */
153char *server_file = NULL; 153const char *server_file = NULL;
154 154
155/* PID of the Emacs server process. */ 155/* PID of the Emacs server process. */
156int emacs_pid = 0; 156int emacs_pid = 0;
@@ -479,7 +479,7 @@ ttyname (int fd)
479/* Display a normal or error message. 479/* Display a normal or error message.
480 On Windows, use a message box if compiled as a Windows app. */ 480 On Windows, use a message box if compiled as a Windows app. */
481void 481void
482message (int is_error, char *message, ...) 482message (int is_error, const char *message, ...)
483{ 483{
484 char msg[2048]; 484 char msg[2048];
485 va_list args; 485 va_list args;
@@ -724,7 +724,7 @@ HSOCKET emacs_socket = 0;
724/* On Windows, the socket library was historically separate from the standard 724/* On Windows, the socket library was historically separate from the standard
725 C library, so errors are handled differently. */ 725 C library, so errors are handled differently. */
726void 726void
727sock_err_message (char *function_name) 727sock_err_message (const char *function_name)
728{ 728{
729#ifdef WINDOWSNT 729#ifdef WINDOWSNT
730 char* msg = NULL; 730 char* msg = NULL;
@@ -748,7 +748,7 @@ sock_err_message (char *function_name)
748 - the buffer is full (but this shouldn't happen) 748 - the buffer is full (but this shouldn't happen)
749 Otherwise, we just accumulate it. */ 749 Otherwise, we just accumulate it. */
750void 750void
751send_to_emacs (HSOCKET s, char *data) 751send_to_emacs (HSOCKET s, const char *data)
752{ 752{
753 while (data) 753 while (data)
754 { 754 {
@@ -787,10 +787,11 @@ send_to_emacs (HSOCKET s, char *data)
787 787
788 Does not change the string. Outputs the result to S. */ 788 Does not change the string. Outputs the result to S. */
789void 789void
790quote_argument (HSOCKET s, char *str) 790quote_argument (HSOCKET s, const char *str)
791{ 791{
792 char *copy = (char *) xmalloc (strlen (str) * 2 + 1); 792 char *copy = (char *) xmalloc (strlen (str) * 2 + 1);
793 char *p, *q; 793 const char *p;
794 char *q;
794 795
795 p = str; 796 p = str;
796 q = copy; 797 q = copy;
@@ -1026,7 +1027,7 @@ set_tcp_socket (void)
1026 1027
1027/* Returns 1 if PREFIX is a prefix of STRING. */ 1028/* Returns 1 if PREFIX is a prefix of STRING. */
1028static int 1029static int
1029strprefix (char *prefix, char *string) 1030strprefix (const char *prefix, const char *string)
1030{ 1031{
1031 return !strncmp (prefix, string, strlen (prefix)); 1032 return !strncmp (prefix, string, strlen (prefix));
1032} 1033}
@@ -1215,8 +1216,8 @@ set_local_socket (void)
1215 int sock_status = 0; 1216 int sock_status = 0;
1216 int default_sock = !socket_name; 1217 int default_sock = !socket_name;
1217 int saved_errno = 0; 1218 int saved_errno = 0;
1218 char *server_name = "server"; 1219 const char *server_name = "server";
1219 char *tmpdir; 1220 const char *tmpdir;
1220 1221
1221 if (socket_name && !strchr (socket_name, '/') 1222 if (socket_name && !strchr (socket_name, '/')
1222 && !strchr (socket_name, '\\')) 1223 && !strchr (socket_name, '\\'))
@@ -1479,11 +1480,13 @@ start_daemon_and_retry_set_socket (void)
1479 } 1480 }
1480 else 1481 else
1481 { 1482 {
1482 char *d_argv[] = {"emacs", "--daemon", 0 }; 1483 char emacs[] = "emacs";
1484 char daemon[] = "--daemon";
1485 char *d_argv[] = {emacs, daemon, 0 };
1483 if (socket_name != NULL) 1486 if (socket_name != NULL)
1484 { 1487 {
1485 /* Pass --daemon=socket_name as argument. */ 1488 /* Pass --daemon=socket_name as argument. */
1486 char *deq = "--daemon="; 1489 const char *deq = "--daemon=";
1487 char *daemon_arg = alloca (strlen (deq) 1490 char *daemon_arg = alloca (strlen (deq)
1488 + strlen (socket_name) + 1); 1491 + strlen (socket_name) + 1);
1489 strcpy (daemon_arg, deq); 1492 strcpy (daemon_arg, deq);