Skip to content
Snippets Groups Projects
Commit c1b57fcf authored by phg's avatar phg
Browse files

Modifications to support logical-pathnames. unparse-unix-piece includes

support for wildcards and wildcard-inferiors.  split-at-slashes given
an optional argument to permit parsing of directories based on the ";"
in logical-pathnames.
parent 14edd436
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/filesys.lisp,v 1.27 1992/02/15 12:47:35 wlott Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/filesys.lisp,v 1.28 1992/08/19 18:45:34 phg Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -205,21 +205,23 @@ ...@@ -205,21 +205,23 @@
nil nil
version))))) version)))))
(defun split-at-slashes (namestr start end) (defun split-at-slashes (namestr start end &optional (char #\/))
(declare (type simple-base-string namestr) "Take a string and return a list of cons cells that mark the char
separated subseq. The first value t if absolute directories location."
(declare (type simple-base-string namestr)
(type index start end)) (type index start end))
(let ((absolute (and (/= start end) (let ((absolute (and (/= start end)
(char= (schar namestr start) #\/)))) (char= (schar namestr start) char))))
(when absolute (when absolute
(incf start)) (incf start))
;; Next, split the remainder into slash seperated chunks. ;; Next, split the remainder into ; separated chunks.
(collect ((pieces)) (collect ((pieces))
(loop (loop
(let ((slash (position #\/ namestr :start start :end end))) (let ((char-pos (position char namestr :start start :end end)))
(pieces (cons start (or slash end))) (pieces (cons start (or char-pos end)))
(unless slash (unless char-pos
(return)) (return))
(setf start (1+ slash)))) (setf start (1+ char-pos))))
(values absolute (pieces))))) (values absolute (pieces)))))
(defun maybe-extract-search-list (namestr start end) (defun maybe-extract-search-list (namestr start end)
...@@ -298,6 +300,10 @@ ...@@ -298,6 +300,10 @@
(defun unparse-unix-piece (thing) (defun unparse-unix-piece (thing)
(etypecase thing (etypecase thing
(keyword
(cond ((eq thing ':wild) "*")
((eq thing ':wild-inferiors) "**")
(t (error "Invalid keyword piece: ~S~%" thing))))
(simple-string (simple-string
(let* ((srclen (length thing)) (let* ((srclen (length thing))
(dstlen srclen)) (dstlen srclen))
...@@ -324,6 +330,8 @@ ...@@ -324,6 +330,8 @@
(strings piece)) (strings piece))
(symbol (symbol
(case piece (case piece
(:wild
(strings "*"))
(:multi-char-wild (:multi-char-wild
(strings "*")) (strings "*"))
(:single-char-wild (:single-char-wild
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment