Function: archive-ar-extract
archive-ar-extract is a byte-compiled function defined in
arc-mode.el.gz.
Signature
(archive-ar-extract ARCHIVE NAME)
Source Code
;; Defined in /usr/src/emacs/lisp/arc-mode.el.gz
(defun archive-ar-extract (archive name)
(let ((destbuf (current-buffer))
(archivebuf (find-file-noselect archive))
(from nil) size)
(with-current-buffer archivebuf
(save-restriction
;; We may be in archive-mode or not, so either with or without
;; narrowing and with or without a prepended summary.
(save-excursion
(widen)
(search-forward "!<arch>\n")
(while (and (not from) (looking-at archive-ar-file-header-re))
(let ((this (match-string 1)))
(setq size (string-to-number (match-string 6)))
(goto-char (match-end 0))
(if (equal name (archive-ar--name this))
(setq from (point))
;; Move to the end of the data.
(forward-char size)
(if (eq ?\n (char-after)) (forward-char 1)))))
(when from
(set-buffer-multibyte nil)
(with-current-buffer destbuf
;; Do it within the `widen'.
(insert-buffer-substring archivebuf from (+ from size)))
(set-buffer-multibyte 'to)
;; Inform the caller that the call succeeded.
t))))))