Subject: [clisp-list] Using filenames which contain wildcard characters

From: Mark Triggs <[email-masked]>
Date: Mon Apr 7 02:26:04 2003

Hi everyone,

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?"

Is there some way to escape the '?' character that I'm missing? I've
been through the impnotes, and mined the archives of this list and c.l.l
but haven't had much luck turning up answers.

Relevant details:

  GNU CLISP 2.30 (released 2002-09-15) (built 3248584626) (memory
  3258512962) running Debian unstable.

  Features:
  (ASDF MK-DEFSYSTEM COMMON-LISP-CONTROLLER CLX-ANSI-COMMON-LISP CLX
  CLOS LOOP COMPILER CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER
  SOCKETS GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN FFI UNICODE
  BASE-CHAR=CHARACTER SYSCALLS PC386 UNIX)

Thanks for reading, any help is greatly appreciated.

Mark

-- 
Mark Triggs
<[email-masked]>

---

From: Sam Steingold <[email-masked]>
Date: Sat Apr 19 07:14:07 2003

> * In message <[email-masked]>
> * 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 <[email-masked]> writes:
>

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.

---

From: Sam Steingold <[email-masked]>
Date: Sat Apr 19 07:14:07 2003

---

From: Mark Triggs <[email-masked]>
Date: Sun Apr 20 02:37:02 2003

Pascal Bourguignon <[email-masked]> writes:

> Sam Steingold writes:

[...]

>> Maybe it would be better to avoid such pathnames?

Absolutely, but unfortunately I'm at the mercy of whatever bogus names
people have decided to give their files :o)

> Or to use  a unix API (linux package in clisp).  See the current POSIX
> thread on comp.lang.lisp...

Thanks for the suggestions. Given that the hyperspec makes it clear that
an error should be signalled (sorry to have missed that), the behaviour
is understandable. The linux package should do the trick for my purposes
anyway.

Thanks again,

Mark

-- 
Mark Triggs
<[email-masked]>

---

From: Marco Antoniotti <[email-masked]>
Date: Mon Apr 21 06:44:31 2003

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:

> <http://www.mideasttruth.com/>  
> <http://www.palestine-central.com/links.html>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> clisp-list mailing list
> [email-masked]
> 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.