Commit b1af77e3 authored by Eric Timmons's avatar Eric Timmons
Browse files

READ-ENTRY-FROM-ARCHIVE -> READ-ENTRY

parent 5774ec2f
......@@ -72,7 +72,7 @@ Further operations on the archive are undefined."
(setf (open-archive-p archive) nil))
t)
(defmethod read-entry-from-archive :before ((archive archive))
(defmethod read-entry :before ((archive archive))
(unless (eq (%archive-direction archive) :input)
(error "Attempting to read from a non-input archive"))
(unless (open-archive-p archive)
......@@ -124,11 +124,11 @@ Further operations on the archive are undefined."
(defun make-stream-for-entry (archive entry)
(make-bounded-stream (archive-stream archive) (size entry)))
(defmethod read-entry-from-archive :before ((archive archive))
(defmethod read-entry :before ((archive archive))
(unless (file-position (archive-stream archive) (next-entry-start archive))
(error 'simple-tar-file-error :format-control "Unable to set FILE-POSITION.")))
(defmethod read-entry-from-archive ((archive archive))
(defmethod read-entry ((archive archive))
(let ((start-position (file-position (archive-stream archive)))
(buffer (make-array +tar-n-block-bytes+ :element-type '(unsigned-byte 8))))
(declare (dynamic-extent buffer))
......@@ -144,7 +144,7 @@ Further operations on the archive are undefined."
:header header
:start-position start-position)))))
(defmethod read-entry-from-archive :around ((archive archive))
(defmethod read-entry :around ((archive archive))
(let ((entry (call-next-method)))
(unless (null entry)
(setf (next-entry-start archive)
......
......@@ -65,7 +65,7 @@
an ARCHIVE-ENTRY representing the entry. RESULT is used as in DOTIMES."
(let ((archive-var (gensym)))
`(let ((,archive-var ,archive))
(do ((,entry (read-entry-from-archive ,archive-var)
(read-entry-from-archive ,archive-var)))
(do ((,entry (read-entry ,archive-var)
(read-entry ,archive-var)))
((null ,entry) ,result)
,@body))))
......@@ -27,7 +27,7 @@
;;; reading
(defgeneric read-entry-from-archive (archive)
(defgeneric read-entry (archive)
(:documentation "Return the next entry in ARCHIVE or NIL if there is no
next entry"))
......
......@@ -69,5 +69,5 @@
#:devminor
#:read-entry-from-archive
#:read-entry
#:make-entry-stream))
......@@ -5,81 +5,81 @@
:tar-file "test/ustar.tar"))
(let (entry)
;; First entry is a plain file, with the contents "Hello, world!"
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a.txt :ustar entry)
;; Next is the a-symlink.txt -> a.txt symlink
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a-symlink.txt :ustar entry)
;; Next is the a-hardlink.txt -> a.txt hardlink
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a-hardlink.txt :ustar entry)
;; fifo
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-fifo :ustar entry)
;; sda1
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-sda1 :ustar entry)
;; tty0
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-tty0 :ustar entry)
;; End of archive
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(para:true (null entry)))))
(para:define-test read-pax
(tar-file:with-open-tar-file (a (asdf:system-relative-pathname
:tar-file "test/pax.tar"))
(let (entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a.txt-attr :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a.txt :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a-symlink.txt-attr :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a-symlink.txt :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a-hardlink.txt-attr :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a-hardlink.txt :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-fifo-attr :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-fifo :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-sda1-attr :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-sda1 :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-tty0-attr :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-tty0 :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-sparse.txt-attr :pax entry)
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-sparse.txt :pax entry)
;; End of archive
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(para:true (null entry)))))
(para:define-test read-gnu
......@@ -87,35 +87,35 @@
:tar-file "test/gnu.tar"))
(let (entry)
;; First entry is a plain file, with the contents "Hello, world!"
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a.txt :gnu entry)
;; Next is the a-symlink.txt -> a.txt symlink
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a-symlink.txt :gnu entry)
;; Next is the a-hardlink.txt -> a.txt hardlink
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a-hardlink.txt :gnu entry)
;; fifo
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-fifo :gnu entry)
;; sda1
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-sda1 :gnu entry)
;; tty0
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-tty0 :gnu entry)
;; sparse.txt
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-sparse.txt :gnu entry)
;; End of archive
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(para:true (null entry)))))
(para:define-test read-v7
......@@ -123,17 +123,17 @@
:tar-file "test/v7.tar"))
(let (entry)
;; First entry is a plain file, with the contents "Hello, world!"
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a.txt :v7 entry)
;; Next is the a-symlink.txt -> a.txt symlink
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a-symlink.txt :v7 entry)
;; Next is the a-hardlink.txt -> a.txt hardlink
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(read-a-hardlink.txt :v7 entry)
;; End of archive
(setf entry (tar-file:read-entry-from-archive a))
(setf entry (tar-file:read-entry a))
(para:true (null entry)))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment