changeset 100314:9c9346f62ad8

* emacsclient.c [!WINDOWSNT] (EMACS_DAEMON): New define. Changes when EMACS_DAEMON is not defined: (print_help_and_exit): Don't add daemon information to help. (start_daemon_and_retry_set_socket): Make a no-op. (main): Don't set `start_daemon_if_needed' (which is initialized to 0).
author Juanma Barranquero <lekktu@gmail.com>
date Wed, 10 Dec 2008 09:47:06 +0000
parents 1912976b0dec
children da90832da238
files lib-src/ChangeLog lib-src/emacsclient.c
diffstat 2 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Wed Dec 10 08:30:54 2008 +0000
+++ b/lib-src/ChangeLog	Wed Dec 10 09:47:06 2008 +0000
@@ -1,3 +1,11 @@
+2008-12-10  Juanma Barranquero  <lekktu@gmail.com>
+
+	* emacsclient.c [!WINDOWSNT] (EMACS_DAEMON): New define.
+	Changes when EMACS_DAEMON is not defined:
+	(print_help_and_exit): Don't add daemon information to help.
+	(start_daemon_and_retry_set_socket): Make a no-op.
+	(main): Don't set `start_daemon_if_needed' (which is initialized to 0).
+
 2008-12-10  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* emacsclient.c (print_help_and_exit): Describe what an empty
--- a/lib-src/emacsclient.c	Wed Dec 10 08:30:54 2008 +0000
+++ b/lib-src/emacsclient.c	Wed Dec 10 09:47:06 2008 +0000
@@ -54,6 +54,8 @@
 # define CLOSE_SOCKET close
 # define INITIALIZE()
 
+# define EMACS_DAEMON
+
 #endif /* !WINDOWSNT */
 
 #undef signal
@@ -615,10 +617,12 @@
 "-f, --server-file=FILENAME\n\
 			Set filename of the TCP authentication file\n\
 -a, --alternate-editor=EDITOR\n\
-			Editor to fallback to if the server is not running\n\
-                        If EDITOR is the empty string, start Emacs in daemon\n\
-                        mode and try connecting again
-\n\
+			Editor to fallback to if the server is not running\n"
+#ifdef EMACS_DAEMON
+"			If EDITOR is the empty string, start Emacs in daemon\n\
+			mode and try connecting again\n"
+#endif
+"\n\
 Report bugs to bug-gnu-emacs@gnu.org.\n", progname);
   exit (EXIT_SUCCESS);
 }
@@ -1410,12 +1414,12 @@
 }
 #endif
 
-
 /* Start the emacs daemon and try to connect to it.  */
 
 void
 start_daemon_and_retry_set_socket (void)
 {
+#ifdef EMACS_DAEMON
   pid_t dpid;
   int status;
   pid_t p;
@@ -1453,9 +1457,9 @@
       execvp ("emacs", d_argv);
       message (TRUE, "%s: error starting emacs daemon\n", progname);
     }
+#endif /* EMACS_DAEMON */
 }
 
-
 int
 main (argc, argv)
      int argc;
@@ -1464,7 +1468,7 @@
   int i, rl, needlf = 0;
   char *cwd, *str;
   char string[BUFSIZ+1];
-  int null_socket_name, null_server_file, start_daemon_if_needed;
+  int null_socket_name, null_server_file, start_daemon_if_needed = 0;
 
   main_argv = argv;
   progname = argv[0];
@@ -1480,10 +1484,12 @@
       exit (EXIT_FAILURE);
     }
 
+#ifdef EMACS_DAEMON
   /* If alternate_editor is the empty string, start the emacs daemon
      in case of failure to connect.  */
   start_daemon_if_needed = (alternate_editor
 			    && (alternate_editor[0] == '\0'));
+#endif /* EMACS_DAEMON */
   if (start_daemon_if_needed)
     {
       /* set_socket changes the values for socket_name and