r9972: new pkg
[kmrcl.git] / io.lisp
diff --git a/io.lisp b/io.lisp
index 61298add617fceb73802eaba82e48457f7dd411b..ba68048739c57e4ff55b4138d8e48e6308af95cc 100644 (file)
--- a/io.lisp
+++ b/io.lisp
 
 
 
-#+openmcl
-(defun open-device-stream (path direction)
-  (let* ((mode (ecase direction
-                (:input #.(read-from-string "#$O_RDONLY"))
-                (:output #.(read-from-string "#$O_WRONLY"))
-                (:io #.(read-from-string "#$O_RDWR"))))
-        (fd (ccl::fd-open (ccl::native-translated-namestring path) mode)))
-    (if (< fd 0)
-       (ccl::signal-file-error fd path)
-       (ccl::make-fd-stream fd :direction direction))))
-
 
 (defun null-output-stream ()
-  #-openmcl
-  (when (probe-file #p"/dev/null")
-    (open #p"/dev/null" :direction :output :if-exists :overwrite))
-  #+openmcl
   (when (probe-file #p"/dev/null")
-    (open-device-stream #p"/dev/null" :output))  
+    (open #p"/dev/null" :direction :output :if-exists :overwrite))  
   )
 
 
     (write-char #\: stream)
     (write-string (aref +datetime-number-strings+ minute) stream)))
 
+(defun copy-binary-stream (in out)
+  (do* ((buf (make-array 4096 :element-type '(unsigned-byte 8)))
+       (pos (read-sequence buf in) (read-sequence buf in)))
+      ((zerop pos))
+    (write-sequence buf out :end pos)))