]> code.delx.au - gnu-emacs/blobdiff - src/callproc.c
[!SYSTEM_MALLOC] (MEMMOVE_MISSING): Defined.
[gnu-emacs] / src / callproc.c
index 2750f9a3f5ebeb06cee9d5bad69097217073a792..8d43ffe67f3dd1d07e893155b0111c5555472dcb 100644 (file)
@@ -21,7 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <signal.h>
 #include <errno.h>
 
-#include "config.h"
+#include <config.h>
 
 extern int errno;
 #ifndef VMS
@@ -35,7 +35,7 @@ extern char *sys_errlist[];
 #endif /* SIGCLD */
 
 #include <sys/types.h>
-#define PRIO_PROCESS 0
+
 #include <sys/file.h>
 #ifdef USG5
 #include <fcntl.h>
@@ -52,7 +52,7 @@ extern char *sys_errlist[];
 #include "lisp.h"
 #include "commands.h"
 #include "buffer.h"
-#include "paths.h"
+#include <paths.h>
 #include "process.h"
 #include "syssignal.h"
 
@@ -65,6 +65,7 @@ extern char **environ;
 #define max(a, b) ((a) > (b) ? (a) : (b))
 
 Lisp_Object Vexec_path, Vexec_directory, Vdata_directory;
+Lisp_Object Vconfigure_info_directory;
 
 Lisp_Object Vshell_file_name;
 
@@ -80,6 +81,8 @@ char *synch_process_death;
 /* If synch_process_death is zero,
    this is exit code of synchronous subprocess.  */
 int synch_process_retcode;
+
+extern Lisp_Object Vdoc_file_name;
 \f
 #ifndef VMS  /* VMS version is in vmsproc.c.  */
 
@@ -248,6 +251,12 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
     /* Record that we're about to create a synchronous process.  */
     synch_process_alive = 1;
 
+    /* These vars record information from process termination.
+       Clear them now before process can possibly terminate,
+       to avoid timing error if process terminates soon.  */
+    synch_process_death = 0;
+    synch_process_retcode = 0;
+
     pid = vfork ();
 
     if (pid == 0)
@@ -292,9 +301,6 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
       return Qnil;
     }
 
-  synch_process_death = 0;
-  synch_process_retcode = 0;
-
   record_unwind_protect (call_process_cleanup,
                         Fcons (make_number (fd[0]), make_number (pid)));
 
@@ -519,7 +525,9 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
   close (err);
 
 #ifdef USG
+#ifndef SETPGRP_RELEASES_CTTY
   setpgrp ();                  /* No arguments but equivalent in this case */
+#endif
 #else
   setpgrp (pid, pid);
 #endif /* USG */
@@ -630,24 +638,59 @@ egetenv (var)
 
 #endif /* not VMS */
 \f
-init_callproc ()
-{
-  register char * sh;
-  Lisp_Object tempdir;
+/* This is run before init_cmdargs.  */
 
-  {
-    char *data_dir = egetenv ("EMACSDATA");
+init_callproc_1 ()
+{
+  char *data_dir = egetenv ("EMACSDATA");
     
-    Vdata_directory =
-      Ffile_name_as_directory
-       (build_string (data_dir ? data_dir : PATH_DATA));
-  }
+  Vdata_directory
+    = Ffile_name_as_directory (build_string (data_dir ? data_dir
+                                            : PATH_DATA));
 
   /* Check the EMACSPATH environment variable, defaulting to the
      PATH_EXEC path from paths.h.  */
   Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC);
   Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path));
   Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);
+}
+
+/* This is run after init_cmdargs, so that Vinvocation_directory is valid.  */
+
+init_callproc ()
+{
+  char *data_dir = egetenv ("EMACSDATA");
+    
+  register char * sh;
+  Lisp_Object tempdir;
+
+  if (initialized && !NILP (Vinvocation_directory))
+    {
+      /* Add to the path the ../lib-src dir of the Emacs executable,
+        if that dir exists.  */
+      Lisp_Object tem, tem1;
+      tem = Fexpand_file_name (build_string ("../lib-src"),
+                              Vinvocation_directory);
+      tem1 = Ffile_exists_p (tem);
+      if (!NILP (tem1) && NILP (Fmember (tem, Vexec_path)))
+       {
+         Vexec_path = nconc2 (Vexec_path, Fcons (tem, Qnil));
+         Vexec_directory = Ffile_name_as_directory (tem);
+
+         /* If we use ../lib-src, maybe use ../etc as well.
+            Do so if ../etc exists and has our DOC-... file in it.  */
+         if (data_dir == 0)
+           {
+             Lisp_Object tem, tem2, tem3;
+             tem = Fexpand_file_name (build_string ("../etc"),
+                                      Vinvocation_directory);
+             tem2 = Fexpand_file_name (Vdoc_file_name, tem);
+             tem3 = Ffile_exists_p (tem2);
+             if (!NILP (tem3))
+               Vdata_directory = Ffile_name_as_directory (tem);
+           }
+       }
+    }
 
   tempdir = Fdirectory_file_name (Vexec_directory);
   if (access (XSTRING (tempdir)->data, 0) < 0)
@@ -704,6 +747,13 @@ especially executable programs intended for Emacs to invoke.");
     "Directory of architecture-independent files that come with GNU Emacs,\n\
 intended for Emacs to use.");
 
+  DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory,
+    "For internal use by the build procedure only.\n\
+This is the name of the directory in which the build procedure installed\n\
+Emacs's info files; the default value for Info-default-directory-list\n\
+includes this.");
+  Vconfigure_info_directory = build_string (PATH_INFO);
+
   DEFVAR_LISP ("process-environment", &Vprocess_environment,
     "List of environment variables for subprocesses to inherit.\n\
 Each element should be a string of the form ENVVARNAME=VALUE.\n\