changeset 83590:dab011361c2a

(s): Remove. (main): Define here instead. (main) [WINDOWSNT]: Don't call ttyname. Don't recognize -suspend option. (main) [NO_SOCKETS_IN_FILE_SYSTEM]: Don't call init_signals. (strprefix): Define unconditionally.
author Jason Rumney <jasonr@gnu.org>
date Tue, 15 May 2007 23:30:30 +0000
parents fb93eb23056b
children d885ce1c4699
files lib-src/emacsclient.c
diffstat 1 files changed, 29 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/emacsclient.c	Tue May 15 23:30:12 2007 +0000
+++ b/lib-src/emacsclient.c	Tue May 15 23:30:30 2007 +0000
@@ -172,7 +172,7 @@
 int emacs_pid = 0;
 
 /* Socket used to communicate with the Emacs server process.  */
-HSOCKET s;
+/*HSOCKET s;*/
 
 void print_help_and_exit () NO_RETURN;
 
@@ -889,6 +889,25 @@
   return s;
 }
 
+
+/* Returns 1 if PREFIX is a prefix of STRING. */
+static int
+strprefix (char *prefix, char *string)
+{
+  int i;
+  if (! prefix)
+    return 1;
+
+  if (!string)
+    return 0;
+
+  for (i = 0; prefix[i]; i++)
+    if (!string[i] || string[i] != prefix[i])
+      return 0;
+  return 1;
+}
+
+
 #if !defined (NO_SOCKETS_IN_FILE_SYSTEM)
 
 /* Three possibilities:
@@ -976,7 +995,6 @@
 
   errno = old_errno;
 }
-
 /* Set up signal handlers before opening a frame on the current tty.  */
 
 void
@@ -999,25 +1017,6 @@
 }
 
 
-
-/* Returns 1 if PREFIX is a prefix of STRING. */
-static int
-strprefix (char *prefix, char *string)
-{
-  int i;
-  if (! prefix)
-    return 1;
-
-  if (!string)
-    return 0;
-
-  for (i = 0; prefix[i]; i++)
-    if (!string[i] || string[i] != prefix[i])
-      return 0;
-  return 1;
-}
-
-
 HSOCKET
 set_local_socket ()
 {
@@ -1266,6 +1265,7 @@
      int argc;
      char **argv;
 {
+  HSOCKET s;
   int i, rl, needlf = 0;
   char *cwd, *str;
   char string[BUFSIZ+1];
@@ -1347,7 +1347,10 @@
 
   if (tty)
     {
-      char *tty_name = ttyname (fileno (stdin));
+      char *tty_name = NULL;
+#ifndef WINDOWSNT
+      tty_name = ttyname (fileno (stdin));
+#endif
       char *type = getenv ("TERM");
 
       if (! tty_name)
@@ -1370,8 +1373,9 @@
                    " is not supported\n", progname);
           fail ();
         }
-
+#if !defined (NO_SOCKETS_IN_FILE_SYSTEM)
       init_signals ();
+#endif
 
       SEND_STRING ("-tty ");
       SEND_QUOTED (tty_name);
@@ -1498,6 +1502,7 @@
           fprintf (stderr, "*ERROR*: %s", str);
           needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
         }
+#ifndef WINDOWSNT
       else if (strprefix ("-suspend ", string))
         {
           /* -suspend: Suspend this terminal, i.e., stop the process. */
@@ -1506,6 +1511,7 @@
           needlf = 0;
           kill (0, SIGSTOP);
         }
+#endif
       else
         {
           /* Unknown command. */