Function: tar-header-block-summarize

tar-header-block-summarize is a byte-compiled function defined in tar-mode.el.gz.

Signature

(tar-header-block-summarize TAR-HBLOCK &optional MOD-P)

Documentation

Return a line similar to the output of tar -vtf.

Source Code

;; Defined in /usr/src/emacs/lisp/tar-mode.el.gz
(defun tar-header-block-summarize (tar-hblock &optional mod-p)
  "Return a line similar to the output of `tar -vtf'."
  (let ((name (tar-header-name tar-hblock))
	(mode (tar-header-mode tar-hblock))
	(uid (tar-header-uid tar-hblock))
	(gid (tar-header-gid tar-hblock))
	(uname (tar-header-uname tar-hblock))
	(gname (tar-header-gname tar-hblock))
	(size (tar-header-size tar-hblock))
	(time (tar-header-date tar-hblock))
	;; (ck (tar-header-checksum tar-hblock))
	(type (tar-header-link-type tar-hblock))
	(link-name (tar-header-link-name tar-hblock)))
    (format "%c%s %7s/%-7s %7s%s %s%s"
	    (if mod-p ?* ? )
	    (file-modes-number-to-symbolic
	     mode
	     (cond ((or (eq type nil) (eq type 0)) ?-)
		   ((eq type 1) ?h)	; link
		   ((eq type 2) ?l)	; symlink
		   ((eq type 3) ?c)	; char special
		   ((eq type 4) ?b)	; block special
		   ((eq type 5) ?d)	; directory
		   ((eq type 6) ?p)	; FIFO/pipe
		   ((eq type 20) ?*)	; directory listing
		   ((eq type 28) ?L)	; next has longname
		   ((eq type 29) ?M)	; multivolume continuation
		   ((eq type 35) ?S)	; sparse
		   ((eq type 38) ?V)	; volume header
		   ((eq type 55) ?H)	; pax global extended header
		   ((eq type 72) ?X)	; pax extended header
		   (t ?\s)
		   ))
	    (if (= 0 (length uname)) uid uname)
	    (if (= 0 (length gname)) gid gname)
	    size
	    (if tar-mode-show-date
                (format-time-string " %Y-%m-%d %H:%M" time)
              "")
	    (propertize name
			'mouse-face 'highlight
			'help-echo "mouse-2: extract this file into a buffer")
	    (if (or (eq type 1) (eq type 2))
		(concat (if (= type 1) " ==> " " --> ") link-name)
	      ""))))