diff options
| author | Stefan Monnier | 2020-04-03 22:27:54 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2020-04-04 20:06:55 -0400 |
| commit | c09457e6ed85da8bdc287851a05c4e3f95a44033 (patch) | |
| tree | 06705ddfb1f7c22b2172e766b0c0f7200df24371 | |
| parent | 4b4da58e8c11f639886926018cb0feb964688a97 (diff) | |
| download | emacs-c09457e6ed85da8bdc287851a05c4e3f95a44033.tar.gz emacs-c09457e6ed85da8bdc287851a05c4e3f95a44033.zip | |
* lisp/arc-mode.el (archive--file-desc): Add fields from other structs
Add fields `size`, `time` (used by all backends) as well as
`pos`, `ratio`, `uid`, and `gid` (used only be some backends).
(archive-arc--file-desc, archive-rar--file-desc, archive-ar--file-desc)
(archive-lzh--file-desc, archive-zip--file-desc, archive-7z--file-desc):
Remove defstructs.
(archive-arc-summarize): Record size and time in the descrs.
(archive-lzh-summarize): Record size, time, uid, and gid in the descrs.
(archive-zip-summarize): Record size and time in the descrs.
(archive-zoo-summarize): Record size and time in the descrs.
(archive-rar-summarize): Adjust to use of `archive--file-desc`.
(archive-7z-summarize): Adjust to new constructor.
(archive-ar-summarize): Adjust to use of `archive--file-desc`.
(archive-ar-write-file-member): Remove mode-to-int hack.
(archive-get-descr): Directory entries aren't regular members.
| -rw-r--r-- | lisp/arc-mode.el | 189 |
1 files changed, 82 insertions, 107 deletions
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 0a7816c2252..2cca02665fc 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el | |||
| @@ -500,18 +500,25 @@ Its value is an `archive--file-desc'.") | |||
| 500 | ;; ext-file-name and int-file-name are usually `eq' | 500 | ;; ext-file-name and int-file-name are usually `eq' |
| 501 | ;; except when int-file-name is the downcased | 501 | ;; except when int-file-name is the downcased |
| 502 | ;; ext-file-name. | 502 | ;; ext-file-name. |
| 503 | (ext-file-name int-file-name mode))) | 503 | (ext-file-name int-file-name mode size time |
| 504 | ext-file-name int-file-name mode) | 504 | &key pos ratio uid gid))) |
| 505 | ext-file-name int-file-name | ||
| 506 | (mode nil :type integer) | ||
| 507 | (size nil :type integer) | ||
| 508 | (time nil :type string) | ||
| 509 | (ratio nil :type string) | ||
| 510 | uid gid | ||
| 511 | pos) | ||
| 505 | 512 | ||
| 506 | ;; Features in formats: | 513 | ;; Features in formats: |
| 507 | ;; | 514 | ;; |
| 508 | ;; ARC: size, date, time (date and time strings internally generated) | 515 | ;; ARC: size, date&time (date and time strings internally generated) |
| 509 | ;; LZH: size, date, time, mode, uid, gid (mode, date, time generated, ugid:int) | 516 | ;; LZH: size, date&time, mode, uid, gid (mode, date, time generated, ugid:int) |
| 510 | ;; ZIP: size, date, time, mode (mode, date, time generated) | 517 | ;; ZIP: size, date&time, mode (mode, date, time generated) |
| 511 | ;; ZOO: size, date, time (date and time strings internally generated) | 518 | ;; ZOO: size, date&time (date and time strings internally generated) |
| 512 | ;; AR : size, date, time, mode, user, group (internally generated) | 519 | ;; AR : size, date&time, mode, user, group (internally generated) |
| 513 | ;; RAR: size, date, time, ratio (all as strings, using `lsar') | 520 | ;; RAR: size, date&time, ratio (all as strings, using `lsar') |
| 514 | ;; 7Z : size, date, time (all as strings, using `7z' or `7za') | 521 | ;; 7Z : size, date&time (all as strings, using `7z' or `7za') |
| 515 | ;; | 522 | ;; |
| 516 | ;; LZH has alternate display (with UID/GID i.s.o MODE/DATE/TIME | 523 | ;; LZH has alternate display (with UID/GID i.s.o MODE/DATE/TIME |
| 517 | 524 | ||
| @@ -630,7 +637,9 @@ Does not signal an error if optional argument NOERROR is non-nil." | |||
| 630 | (if (and (>= (point) archive-file-list-start) | 637 | (if (and (>= (point) archive-file-list-start) |
| 631 | (< no (length archive-files))) | 638 | (< no (length archive-files))) |
| 632 | (let ((item (aref archive-files no))) | 639 | (let ((item (aref archive-files no))) |
| 633 | (if (archive--file-desc-p item) | 640 | (if (and (archive--file-desc-p item) |
| 641 | (let ((mode (archive--file-desc-mode item))) | ||
| 642 | (zerop (logand 16384 mode)))) | ||
| 634 | item | 643 | item |
| 635 | (if (not noerror) | 644 | (if (not noerror) |
| 636 | (error "Entry is not a regular member of the archive")))) | 645 | (error "Entry is not a regular member of the archive")))) |
| @@ -1453,16 +1462,10 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 1453 | (interactive) | 1462 | (interactive) |
| 1454 | (let ((inhibit-read-only t)) | 1463 | (let ((inhibit-read-only t)) |
| 1455 | (undo))) | 1464 | (undo))) |
| 1465 | |||
| 1456 | ;; ------------------------------------------------------------------------- | 1466 | ;; ------------------------------------------------------------------------- |
| 1457 | ;;; Section: Arc Archives | 1467 | ;;; Section: Arc Archives |
| 1458 | 1468 | ||
| 1459 | (cl-defstruct (archive-arc--file-desc | ||
| 1460 | (:include archive--file-desc) | ||
| 1461 | (:constructor nil) | ||
| 1462 | (:constructor archive-arc--file-desc | ||
| 1463 | (ext-file-name int-file-name mode pos))) | ||
| 1464 | pos) | ||
| 1465 | |||
| 1466 | (defun archive-arc-summarize () | 1469 | (defun archive-arc-summarize () |
| 1467 | (let ((p 1) | 1470 | (let ((p 1) |
| 1468 | (totalsize 0) | 1471 | (totalsize 0) |
| @@ -1494,8 +1497,11 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 1494 | (- (length text) (length ifnname)) | 1497 | (- (length text) (length ifnname)) |
| 1495 | (length text)) | 1498 | (length text)) |
| 1496 | visual) | 1499 | visual) |
| 1497 | files (cons (archive-arc--file-desc | 1500 | files (cons (archive--file-desc |
| 1498 | efnname ifnname nil (1- p)) | 1501 | efnname ifnname nil ucsize |
| 1502 | (concat (archive-dosdate moddate) | ||
| 1503 | " " (archive-dostime modtime)) | ||
| 1504 | :pos (1- p)) | ||
| 1499 | files) | 1505 | files) |
| 1500 | p (+ p 29 csize)))) | 1506 | p (+ p 29 csize)))) |
| 1501 | (goto-char (point-min)) | 1507 | (goto-char (point-min)) |
| @@ -1524,19 +1530,12 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 1524 | (save-excursion | 1530 | (save-excursion |
| 1525 | (widen) | 1531 | (widen) |
| 1526 | (goto-char (+ archive-proper-file-start 2 | 1532 | (goto-char (+ archive-proper-file-start 2 |
| 1527 | (archive-arc--file-desc-pos descr))) | 1533 | (archive--file-desc-pos descr))) |
| 1528 | (delete-char 13) | 1534 | (delete-char 13) |
| 1529 | (arc-insert-unibyte name))))) | 1535 | (arc-insert-unibyte name))))) |
| 1530 | ;; ------------------------------------------------------------------------- | 1536 | ;; ------------------------------------------------------------------------- |
| 1531 | ;;; Section: Lzh Archives | 1537 | ;;; Section: Lzh Archives |
| 1532 | 1538 | ||
| 1533 | (cl-defstruct (archive-lzh--file-desc | ||
| 1534 | (:include archive--file-desc) | ||
| 1535 | (:constructor nil) | ||
| 1536 | (:constructor archive-lzh--file-desc | ||
| 1537 | (ext-file-name int-file-name mode pos))) | ||
| 1538 | pos) | ||
| 1539 | |||
| 1540 | (defun archive-lzh-summarize (&optional start) | 1539 | (defun archive-lzh-summarize (&optional start) |
| 1541 | (let ((p (or start 1)) ;; 1 for .lzh, something further on for .exe | 1540 | (let ((p (or start 1)) ;; 1 for .lzh, something further on for .exe |
| 1542 | (totalsize 0) | 1541 | (totalsize 0) |
| @@ -1656,8 +1655,12 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 1656 | (- (length text) (length prname)) | 1655 | (- (length text) (length prname)) |
| 1657 | (length text)) | 1656 | (length text)) |
| 1658 | visual) | 1657 | visual) |
| 1659 | files (cons (archive-lzh--file-desc | 1658 | files (cons (archive--file-desc |
| 1660 | prname ifnname mode (1- p)) | 1659 | prname ifnname mode ucsize |
| 1660 | (concat moddate " " modtime) | ||
| 1661 | :pos (1- p) | ||
| 1662 | :uid (or uname (if uid (number-to-string uid))) | ||
| 1663 | :gid (or gname (if gid (number-to-string gid)))) | ||
| 1661 | files)) | 1664 | files)) |
| 1662 | (cond ((= hdrlvl 1) | 1665 | (cond ((= hdrlvl 1) |
| 1663 | (setq p (+ p hsize 2 csize))) | 1666 | (setq p (+ p hsize 2 csize))) |
| @@ -1704,7 +1707,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 1704 | (save-excursion | 1707 | (save-excursion |
| 1705 | (widen) | 1708 | (widen) |
| 1706 | (let* ((p (+ archive-proper-file-start | 1709 | (let* ((p (+ archive-proper-file-start |
| 1707 | (archive-lzh--file-desc-pos descr))) | 1710 | (archive--file-desc-pos descr))) |
| 1708 | (oldhsize (get-byte p)) | 1711 | (oldhsize (get-byte p)) |
| 1709 | (oldfnlen (get-byte (+ p 21))) | 1712 | (oldfnlen (get-byte (+ p 21))) |
| 1710 | (newfnlen (length newname)) | 1713 | (newfnlen (length newname)) |
| @@ -1724,7 +1727,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 1724 | (save-restriction | 1727 | (save-restriction |
| 1725 | (widen) | 1728 | (widen) |
| 1726 | (dolist (fil files) | 1729 | (dolist (fil files) |
| 1727 | (let* ((p (+ archive-proper-file-start (archive-lzh--file-desc-pos fil))) | 1730 | (let* ((p (+ archive-proper-file-start (archive--file-desc-pos fil))) |
| 1728 | (hsize (get-byte p)) | 1731 | (hsize (get-byte p)) |
| 1729 | (fnlen (get-byte (+ p 21))) | 1732 | (fnlen (get-byte (+ p 21))) |
| 1730 | (p2 (+ p 22 fnlen)) | 1733 | (p2 (+ p 22 fnlen)) |
| @@ -1784,13 +1787,6 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 1784 | ;; ------------------------------------------------------------------------- | 1787 | ;; ------------------------------------------------------------------------- |
| 1785 | ;;; Section: Zip Archives | 1788 | ;;; Section: Zip Archives |
| 1786 | 1789 | ||
| 1787 | (cl-defstruct (archive-zip--file-desc | ||
| 1788 | (:include archive--file-desc) | ||
| 1789 | (:constructor nil) | ||
| 1790 | (:constructor archive-zip--file-desc | ||
| 1791 | (ext-file-name int-file-name mode pos))) | ||
| 1792 | pos) | ||
| 1793 | |||
| 1794 | (defun archive-zip-summarize () | 1790 | (defun archive-zip-summarize () |
| 1795 | (goto-char (- (point-max) (- 22 18))) | 1791 | (goto-char (- (point-max) (- 22 18))) |
| 1796 | (search-backward-regexp "[P]K\005\006") | 1792 | (search-backward-regexp "[P]K\005\006") |
| @@ -1860,8 +1856,11 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 1860 | visual) | 1856 | visual) |
| 1861 | files (cons (if isdir | 1857 | files (cons (if isdir |
| 1862 | nil | 1858 | nil |
| 1863 | (archive-zip--file-desc efnname ifnname mode | 1859 | (archive--file-desc |
| 1864 | (1- p))) | 1860 | efnname ifnname mode ucsize |
| 1861 | (concat (archive-dosdate moddate) | ||
| 1862 | " " (archive-dostime modtime)) | ||
| 1863 | :pos (1- p))) | ||
| 1865 | files) | 1864 | files) |
| 1866 | p (+ p 46 fnlen exlen fclen)))) | 1865 | p (+ p 46 fnlen exlen fclen)))) |
| 1867 | (goto-char (point-min)) | 1866 | (goto-char (point-min)) |
| @@ -1919,7 +1918,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 1919 | (widen) | 1918 | (widen) |
| 1920 | (dolist (fil files) | 1919 | (dolist (fil files) |
| 1921 | (let* ((p (+ archive-proper-file-start | 1920 | (let* ((p (+ archive-proper-file-start |
| 1922 | (archive-zip--file-desc-pos fil))) | 1921 | (archive--file-desc-pos fil))) |
| 1923 | (creator (get-byte (+ p 5))) | 1922 | (creator (get-byte (+ p 5))) |
| 1924 | (oldmode (archive--file-desc-mode fil)) | 1923 | (oldmode (archive--file-desc-mode fil)) |
| 1925 | (newval (archive-calc-mode oldmode newmode)) | 1924 | (newval (archive-calc-mode oldmode newmode)) |
| @@ -1985,8 +1984,10 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 1985 | (- (length text) (length ifnname)) | 1984 | (- (length text) (length ifnname)) |
| 1986 | (length text)) | 1985 | (length text)) |
| 1987 | visual) | 1986 | visual) |
| 1988 | ;; FIXME: Keep size/date(/mode?) in the desc! | 1987 | files (cons (archive--file-desc |
| 1989 | files (cons (archive--file-desc efnname ifnname nil) | 1988 | efnname ifnname nil ucsize |
| 1989 | (concat (archive-dosdate moddate) | ||
| 1990 | " " (archive-dostime modtime))) | ||
| 1990 | files) | 1991 | files) |
| 1991 | p next))) | 1992 | p next))) |
| 1992 | (goto-char (point-min)) | 1993 | (goto-char (point-min)) |
| @@ -2010,13 +2011,6 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 2010 | ;; ------------------------------------------------------------------------- | 2011 | ;; ------------------------------------------------------------------------- |
| 2011 | ;;; Section: Rar Archives | 2012 | ;;; Section: Rar Archives |
| 2012 | 2013 | ||
| 2013 | (cl-defstruct (archive-rar--file-desc | ||
| 2014 | (:include archive--file-desc) | ||
| 2015 | (:constructor nil) | ||
| 2016 | (:constructor archive-rar--file-desc | ||
| 2017 | (ext-file-name int-file-name mode size ratio date time))) | ||
| 2018 | size ratio date time) | ||
| 2019 | |||
| 2020 | (defun archive-rar-summarize (&optional file) | 2014 | (defun archive-rar-summarize (&optional file) |
| 2021 | ;; File is used internally for `archive-rar-exe-summarize'. | 2015 | ;; File is used internally for `archive-rar-exe-summarize'. |
| 2022 | (unless file (setq file buffer-file-name)) | 2016 | (unless file (setq file buffer-file-name)) |
| @@ -2042,28 +2036,28 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 2042 | (size (match-string 1))) | 2036 | (size (match-string 1))) |
| 2043 | (if (> (length name) maxname) (setq maxname (length name))) | 2037 | (if (> (length name) maxname) (setq maxname (length name))) |
| 2044 | (if (> (length size) maxsize) (setq maxsize (length size))) | 2038 | (if (> (length size) maxsize) (setq maxsize (length size))) |
| 2045 | (push (archive-rar--file-desc name name nil | 2039 | (push (archive--file-desc name name nil |
| 2046 | ;; Size, Ratio. | 2040 | ;; Size |
| 2047 | size (match-string 2) | 2041 | (string-to-number size) |
| 2048 | ;; Date, Time. | 2042 | ;; Date&Time. |
| 2049 | (match-string 4) (match-string 5)) | 2043 | (concat (match-string 4) " " (match-string 5)) |
| 2044 | :ratio (match-string 2)) | ||
| 2050 | files)))) | 2045 | files)))) |
| 2051 | (setq files (nreverse files)) | 2046 | (setq files (nreverse files)) |
| 2052 | (goto-char (point-min)) | 2047 | (goto-char (point-min)) |
| 2053 | (let* ((format (format " %%s %%s %%%ds %%5s %%s" maxsize)) | 2048 | (let* ((format (format " %%s %%%ds %%5s %%s" maxsize)) |
| 2054 | (sep (format format "----------" "-----" (make-string maxsize ?-) | 2049 | (sep (format format "---------- -----" (make-string maxsize ?-) |
| 2055 | "-----" "")) | 2050 | "-----" "")) |
| 2056 | (column (length sep))) | 2051 | (column (length sep))) |
| 2057 | (insert (format format " Date " "Time " "Size" "Ratio" "Filename") "\n") | 2052 | (insert (format format " Date Time " "Size" "Ratio" "Filename") "\n") |
| 2058 | (insert sep (make-string maxname ?-) "\n") | 2053 | (insert sep (make-string maxname ?-) "\n") |
| 2059 | (archive-summarize-files | 2054 | (archive-summarize-files |
| 2060 | (mapcar (lambda (desc) | 2055 | (mapcar (lambda (desc) |
| 2061 | (let ((text | 2056 | (let ((text |
| 2062 | (format format | 2057 | (format format |
| 2063 | (archive-rar--file-desc-date desc) | 2058 | (archive--file-desc-time desc) |
| 2064 | (archive-rar--file-desc-time desc) | 2059 | (archive--file-desc-size desc) |
| 2065 | (archive-rar--file-desc-size desc) | 2060 | (archive--file-desc-ratio desc) |
| 2066 | (archive-rar--file-desc-ratio desc) | ||
| 2067 | (archive--file-desc-int-file-name desc)))) | 2061 | (archive--file-desc-int-file-name desc)))) |
| 2068 | (archive--file-summary | 2062 | (archive--file-summary |
| 2069 | text | 2063 | text |
| @@ -2117,13 +2111,6 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 2117 | ;; ------------------------------------------------------------------------- | 2111 | ;; ------------------------------------------------------------------------- |
| 2118 | ;;; Section: 7z Archives | 2112 | ;;; Section: 7z Archives |
| 2119 | 2113 | ||
| 2120 | (cl-defstruct (archive-7z--file-desc | ||
| 2121 | (:include archive--file-desc) | ||
| 2122 | (:constructor nil) | ||
| 2123 | (:constructor archive-7z--file-desc | ||
| 2124 | (ext-file-name int-file-name mode time size))) | ||
| 2125 | time size) | ||
| 2126 | |||
| 2127 | (defun archive-7z-summarize () | 2114 | (defun archive-7z-summarize () |
| 2128 | (let ((maxname 10) | 2115 | (let ((maxname 10) |
| 2129 | (maxsize 5) | 2116 | (maxsize 5) |
| @@ -2146,7 +2133,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 2146 | (match-string 1))))) | 2133 | (match-string 1))))) |
| 2147 | (if (> (length name) maxname) (setq maxname (length name))) | 2134 | (if (> (length name) maxname) (setq maxname (length name))) |
| 2148 | (if (> (length size) maxsize) (setq maxsize (length size))) | 2135 | (if (> (length size) maxsize) (setq maxsize (length size))) |
| 2149 | (push (archive-7z--file-desc name name nil time size) | 2136 | (push (archive--file-desc name name nil (string-to-number size) time) |
| 2150 | files)))) | 2137 | files)))) |
| 2151 | (setq files (nreverse files)) | 2138 | (setq files (nreverse files)) |
| 2152 | (goto-char (point-min)) | 2139 | (goto-char (point-min)) |
| @@ -2159,8 +2146,8 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 2159 | (mapcar (lambda (desc) | 2146 | (mapcar (lambda (desc) |
| 2160 | (let ((text | 2147 | (let ((text |
| 2161 | (format format | 2148 | (format format |
| 2162 | (archive-7z--file-desc-size desc) | 2149 | (archive--file-desc-size desc) |
| 2163 | (archive-7z--file-desc-time desc) | 2150 | (archive--file-desc-time desc) |
| 2164 | (archive--file-desc-int-file-name desc)))) | 2151 | (archive--file-desc-int-file-name desc)))) |
| 2165 | (archive--file-summary | 2152 | (archive--file-summary |
| 2166 | text column (length text)))) | 2153 | text column (length text)))) |
| @@ -2188,13 +2175,6 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 2188 | ;; not the GNU nor the BSD extensions. As it turns out, this is sufficient | 2175 | ;; not the GNU nor the BSD extensions. As it turns out, this is sufficient |
| 2189 | ;; for .deb packages. | 2176 | ;; for .deb packages. |
| 2190 | 2177 | ||
| 2191 | (cl-defstruct (archive-ar--file-desc | ||
| 2192 | (:include archive--file-desc) | ||
| 2193 | (:constructor nil) | ||
| 2194 | (:constructor archive-ar--file-desc | ||
| 2195 | (ext-file-name int-file-name mode time user group size))) | ||
| 2196 | time user group size) | ||
| 2197 | |||
| 2198 | (autoload 'tar-grind-file-mode "tar-mode") | 2178 | (autoload 'tar-grind-file-mode "tar-mode") |
| 2199 | 2179 | ||
| 2200 | (defconst archive-ar-file-header-re | 2180 | (defconst archive-ar-file-header-re |
| @@ -2217,47 +2197,45 @@ NAME is expected to be the 16-bytes part of an ar record." | |||
| 2217 | (maxtime 16) | 2197 | (maxtime 16) |
| 2218 | (maxuser 5) | 2198 | (maxuser 5) |
| 2219 | (maxgroup 5) | 2199 | (maxgroup 5) |
| 2220 | (maxmode 8) | 2200 | (maxmode 10) |
| 2221 | (maxsize 5) | 2201 | (maxsize 5) |
| 2222 | (files ())) | 2202 | (files ())) |
| 2223 | (goto-char (point-min)) | 2203 | (goto-char (point-min)) |
| 2224 | (search-forward "!<arch>\n") | 2204 | (search-forward "!<arch>\n") |
| 2225 | (while (looking-at archive-ar-file-header-re) | 2205 | (while (looking-at archive-ar-file-header-re) |
| 2226 | (let ((name (match-string 1)) | 2206 | (let* ((name (match-string 1)) |
| 2227 | extname | 2207 | extname |
| 2228 | (time (string-to-number (match-string 2))) | 2208 | (time (string-to-number (match-string 2))) |
| 2229 | (user (match-string 3)) | 2209 | (user (match-string 3)) |
| 2230 | (group (match-string 4)) | 2210 | (group (match-string 4)) |
| 2231 | (mode (string-to-number (match-string 5) 8)) | 2211 | (mode (string-to-number (match-string 5) 8)) |
| 2232 | (size (string-to-number (match-string 6)))) | 2212 | (sizestr (match-string 6)) |
| 2213 | (size (string-to-number sizestr))) | ||
| 2233 | ;; Move to the beginning of the data. | 2214 | ;; Move to the beginning of the data. |
| 2234 | (goto-char (match-end 0)) | 2215 | (goto-char (match-end 0)) |
| 2235 | (setq time (format-time-string "%Y-%m-%d %H:%M" time)) | 2216 | (setq time (format-time-string "%Y-%m-%d %H:%M" time)) |
| 2236 | (setq extname (archive-ar--name name)) | 2217 | (setq extname (archive-ar--name name)) |
| 2237 | (setq user (substring user 0 (string-match " +\\'" user))) | 2218 | (setq user (substring user 0 (string-match " +\\'" user))) |
| 2238 | (setq group (substring group 0 (string-match " +\\'" group))) | 2219 | (setq group (substring group 0 (string-match " +\\'" group))) |
| 2239 | (setq mode (archive-int-to-mode mode)) | ||
| 2240 | ;; Move to the end of the data. | 2220 | ;; Move to the end of the data. |
| 2241 | (forward-char size) (if (eq ?\n (char-after)) (forward-char 1)) | 2221 | (forward-char size) (if (eq ?\n (char-after)) (forward-char 1)) |
| 2242 | (setq size (number-to-string size)) | ||
| 2243 | (if (> (length name) maxname) (setq maxname (length name))) | 2222 | (if (> (length name) maxname) (setq maxname (length name))) |
| 2244 | (if (> (length time) maxtime) (setq maxtime (length time))) | 2223 | (if (> (length time) maxtime) (setq maxtime (length time))) |
| 2245 | (if (> (length user) maxuser) (setq maxuser (length user))) | 2224 | (if (> (length user) maxuser) (setq maxuser (length user))) |
| 2246 | (if (> (length group) maxgroup) (setq maxgroup (length group))) | 2225 | (if (> (length group) maxgroup) (setq maxgroup (length group))) |
| 2247 | (if (> (length mode) maxmode) (setq maxmode (length mode))) | 2226 | (if (> (length sizestr) maxsize) (setq maxsize (length sizestr))) |
| 2248 | (if (> (length size) maxsize) (setq maxsize (length size))) | 2227 | (push (archive--file-desc extname extname mode size time |
| 2249 | (push (archive-ar--file-desc extname extname mode | 2228 | :uid user :gid group) |
| 2250 | time user group size) | ||
| 2251 | files))) | 2229 | files))) |
| 2252 | (setq files (nreverse files)) | 2230 | (setq files (nreverse files)) |
| 2253 | (goto-char (point-min)) | 2231 | (goto-char (point-min)) |
| 2254 | (let* ((format (format "%%%ds %%%ds/%%-%ds %%%ds %%%ds %%s" | 2232 | (let* ((format (format "%%%ds %%%ds/%%-%ds %%%ds %%%ds %%s" |
| 2255 | maxmode maxuser maxgroup maxsize maxtime)) | 2233 | maxmode maxuser maxgroup maxsize maxtime)) |
| 2256 | (sep (format format (make-string maxmode ?-) | 2234 | (sep (format format (make-string maxmode ?-) |
| 2257 | (make-string maxuser ?-) | 2235 | (make-string maxuser ?-) |
| 2258 | (make-string maxgroup ?-) | 2236 | (make-string maxgroup ?-) |
| 2259 | (make-string maxsize ?-) | 2237 | (make-string maxsize ?-) |
| 2260 | (make-string maxtime ?-) "")) | 2238 | (make-string maxtime ?-) "")) |
| 2261 | (column (length sep))) | 2239 | (column (length sep))) |
| 2262 | (insert (format format " Mode " "User" "Group" " Size " | 2240 | (insert (format format " Mode " "User" "Group" " Size " |
| 2263 | " Date " "Filename") | 2241 | " Date " "Filename") |
| @@ -2267,11 +2245,12 @@ NAME is expected to be the 16-bytes part of an ar record." | |||
| 2267 | (mapcar (lambda (desc) | 2245 | (mapcar (lambda (desc) |
| 2268 | (let ((text | 2246 | (let ((text |
| 2269 | (format format | 2247 | (format format |
| 2270 | (archive--file-desc-mode desc) | 2248 | (archive-int-to-mode |
| 2271 | (archive-ar--file-desc-user desc) | 2249 | (archive--file-desc-mode desc)) |
| 2272 | (archive-ar--file-desc-group desc) | 2250 | (archive--file-desc-uid desc) |
| 2273 | (archive-ar--file-desc-size desc) | 2251 | (archive--file-desc-gid desc) |
| 2274 | (archive-ar--file-desc-time desc) | 2252 | (archive--file-desc-size desc) |
| 2253 | (archive--file-desc-time desc) | ||
| 2275 | (archive--file-desc-int-file-name desc)))) | 2254 | (archive--file-desc-int-file-name desc)))) |
| 2276 | (archive--file-summary text column (length text)))) | 2255 | (archive--file-summary text column (length text)))) |
| 2277 | files)) | 2256 | files)) |
| @@ -2309,11 +2288,7 @@ NAME is expected to be the 16-bytes part of an ar record." | |||
| 2309 | (defun archive-ar-write-file-member (archive descr) | 2288 | (defun archive-ar-write-file-member (archive descr) |
| 2310 | (archive-*-write-file-member | 2289 | (archive-*-write-file-member |
| 2311 | archive | 2290 | archive |
| 2312 | (let ((d (copy-sequence descr))) | 2291 | descr |
| 2313 | ;; FIXME: Crude conversion from string modes to a number. | ||
| 2314 | (cl-callf (lambda (s) (if (string-match "x" s) ?\555 ?\444)) | ||
| 2315 | (archive--file-desc-mode d)) | ||
| 2316 | d) | ||
| 2317 | '("ar" "r"))) | 2292 | '("ar" "r"))) |
| 2318 | 2293 | ||
| 2319 | 2294 | ||