logo       

Re: Using filenames which contain wildcard characters: msg#00113

lisp.clisp.general

Subject: Re: Using filenames which contain wildcard characters


According to the CLHS (not directly), an implementation should provide an implementation dependent way of quoting the implementation dependent wild characters in the pathname component and/or namestring. Here is the relevant bit.

======================================================================== =========================================

19.2.2.1.1 Special Characters in Pathname Components

Strings in pathname component values never contain special characters that represent separation between pathname fields, such as slash in Unix filenames. Whether separator characters are permitted as part of a string in a pathname component is implementation-defined; however, if the implementation does permit it, it must arrange to properly ``quote'' the character for the file system when constructing a namestring. For example,

;; In a TOPS-20 implementation, which uses ^V to quote
(NAMESTRING (MAKE-PATHNAME :HOST "OZ" :NAME "<TEST>"))
=> #P"OZ:PS:^V<TEST^V>"
NOT=> #P"OZ:PS:<TEST>"


======================================================================== =========================================

It would look like that (by extension), you should be able to do something like

(open "hello^V?" .....)

However, this is going to be completely implementation dependent.

As a personal preference, I wouldn't mix UNIX shell wildcards with CL pathname components. After all the C library does not care about '?' in file names.

Cheers

Marco


On Friday, Apr 18, 2003, at 08:21 America/New_York, Sam Steingold wrote:

* In message <878yumbqwm.fsf@xxxxxxxxxxxxxxx>
* On the subject of "[clisp-list] Using filenames which contain wildcard characters"
* Sent on Mon, 07 Apr 2003 19:25:29 +1000
* Honorable Mark Triggs <mst@xxxxxxxxxxxxxxx> writes:

I've hit a bit of a stumbling block with some code I'm working on. I
have a file called "hello?.txt" (unix filesystem) that I'm trying to
open using (with-open-file ..), but I'm getting the following:

[1]> (with-open-file (test "hello?" :direction :input))
*** - wildcards are not allowed here: #P"hello?"

CLHS is quite explicit on OPEN:

An error of type file-error is signaled if (wild-pathname-p filespec)
returns true.

It is possible to add an keyword option to OPEN to circumvent it, but
it will not be portable.
Maybe it would be better to avoid such pathnames?

--
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Bus error -- driver executed.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
clisp-list mailing list
clisp-list@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/clisp-list

--
Marco Antoniotti
NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488
715 Broadway 10th FL fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise