Add most remaining unix primitives, including new `file-touch'.
authorChris Hanson <org/chris-hanson/cph>
Mon, 17 Oct 1988 12:10:07 +0000 (12:10 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 17 Oct 1988 12:10:07 +0000 (12:10 +0000)
v7/src/runtime/unxpth.scm

index 65c2f9637946f482ee124fd44a45d7d013747ac2..3fe0fa473d8fc44b77ae65dab696b85894d502e1 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/unxpth.scm,v 14.1 1988/06/13 11:59:45 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/unxpth.scm,v 14.2 1988/10/17 12:10:07 cph Exp $
 
 Copyright (c) 1988 Massachusetts Institute of Technology
 
@@ -75,4 +75,39 @@ MIT in each case. |#
 
 (define (get-user-home-directory user-name)
   (or ((ucode-primitive get-user-home-directory) user-name)
-      (error "User has no home directory" user-name)))
\ No newline at end of file
+      (error "User has no home directory" user-name)))
+
+(define unix/current-user-name
+  (ucode-primitive current-user-name))
+
+(define unix/current-file-time
+  (ucode-primitive current-user-name))
+
+(define unix/file-time->string
+  (ucode-primitive file-time->string))
+
+(define (unix/uid->string uid)
+  (or ((ucode-primitive uid->string) uid)
+      (number->string uid 10)))
+
+(define (unix/gid->string gid)
+  (or ((ucode-primitive gid->string) gid)
+      (number->string gid 10)))
+
+(define unix/system
+  (ucode-primitive system))
+
+(define (file-touch filename)
+  (let ((filename
+        (pathname->string
+         (let ((pathname (pathname->absolute-pathname (->pathname filename))))
+           (if (let ((version (pathname-version pathname)))
+                 (or (not version)
+                     (integer? version)))
+               pathname
+               (or (pathname->input-truename pathname)
+                   (pathname-new-version pathname false)))))))
+    (let ((result ((ucode-primitive file-touch) filename)))
+      (if result
+         (error "FILE-TOUCH:" result))))
+  unspecific)
\ No newline at end of file