commit d04f58983720b389f271d56c2785aebb8a979e74 Spenser Truex <web@spensertruex.com> 2019-11-09 20:50:58 -0800 Archiving.
README.org | 10 +--------- code/util.lisp | 30 ------------------------------ package.lisp | 1 + 3 files changed, 2 insertions(+), 39 deletions(-)
diff --git a/README.org b/README.org index f17877c..45bf816 100644 --- a/README.org +++ b/README.org @@ -1,16 +1,8 @@ -;;;;; -title: Clapt -format: org -date: 2019-11-02 -tags: articles -excerpt: Keep a list of packages efficiently installed. -image: /static/librarian.png -;;;;; #+EMAIL: web@spensertruex.com -[[https://spensertruex.com/librarian][Official webpage]] #+OPTIONS: email:t toc:2 #+VERSION: 0.0.2 +Archived. Use [[https://github.com/roswell/roswell][roswell]] instead. #+caption: Librarian icon [[file:https://spensertruex.com/static/librarian-mini.png]] diff --git a/code/util.lisp b/code/util.lisp index f745d5b..e11668b 100644 --- a/code/util.lisp +++ b/code/util.lisp @@ -1,35 +1,5 @@ (in-package #:clapt) -(defun write-array (array stream) - "Write a binary array to the unsigned-byte stream." - (loop for x across array - do (write-byte x stream))) - -(defun copy-stream (from to size buffer loc) - "Copy an unsigned-byte stream to another one, somewhat efficiently." - (if (< loc size) - (let ((byte (read-byte from nil nil))) - (if byte - (copy-stream from to size - (progn (setf (aref buffer loc) byte) buffer) - (1+ loc)) - (write-array (subseq buffer 0 loc) to))) - (progn (write-array buffer to) - (copy-stream from to size buffer 0)))) - -(defun copy-file (from to &optional (buffer-size 1024)) - "Copy a file, require file handling." - (with-open-file (fr from :element-type 'unsigned-byte - :if-does-not-exist :error) - (with-open-file (to to :direction :output - :if-exists :error - :if-does-not-exist :create - :element-type 'unsigned-byte) - (copy-stream fr to buffer-size - (make-array buffer-size :element-type 'unsigned-byte) - 0)))) -;; (copy-file #p"/home/jose/org/sbcl.org" #p"/home/jose/example.delete") - (defun until (stream match) (let ((line (read-line stream nil nil))) (when line diff --git a/package.lisp b/package.lisp index 6bea25f..1e0e9c3 100644 --- a/package.lisp +++ b/package.lisp @@ -1,3 +1,4 @@ (defpackage #:clapt (:use #:cl) + (:import-from #:uiop #:copy-file) (:export #:update #:install #:add))