emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/emacs.c,v


From: Dan Nicolaescu
Subject: [Emacs-diffs] Changes to emacs/src/emacs.c,v
Date: Mon, 27 Oct 2008 07:02:38 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   08/10/27 07:02:36

Index: src/emacs.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/emacs.c,v
retrieving revision 1.450
retrieving revision 1.451
diff -u -b -r1.450 -r1.451
--- src/emacs.c 26 Oct 2008 19:05:51 -0000      1.450
+++ src/emacs.c 27 Oct 2008 07:02:36 -0000      1.451
@@ -237,6 +237,8 @@
 
 /* Nonzero means Emacs was started as a daemon.  */
 int is_daemon = 0;
+/* Name for the server started by the daemon.*/
+static char *daemon_name;
 
 /* Pipe used to send exit notification to the daemon parent at
    startup.  */
@@ -796,6 +798,7 @@
 #endif
   int no_loadup = 0;
   char *junk = 0;
+  char *dname_arg = 0;
 
 #if GC_MARK_STACK
   extern Lisp_Object *stack_base;
@@ -1074,7 +1077,8 @@
       exit (0);
     }
 
-  if (argmatch (argv, argc, "-daemon", "--daemon", 5, NULL, &skip_args))
+  if (argmatch (argv, argc, "-daemon", "--daemon", 5, NULL, &skip_args)
+      || argmatch (argv, argc, "-daemon", "--daemon", 5, &dname_arg, 
&skip_args))
     {
 #ifndef DOS_NT
       pid_t f;
@@ -1123,6 +1127,8 @@
          exit (1);
        }
 
+      if (dname_arg)
+               daemon_name = xstrdup (dname_arg);
       /* Close unused reading end of the pipe.  */
       close (daemon_pipe[0]);
       is_daemon = 1;
@@ -2419,10 +2425,17 @@
 }
 
 DEFUN ("daemonp", Fdaemonp, Sdaemonp, 0, 0, 0,
-       doc: /* Return t if the current emacs process is a daemon.  */)
+       doc: /* Return non-nil if the current emacs process is a daemon.
+If the daemon was given a name argument, return that name. */)
   ()
 {
-  return is_daemon ? Qt : Qnil;
+  if (is_daemon)
+    if (daemon_name)
+      return build_string (daemon_name);
+    else
+      return Qt;
+  else
+    return Qnil;
 }
 
 DEFUN ("daemon-initialized", Fdaemon_initialized, Sdaemon_initialized, 0, 0, 0,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]