From e9af941954a403a21c277226b717a9f7c8d3a502 Mon Sep 17 00:00:00 2001
From: pw <pw>
Date: Tue, 27 Mar 2001 20:23:45 +0000
Subject: [PATCH] Marco Antoniotti says:

PARSE-NAMESTRING is supposed to accept also a string for the optional
HOST argument.  Right now this is not the case.

The following patch fixes this and seems to do the right thing when
HOST is a defined logical pathname host.

This is better than the current situation (as a matter of fact it is
necessary for some things I am doing), but it is not quite ANSI.
E.g. HOST could also be :UNSPECIFIC, but the current code does not
handle that case.  I did not add code for that, because, contrary to
the LOGICAL HOST case, I believe that the case for :UNSPECIFIC is too
implementation dependent.
---
 code/pathname.lisp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/code/pathname.lisp b/code/pathname.lisp
index 346fd56e5..472cae66d 100644
--- a/code/pathname.lisp
+++ b/code/pathname.lisp
@@ -4,7 +4,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/pathname.lisp,v 1.47 2001/03/23 14:57:48 pw Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/pathname.lisp,v 1.48 2001/03/27 20:23:45 pw Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -804,7 +804,8 @@ a host-structure or string."
 ;;;
 (defun %parse-namestring (namestr host defaults start end junk-allowed)
   (declare (type string namestr)
-	   (type (or host null) host)
+	   (type (or host string null) host)
+	   (type pathname defaults)
 	   (type index start)
 	   (type (or index null) end))
   (if junk-allowed
@@ -813,9 +814,13 @@ a host-structure or string."
 	(namestring-parse-error (condition)
 	  (values nil (namestring-parse-error-offset condition))))
       (let* ((end (or end (length namestr)))
+	     (host (if (and host (stringp host))
+		       (find-logical-host host)
+		       host))
+	     (default-host (pathname-host defaults))
 	     (parse-host (or host
 			     (extract-logical-host-prefix namestr start end)
-			     (pathname-host defaults))))
+			     default-host)))
 	(unless parse-host
 	  (error "When Host arg is not supplied, Defaults arg must ~
 		  have a non-null PATHNAME-HOST."))
@@ -856,7 +861,7 @@ a host-structure or string."
    for a physical pathname, returns the printed representation. Host may be
    a physical host structure or host namestring."
   (declare (type path-designator thing)
-	   (type (or null host) host)
+	   (type (or null string host) host)
 	   (type pathname defaults)
 	   (type index start)
 	   (type (or index null) end))
-- 
GitLab