diff src/callproc.c @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 56c54cf7c5b6
children 1ce6082ce73f
line wrap: on
line diff
--- a/src/callproc.c	Mon Aug 13 09:00:04 2007 +0200
+++ b/src/callproc.c	Mon Aug 13 09:02:59 2007 +0200
@@ -31,6 +31,9 @@
 #include "process.h"
 #include "sysdep.h"
 #include "window.h"
+#ifdef MULE
+#include "mule-coding.h"
+#endif
 
 #include "sysfile.h"
 #include "systime.h"
@@ -49,7 +52,7 @@
 #endif /* DOS_NT */
 
 Lisp_Object Vexec_path, Vexec_directory, Vdata_directory, Vdoc_directory;
-Lisp_Object Vconfigure_info_directory, Vsite_directory;
+Lisp_Object Vconfigure_info_directory;
 
 /* The default base directory XEmacs is installed under. */
 Lisp_Object Vprefix_directory;
@@ -184,7 +187,6 @@
   char *bufptr = buf;
   int bufsize = 16384;
   int speccount = specpdl_depth ();
-  struct gcpro gcpro1;
   char **new_argv
     = (char **) alloca ((max (2, nargs - 2)) * sizeof (char *));
   
@@ -200,7 +202,7 @@
 
   error_file = Qt;
 
-#if defined (NO_SUBPROCESSES)
+#ifdef NO_SUBPROCESSES
   /* Without asynchronous processes we cannot have BUFFER == 0.  */
   if (nargs >= 3 && !INTP (args[2]))
     error ("Operating system cannot handle asynchronous subprocesses");
@@ -224,8 +226,8 @@
 
     GCPRO2 (current_dir, path);   /* Caller gcprotects args[] */
     current_dir = current_buffer->directory;
-    current_dir = Funhandled_file_name_directory (current_dir);
-    current_dir = expand_and_dir_to_file (current_dir, Qnil);
+    current_dir = expand_and_dir_to_file
+      (Funhandled_file_name_directory (current_dir), Qnil);
 #if 0
   /* I don't know how RMS intends this crock of shit to work, but it
      breaks everything in the presence of ange-ftp-visited files, so
@@ -239,17 +241,12 @@
 
   if (nargs >= 2 && ! NILP (args[1]))
     {
-      struct gcpro gcpro1;
-      GCPRO1 (current_buffer->directory);
       infile = Fexpand_file_name (args[1], current_buffer->directory);
-      UNGCPRO;
       CHECK_STRING (infile);
     }
   else
     infile = build_string (NULL_DEVICE);
 
-  GCPRO1 (infile);		/* Fexpand_file_name might trash it */
-
   if (nargs >= 3)
     {
       buffer = args[2];
@@ -287,8 +284,6 @@
   else 
     buffer = Qnil;
 
-  UNGCPRO;
-
   display = ((nargs >= 4) ? args[3] : Qnil);
 
   /* From here we assume we won't GC (unless an error is signaled). */
@@ -451,7 +446,7 @@
 	close (fd[0]);
 	if (fd1 >= 0)
 	  close (fd1);
-	report_file_error ("Cannot open", Fcons(error_file, Qnil));
+	report_file_error ("Cannot open", error_file);
       }
 
     fork_error = Qnil;
@@ -506,7 +501,7 @@
     {
       if (fd[0] >= 0)
 	close (fd[0]);
-#if defined (NO_SUBPROCESSES)
+#ifdef NO_SUBPROCESSES
       /* If Emacs has been built with asynchronous subprocess support,
 	 we don't need to do this, I think because it will then have
 	 the facilities for handling SIGCHLD.  */
@@ -540,6 +535,13 @@
     if (EQ (buffer, Qt))
       XSETBUFFER (buffer, current_buffer);
     instream = make_filedesc_input_stream (fd[0], 0, -1, LSTR_ALLOW_QUIT);
+#ifdef MULE
+    instream =
+      make_decoding_input_stream
+	(XLSTREAM (instream),
+	 Fget_coding_system (Vprocess_input_coding_system));
+    Lstream_set_character_mode (XLSTREAM (instream));
+#endif /* MULE */
     GCPRO1 (instream);
     while (1)
       {
@@ -657,7 +659,7 @@
     nice (- emacs_priority);
 #endif
 
-#if !defined (NO_SUBPROCESSES)
+#ifndef NO_SUBPROCESSES
   /* Close Emacs's descriptors that this process should not have.  */
   close_process_descs ();
 #endif /* not NO_SUBPROCESSES */
@@ -869,7 +871,7 @@
       
       if (STRINGP (entry)
 	  && XSTRING_LENGTH (entry) > varlen
-	  && XSTRING_BYTE (entry, varlen) == '='
+	  && string_byte (XSTRING (entry), varlen) == '='
 #ifdef WINDOWSNT
 	  /* NT environment variables are case insensitive.  */
 	  && ! memicmp (XSTRING_DATA (entry), var, varlen)
@@ -954,7 +956,6 @@
   if (!initialized)
     {
       Vdata_directory = Qnil;
-      Vsite_directory = Qnil;
       Vdoc_directory  = Qnil;
       Vexec_path      = Qnil;
     }
@@ -962,7 +963,6 @@
 #endif
     {
       char *data_dir = egetenv ("EMACSDATA");
-      char *site_dir = egetenv ("EMACSSITE");
       char *doc_dir  = egetenv ("EMACSDOC");
     
 #ifdef PATH_DATA
@@ -973,10 +973,6 @@
       if (!doc_dir)
 	doc_dir = (char *) PATH_DOC;
 #endif
-#ifdef PATH_SITE
-      if (!site_dir)
-	site_dir = (char *) PATH_SITE;
-#endif
     
       if (data_dir)
 	Vdata_directory = Ffile_name_as_directory
@@ -988,11 +984,6 @@
 	  (build_string (doc_dir));
       else
 	Vdoc_directory = Qnil;
-      if (site_dir)
-	Vsite_directory = Ffile_name_as_directory
-	  (build_string (site_dir));
-      else
-	Vsite_directory = Qnil;
 
       /* Check the EMACSPATH environment variable, defaulting to the
 	 PATH_EXEC path from paths.h.  */
@@ -1051,24 +1042,6 @@
 	}
     }
   
-  if (!NILP (Vsite_directory))
-    {
-      tempdir = Fdirectory_file_name (Vsite_directory);
-      if (access ((char *) XSTRING_DATA (tempdir), 0) < 0)
-	{
-	  /* If the hard-coded path is bogus, fail silently.
-	     This will allow the normal heuristics to make an attempt. */
-#if 0
-	  warn_when_safe
-	    (Qpath, Qwarning,
-	     "Warning: machine-independent site dir (%s) does not exist.\n",
-	     XSTRING_DATA (Vsite_directory));
-#else
-	  Vsite_directory = Qnil;
-#endif
-	}
-    }
-  
 #ifdef PATH_PREFIX
   Vprefix_directory = build_string ((char *) PATH_PREFIX);
 #else
@@ -1157,11 +1130,6 @@
 intended for Emacs to use.
 */ );
 
-  DEFVAR_LISP ("site-directory", &Vsite_directory /*
-Directory of architecture-independent files that do not come with XEmacs,
-intended for Emacs to use.
-*/ );
-
   /* FSF puts the DOC file into data-directory.  They do a bunch of
      contortions to attempt to put everything into the DOC file
      whether the support is there or not. */