(server-process-filter): Don't force the authentication
[bpt/emacs.git] / lib-src / emacsclient.c
index 99e0dc3..568b6c1 100644 (file)
@@ -1,6 +1,6 @@
 /* Client process that communicates with GNU Emacs acting as server.
    Copyright (C) 1986, 1987, 1994, 1999, 2000, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007 Free Software Foundation, Inc.
+                 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -170,7 +170,9 @@ struct option longopts[] =
   { "socket-name",     required_argument, NULL, 's' },
 #endif
   { "server-file",     required_argument, NULL, 'f' },
+#ifndef WINDOWSNT
   { "display", required_argument, NULL, 'd' },
+#endif
   { 0, 0, 0, 0 }
 };
 
@@ -298,8 +300,6 @@ get_current_dir_name ()
 }
 #endif
 
-/* Message functions. */
-
 #ifdef WINDOWSNT
 
 #define REG_ROOT "SOFTWARE\\GNU\\Emacs"
@@ -440,6 +440,8 @@ w32_execvp (path, argv)
 
 #endif /* WINDOWSNT */
 
+/* Display a normal or error message.
+   On Windows, use a message box if compiled as a Windows app.  */
 void
 message (int is_error, char *message, ...)
 {
@@ -477,9 +479,11 @@ decode_options (argc, argv)
      char **argv;
 {
   alternate_editor = egetenv ("ALTERNATE_EDITOR");
+#ifndef WINDOWSNT
   display = egetenv ("DISPLAY");
   if (display && strlen (display) == 0)
     display = NULL;
+#endif
 
   while (1)
     {
@@ -515,9 +519,11 @@ decode_options (argc, argv)
          server_file = optarg;
          break;
 
+#ifndef WINDOWSNT
        case 'd':
          display = optarg;
          break;
+#endif
 
        case 'n':
          nowait = 1;
@@ -594,8 +600,10 @@ The following OPTIONS are accepted:\n\
 -c, --create-frame     Create a new frame instead of trying to\n\
                        use the current Emacs frame\n\
 -e, --eval             Evaluate the FILE arguments as ELisp expressions\n\
--n, --no-wait          Don't wait for the server to return\n\
--d, --display=DISPLAY  Visit the file in the given display\n"
+-n, --no-wait          Don't wait for the server to return\n"
+#ifndef WINDOWSNT
+"-d, --display=DISPLAY Visit the file in the given display\n"
+#endif
 #ifndef NO_SOCKETS_IN_FILE_SYSTEM
 "-s, --socket-name=FILENAME\n\
                        Set filename of the UNIX socket for communication\n"
@@ -882,7 +890,7 @@ initialize_sockets ()
 
   if (WSAStartup (MAKEWORD (2, 0), &wsaData))
     {
-      message (TRUE, "%s: error initializing WinSock2", progname);
+      message (TRUE, "%s: error initializing WinSock2\n", progname);
       exit (EXIT_FAILURE);
     }
 
@@ -939,7 +947,7 @@ get_server_config (server, authentication)
     }
   else
     {
-      message (TRUE, "%s: invalid configuration info", progname);
+      message (TRUE, "%s: invalid configuration info\n", progname);
       exit (EXIT_FAILURE);
     }
 
@@ -949,7 +957,7 @@ get_server_config (server, authentication)
 
   if (! fread (authentication, AUTH_KEY_LENGTH, 1, config))
     {
-      message (TRUE, "%s: cannot read authentication info", progname);
+      message (TRUE, "%s: cannot read authentication info\n", progname);
       exit (EXIT_FAILURE);
     }
 
@@ -1167,7 +1175,7 @@ set_local_socket ()
       strcpy (server.sun_path, socket_name);
     else
       {
-        message (TRUE, "%s: socket-name %s too long",
+        message (TRUE, "%s: socket-name %s too long\n",
                  progname, socket_name);
         fail ();
       }
@@ -1202,7 +1210,7 @@ set_local_socket ()
                  strcpy (server.sun_path, socket_name);
                else
                  {
-                   message (TRUE, "%s: socket-name %s too long",
+                   message (TRUE, "%s: socket-name %s too long\n",
                             progname, socket_name);
                    exit (EXIT_FAILURE);
                  }
@@ -1266,7 +1274,7 @@ set_socket ()
       s = set_local_socket ();
       if ((s != INVALID_SOCKET) || alternate_editor)
        return s;
-      message (TRUE, "%s: error accessing socket \"%s\"",
+      message (TRUE, "%s: error accessing socket \"%s\"\n",
               progname, socket_name);
       exit (EXIT_FAILURE);
     }
@@ -1282,7 +1290,7 @@ set_socket ()
       if ((s != INVALID_SOCKET) || alternate_editor)
        return s;
 
-      message (TRUE, "%s: error accessing server file \"%s\"",
+      message (TRUE, "%s: error accessing server file \"%s\"\n",
               progname, server_file);
       exit (EXIT_FAILURE);
     }