Greetings!

Bill Page <[EMAIL PROTECTED]> writes:

> Camm Maguire wrote:
> 
> >OK, I've just tested on Linux under ANSI, and it works the same for
> >me (as it should).  If this is not the case on Windows, please someone
> >let me know asap.
> >
> Perhaps Mike's test demonstrates that this is not working on the
> Windows ANSI version, but it works fine for me on Windows XP
> with the non-ANSI version.
> 

OK, if someone can verify that it is ansi which breaks, please let me
know. 

> >As for bombing when the file is not there, this would appear to be an
> >error in probe-file on Windows.  The 'server' example is supposed to
> >return a blank page and continue in this case.  Please let me know if
> >there is a bug here.
> >
> This works properly now with the most recent Version_2_6_7pre
> from cvs *and* your revised `foo' routine below. Note that with
> the new behaviour of (probe-file "xxx") which returns NIL if xxx
> is a directory, the old version of `foo' no longer worked.
> 

Yes.

> >=============================================================================
> >
> >>(open "/etc" :if-does-not-exist nil)
> >>
> >
> >NIL
> >
> On Windows XP/sp2 with latest Version_2_6_7pre compiled non-ansi
> I get (using /msys/ instead of /etc/ for windows compatibility):
> 
>  >  (open "/msys" :if-does-not-exist nil)
> 
> NIL
> 
> >>(open "/etc/" :if-does-not-exist nil)
> >>
> >
> >NIL
> >
>  > (open "/msys/" :if-does-not-exist nil)
> 
> NIL
> 
> >>(open "/etc/passwd" :if-does-not-exist nil)
> >>
> >
> >#<input stream "/etc/passwd">
> >
>  > (open "/msys/1.0/msys.bat" :if-does-not-exist nil)
> 
> #<input stream "/msys/1.0/msys.bat">
> 
> >>(directory "/etc")
> >>
> >
> >(#p"/etc")
> >
>  > (directory "/msys/1.0")
> 
> (#p"/msys/1.0")
> 
> >>(directory "/etc/")
> >>
> >
> >(#p"/etc/R" #p"/etc/X11" #p"/etc/adduser.conf" #p"/etc/adjtime"
> > ...
> > #p"/etc/xml" #p"/etc/xpdf")
> >
>  > (directory "/msys/1.0/")
> 
> (#p"/msys/1.0/.bash_history" #p"/msys/1.0/bin" #p"/msys/1.0/doc"
>  #p"/msys/1.0/etc" #p"/msys/1.0/home" #p"/msys/1.0/lib"
>  #p"/msys/1.0/m.ico" #p"/msys/1.0/mingw" #p"/msys/1.0/msys.bat"
>  #p"/msys/1.0/msys.ico" #p"/msys/1.0/share" #p"/msys/1.0/uninstall")
> 
> >>(directory "/etc/passwd")
> >>
> >
> >(#p"/etc/passwd" #p"/etc/passwd-")
> >
>  > (directory "/msys/1.0/msys.bat")
> 
> (#p"/msys/1.0/msys.bat")
> 
> Perhaps this last one is a little strange since `msys.bat' is a file?
> 

This is all correct.  #'directory is a wildcard matching function for
the filesystem (perhaps misleadingly named), so should return the
file path if supplied a file namestring.


> >=============================================================================
> >
> >Here is a little modification to the server example:
> >
> > (defun foo (s)  (let* ((get (read s nil 'eof))         (fn (and (eq
> > get 'get) (string-downcase (read s nil 'eof))))
> >      (dn (if (eql (aref fn (1- (length fn))) #\/) fn 
> > (si::string-concatenate fn "/")))
> >      (dir (directory dn))
> >         (file (unless dir (when (probe-file fn) fn))))

This last line should likely read

(file (or (probe-file fn) dir))

just to ensure that probe-file takes precedence.

> >    (format s "HTTP/1.1 ~S~%" (if fn 404 500))
> >    (format s "Content-type: text/html~%~%")
> >    (format t "get ~a fn ~a dn ~a~%" get fn dn)
> >    (cond (file (with-open-file (q file) (si::copy-stream q s)))
> >       (dir  (dolist (l dir)
> >               (let ((n (namestring l)))
> >                 (format s "<a href=\"~a\">~a</a> <a href=\"~a/\"> /... 
> > </a><br>~%" n n n)))))
> >    (close s)))
> >
> >=============================================================================
> >
> >These are just toys of course, just meant to illustrate my limited
> >understanding of how one can distinguish files from directories in
> >*standard* lisp.  We can add anything non-standard we might need, of
> > course.
> I like it. As I said, it works for me with the non-ansi gcl Version_2_6_7pre
> on Windows XP/sp2. No aborts this time.
> 
> And I am learning a little lisp too :) Thanks.

Great!

Take care,

> 
> Cheers,
> Bill Page.
> 
> 
> 
> _______________________________________________
> Axiom-developer mailing list
> Axiom-developer@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/axiom-developer
> 
> 
> 

-- 
Camm Maguire                                            [EMAIL PROTECTED]
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah


_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to