mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* boot-9.scm (stat:dev etc.) accessor functions for stat components.
(file-is-directory?): use stat:type.
This commit is contained in:
parent
ae5253c589
commit
3afb28ce85
2 changed files with 26 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Oct 27 07:47:03 1996 Gary Houston <ghouston@actrix.gen.nz>
|
||||
|
||||
* boot-9.scm (stat:dev etc.) accessor functions for stat components.
|
||||
(file-is-directory?): use stat:type.
|
||||
|
||||
Fri Oct 25 03:34:47 1996 Jim Blandy <jimb@floss.cyclic.com>
|
||||
|
||||
* boot-9.scm (%read-sharp): Don't recognize the `#!' syntax here;
|
||||
|
|
|
@ -569,6 +569,26 @@
|
|||
(define (feature? feature)
|
||||
(and (memq feature *features*) #t))
|
||||
|
||||
;; Using the vector returned by stat directly is probably not a good
|
||||
;; idea (it could just as well be a record). Hence some accessors.
|
||||
(define (stat:dev f) (vector-ref f 0))
|
||||
(define (stat:ino f) (vector-ref f 1))
|
||||
(define (stat:mode f) (vector-ref f 2))
|
||||
(define (stat:nlink f) (vector-ref f 3))
|
||||
(define (stat:uid f) (vector-ref f 4))
|
||||
(define (stat:gid f) (vector-ref f 5))
|
||||
(define (stat:rdev f) (vector-ref f 6))
|
||||
(define (stat:size f) (vector-ref f 7))
|
||||
(define (stat:atime f) (vector-ref f 8))
|
||||
(define (stat:mtime f) (vector-ref f 9))
|
||||
(define (stat:ctime f) (vector-ref f 10))
|
||||
(define (stat:blksize f) (vector-ref f 11))
|
||||
(define (stat:blocks f) (vector-ref f 12))
|
||||
|
||||
;; derived from stat mode.
|
||||
(define (stat:type f) (vector-ref f 13))
|
||||
(define (stat:perms f) (vector-ref f 14))
|
||||
|
||||
(define file-exists?
|
||||
(if (feature? 'posix)
|
||||
(lambda (str)
|
||||
|
@ -582,9 +602,7 @@
|
|||
(define file-is-directory?
|
||||
(if (feature? 'i/o-extensions)
|
||||
(lambda (str)
|
||||
(> (logand S_IFDIR
|
||||
(vector-ref (stat str) 2))
|
||||
0))
|
||||
(eq? (stat:type (stat str)) 'directory))
|
||||
(lambda (str)
|
||||
(display str)
|
||||
(newline)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue