aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsclient.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 2231934b185..b155035f760 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. */
175HSOCKET s; 175/*HSOCKET s;*/
176 176
177void print_help_and_exit () NO_RETURN; 177void print_help_and_exit () NO_RETURN;
178 178
@@ -889,6 +889,25 @@ set_tcp_socket ()
889 return s; 889 return s;
890} 890}
891 891
892
893/* Returns 1 if PREFIX is a prefix of STRING. */
894static int
895strprefix (char *prefix, char *string)
896{
897 int i;
898 if (! prefix)
899 return 1;
900
901 if (!string)
902 return 0;
903
904 for (i = 0; prefix[i]; i++)
905 if (!string[i] || string[i] != prefix[i])
906 return 0;
907 return 1;
908}
909
910
892#if !defined (NO_SOCKETS_IN_FILE_SYSTEM) 911#if !defined (NO_SOCKETS_IN_FILE_SYSTEM)
893 912
894/* Three possibilities: 913/* Three possibilities:
@@ -976,7 +995,6 @@ handle_sigtstp (int signalnum)
976 995
977 errno = old_errno; 996 errno = old_errno;
978} 997}
979
980/* Set up signal handlers before opening a frame on the current tty. */ 998/* Set up signal handlers before opening a frame on the current tty. */
981 999
982void 1000void
@@ -999,25 +1017,6 @@ init_signals (void)
999} 1017}
1000 1018
1001 1019
1002
1003/* Returns 1 if PREFIX is a prefix of STRING. */
1004static int
1005strprefix (char *prefix, char *string)
1006{
1007 int i;
1008 if (! prefix)
1009 return 1;
1010
1011 if (!string)
1012 return 0;
1013
1014 for (i = 0; prefix[i]; i++)
1015 if (!string[i] || string[i] != prefix[i])
1016 return 0;
1017 return 1;
1018}
1019
1020
1021HSOCKET 1020HSOCKET
1022set_local_socket () 1021set_local_socket ()
1023{ 1022{
@@ -1266,6 +1265,7 @@ main (argc, argv)
1266 int argc; 1265 int argc;
1267 char **argv; 1266 char **argv;
1268{ 1267{
1268 HSOCKET s;
1269 int i, rl, needlf = 0; 1269 int i, rl, needlf = 0;
1270 char *cwd, *str; 1270 char *cwd, *str;
1271 char string[BUFSIZ+1]; 1271 char string[BUFSIZ+1];
@@ -1347,7 +1347,10 @@ main (argc, argv)
1347 1347
1348 if (tty) 1348 if (tty)
1349 { 1349 {
1350 char *tty_name = ttyname (fileno (stdin)); 1350 char *tty_name = NULL;
1351#ifndef WINDOWSNT
1352 tty_name = ttyname (fileno (stdin));
1353#endif
1351 char *type = getenv ("TERM"); 1354 char *type = getenv ("TERM");
1352 1355
1353 if (! tty_name) 1356 if (! tty_name)
@@ -1370,8 +1373,9 @@ main (argc, argv)
1370 " is not supported\n", progname); 1373 " is not supported\n", progname);
1371 fail (); 1374 fail ();
1372 } 1375 }
1373 1376#if !defined (NO_SOCKETS_IN_FILE_SYSTEM)
1374 init_signals (); 1377 init_signals ();
1378#endif
1375 1379
1376 SEND_STRING ("-tty "); 1380 SEND_STRING ("-tty ");
1377 SEND_QUOTED (tty_name); 1381 SEND_QUOTED (tty_name);
@@ -1498,6 +1502,7 @@ main (argc, argv)
1498 fprintf (stderr, "*ERROR*: %s", str); 1502 fprintf (stderr, "*ERROR*: %s", str);
1499 needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; 1503 needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
1500 } 1504 }
1505#ifndef WINDOWSNT
1501 else if (strprefix ("-suspend ", string)) 1506 else if (strprefix ("-suspend ", string))
1502 { 1507 {
1503 /* -suspend: Suspend this terminal, i.e., stop the process. */ 1508 /* -suspend: Suspend this terminal, i.e., stop the process. */
@@ -1506,6 +1511,7 @@ main (argc, argv)
1506 needlf = 0; 1511 needlf = 0;
1507 kill (0, SIGSTOP); 1512 kill (0, SIGSTOP);
1508 } 1513 }
1514#endif
1509 else 1515 else
1510 { 1516 {
1511 /* Unknown command. */ 1517 /* Unknown command. */