0.9.8.31:
authorChristophe Rhodes <csr21@cam.ac.uk>
Tue, 10 Jan 2006 17:39:28 +0000 (17:39 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Tue, 10 Jan 2006 17:39:28 +0000 (17:39 +0000)
Implement (following James Bielman) unix-access for windows.
... use access() not _access(); no, I have no idea why this
makes sense (in either direction).

src/code/fd-stream.lisp
src/code/unix.lisp
src/runtime/win32-os.c
version.lisp-expr

index 0e43da7..90621d9 100644 (file)
 ;;; Rename NAMESTRING to ORIGINAL. First, check whether we have write
 ;;; access, since we don't want to trash unwritable files even if we
 ;;; technically can. We return true if we succeed in renaming.
-#!-win32
 (defun rename-the-old-one (namestring original)
   (unless (sb!unix:unix-access namestring sb!unix:w_ok)
     (error "~@<The file ~2I~_~S ~I~_is not writable.~:>" namestring))
index 2423d6c..f4d0ef3 100644 (file)
@@ -239,7 +239,16 @@ SYSCALL-FORM. Repeat evaluation of SYSCALL-FORM if it is interrupted."
 ;;;   w_ok     Write permission.
 ;;;   x_ok     Execute permission.
 ;;;   f_ok     Presence of file.
-#!-win32
+
+;;; In Windows, the MODE argument to access is defined in terms of
+;;; literal magic numbers---there are no constants to grovel.  X_OK
+;;; is not defined.
+#!+win32
+(progn
+  (defconstant f_ok 0)
+  (defconstant w_ok 2)
+  (defconstant r_ok 4))
+
 (defun unix-access (path mode)
   (declare (type unix-pathname path)
            (type (mod 8) mode))
index 475132e..c1bf6a2 100644 (file)
@@ -600,6 +600,7 @@ void scratch(void)
     GetProcAddress(0, 0);
     mkdir(0);
     isatty(0);
+    access(0,0)
 }
 
 /* EOF */
index 5e71226..5dd763c 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.8.30"
+"0.9.8.31"