changeset 39811:9f7e72fba3d2

(Vexec_suffixes): New var. (Fcall_process): Update call to openp. (decode_suffixes): New function. (syms_of_callproc): Init exec-suffixes.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 12 Oct 2001 03:23:25 +0000
parents 4b565579e4f5
children 66e0816837a8
files src/callproc.c
diffstat 1 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/callproc.c	Fri Oct 12 03:22:15 2001 +0000
+++ b/src/callproc.c	Fri Oct 12 03:23:25 2001 +0000
@@ -103,9 +103,8 @@
 #endif
 #endif
 
-#define max(a, b) ((a) > (b) ? (a) : (b))
-
-Lisp_Object Vexec_path, Vexec_directory, Vdata_directory, Vdoc_directory;
+Lisp_Object Vexec_path, Vexec_directory, Vexec_suffixes;
+Lisp_Object Vdata_directory, Vdoc_directory;
 Lisp_Object Vconfigure_info_directory;
 Lisp_Object Vtemp_file_name_pattern;
 
@@ -380,7 +379,7 @@
     struct gcpro gcpro1;
 
     GCPRO1 (current_dir);
-    openp (Vexec_path, args[0], EXEC_SUFFIXES, &path, 1);
+    openp (Vexec_path, args[0], Vexec_suffixes, &path, 1);
     UNGCPRO;
   }
   if (NILP (path))
@@ -1571,6 +1570,28 @@
 				    Vprocess_environment);
 }
 
+static Lisp_Object
+decode_suffixes (string)
+     char *string;
+{
+  char *p;
+  Lisp_Object suffixes;
+
+  suffixes = Qnil;
+  while (1)
+    {
+      p = index (string, ':');
+      if (!p) p = string + strlen (string);
+      suffixes = Fcons (make_string (string, p - string),
+                        suffixes);
+      if (*p)
+	string = p + 1;
+      else
+	break;
+    }
+  return Fnreverse (suffixes);
+}
+
 void
 syms_of_callproc ()
 {
@@ -1587,6 +1608,11 @@
     "*List of directories to search programs to run in subprocesses.\n\
 Each element is a string (directory name) or nil (try default directory).");
 
+  DEFVAR_LISP ("exec-suffixes", &Vexec_suffixes,
+    "*List of suffixes to try to find executable file names.\n\
+Each element is a string");
+  Vexec_suffixes = decode_suffixes (EXEC_SUFFIXES);
+
   DEFVAR_LISP ("exec-directory", &Vexec_directory,
     "Directory for executables for Emacs to invoke.\n\
 More generally, this includes any architecture-dependent files\n\