From 3c76182d73708ac1e39d978990d031a2d043d4b4 Mon Sep 17 00:00:00 2001
From: wlott <wlott>
Date: Fri, 4 Feb 1994 15:05:08 +0000
Subject: [PATCH] Added an executable-only optional to unix-namestring so that
 we can expand path:foo into the first executable in the path named foo, not
 just the first file.

---
 code/filesys.lisp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/code/filesys.lisp b/code/filesys.lisp
index 2aefb6ee2..b70465e3a 100644
--- a/code/filesys.lisp
+++ b/code/filesys.lisp
@@ -6,7 +6,7 @@
 ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/filesys.lisp,v 1.38 1993/08/11 16:33:17 ram Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/filesys.lisp,v 1.39 1994/02/04 15:05:08 wlott Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -629,14 +629,17 @@
 
 ;;;; UNIX-NAMESTRING -- public
 ;;; 
-(defun unix-namestring (pathname &optional (for-input t))
+(defun unix-namestring (pathname &optional (for-input t) executable-only)
   "Convert PATHNAME into a string that can be used with UNIX system calls.
    Search-lists and wild-cards are expanded."
   (enumerate-search-list
       (pathname pathname)
     (collect ((names))
       (enumerate-matches (name pathname nil :verify-existance for-input)
-	(names name))
+	(when (or (not executable-only)
+		  (and (eq (unix:unix-file-kind name) :file)
+		       (unix:unix-access name unix:x_ok)))
+	  (names name)))
       (let ((names (names)))
 	(when names
 	  (when (cdr names)
-- 
GitLab