From b81a1b72a82185bc426d31f914a5d3d7fee14c4e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 12 Oct 2001 03:23:25 +0000 Subject: [PATCH] (Vexec_suffixes): New var. (Fcall_process): Update call to openp. (decode_suffixes): New function. (syms_of_callproc): Init exec-suffixes. --- src/callproc.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/callproc.c b/src/callproc.c index fc4d0bf3379..37b52ac5a2a 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -103,9 +103,8 @@ extern char **environ; #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 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") 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 @@ set_process_environment () 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 @@ Initialized from the SHELL environment variable."); "*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\ -- 2.39.2