--- posix-common.scm 2014-06-07 07:18:27.000000000 -0600 +++ posix-common.scm.new 2015-01-28 16:49:53.495829392 -0700 @@ -24,7 +24,7 @@ ; POSSIBILITY OF SUCH DAMAGE. -(declare +(declare (hide ##sys#stat posix-error check-time-vector ##sys#find-files) (foreign-declare #< +#endif + EOF )) @@ -180,6 +184,9 @@ (define ##sys#posix-error posix-error) +(define (errno->string errnum) + ((foreign-lambda c-string "strerror" int) errnum)) + ;;; File properties @@ -229,7 +236,7 @@ #:type-error loc "bad argument type - not a fixnum or string" file)) ) ) ) (if (fx< r 0) (if err - (posix-error #:file-error loc "cannot access file" file) + (posix-error #:file-error loc "cannot access file" file) #f) #t))) @@ -242,7 +249,7 @@ _stat_st_blksize _stat_st_blocks) ) (define file-modification-time - (getter-with-setter + (getter-with-setter (lambda (f) (##sys#stat f #f #t 'file-modification-time) _stat_st_mtime) (lambda (f t) @@ -250,7 +257,7 @@ (let ((r ((foreign-lambda int "set_file_mtime" c-string scheme-object) (##sys#expand-home-path f) t))) (when (fx< r 0) - (posix-error + (posix-error #:file-error 'set-file-modification-time "cannot set file modification-time" f t)))) "(file-modification-time f)")) @@ -385,7 +392,7 @@ (let ((name (##sys#expand-home-path name))) (if recursive (let ((files (find-files ; relies on `find-files' to list dir-contents before dir - name + name dotfiles: #t follow-symlinks: #f))) (for-each @@ -404,7 +411,7 @@ (let ([buffer (make-string 256)] [handle (##sys#make-pointer)] [entry (##sys#make-pointer)] ) - (##core#inline + (##core#inline "C_opendir" (##sys#make-c-string (##sys#expand-home-path spec) 'directory) handle) (if (##sys#null-pointer? handle) @@ -441,7 +448,7 @@ (cond ((null? fns) (conc-loop (cdr paths))) ((irregex-match rx (car fns)) => (lambda (m) - (cons + (cons (make-pathname dir (irregex-match-substring m)) (loop (cdr fns)))) ) (else (loop (cdr fns))) ) ) ) ) ) ) ) ) )