stk/Lib/posix.stk

57 lines
1.6 KiB
Plaintext
Raw Normal View History

1996-09-27 06:29:02 -04:00
;;;;
;;;; p o s i x . s t k -- Posix function in Scheme
;;;;
;;;;
1999-09-05 07:16:41 -04:00
;;;; Copyright <20> 1993-1999 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
1996-09-27 06:29:02 -04:00
;;;;
1999-09-05 07:16:41 -04:00
;;;; Permission to use, copy, modify, distribute,and license this
;;;; software and its documentation for any purpose is hereby granted,
;;;; provided that existing copyright notices are retained in all
;;;; copies and that this notice is included verbatim in any
;;;; distributions. No written agreement, license, or royalty fee is
;;;; required for any of the authorized uses.
;;;; This software is provided ``AS IS'' without express or implied
;;;; warranty.
1996-09-27 06:29:02 -04:00
;;;;
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 15-Mar-1995 16:31
1999-09-05 07:16:41 -04:00
;;;; Last file update: 3-Sep-1999 19:53 (eg)
1996-09-27 06:29:02 -04:00
;;;;
(if (symbol-bound? '%init-posix)
;; Posix.1 module is in the core interpreter
(%init-posix)
;; Try to load Posix.1 support dynamically
(load (string-append "posix." *shared-suffix*)))
1998-04-10 06:59:06 -04:00
;;;;
;;;; Stat functions
;;;;
(define (posix-stat->list p)
(apply append
(map list
'(:dev :ino :mode :nlink :uid :gid :size :atime :mtime :ctime)
(vector->list (posix-stat->vector p)))))
(define (posix-lstat filename)
(posix-stat->list (posix-stat filename)))
1996-09-27 06:29:02 -04:00
;;;;
;;;; Time functions
;;;;
(define (posix-asctime . time)
(apply posix-strftime "%a %b %d %H:%M:%S %Z %Y\n" time))
(define (posix-ctime . time)
(let ((t (if (null? time) (list (posix-time)) time)))
(posix-asctime (apply posix-localtime t))))
;;;;
;;;; Backward compatibility
;;;;
(define posix-access posix-access?)
(provide "posix")