;ELC ;;; compiled by kwzh@hal.gnu.ai.mit.edu on Tue May 30 19:50:47 1995 ;;; from file /gd/gnu/emacs/19.0/lisp/tar-mode.el ;;; emacs version 19.28.92.13. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.28.90"))) (error "`tar-mode.el' was compiled for Emacs 19.29 or later")) #@521 *The blocksize of tar files written by Emacs, or nil, meaning don't care. The blocksize of a tar file is not really the size of the blocks; rather, it is the number of blocks written with one system call. When tarring to a tape, this is the size of the *tape* blocks, but when writing to a file, it doesn't matter much. The only noticeable difference is that if a tar file does not have a blocksize of 20, tar will tell you that; all this really controls is how many null padding bytes go on the end of the tar file. (defvar tar-anal-blocksize 20 (#$ . -480)) #@479 *Non-nil means tar-mode should play fast and loose with sub-file datestamps. If this is true, then editing and saving a tar file entry back into its tar file will update its datestamp. If false, the datestamp is unchanged. You may or may not want this - it is good in that you can tell when a file in a tar archive has been changed, but it is bad for the same reason that editing a file in the tar archive at all is bad - the changed version of the file never exists on disk. (defvar tar-update-datestamp nil (#$ . -1050)) #@144 *Non-nil means Tar mode should show the date/time of each subfile. This information is useful, but it takes screen space away from file names. (defvar tar-mode-show-date nil (#$ . -1582)) (byte-code "! B! B!  B!- B!: B####" [boundp tar-parse-info nil current-load-list tar-header-offset tar-superior-buffer tar-superior-descriptor tar-subfile-mode put permanent-local t] 4) #@49 A mind-numbingly simple implementation of setf. (defalias 'tar-setf '(macro . #[(form val) " ! \"9\fE^\f:$ \"^\f@=8\fA@\f8F^\f@=I\fA@E^\f@=Z\fA@E^ \")" [macroexpand form boundp byte-compile-macro-environment mform setq val error "can't setf %s" aref aset 2 car setcar cdr setcdr "don't know how to setf %s"] 5 (#$ . 2026)])) #@73 syntax: (dolist (var-name list-expr &optional return-value) &body body) (defalias 'tar-dolist '(macro . #[(control &rest body) "@A@AA@\nDC DC DEC\"BBE F+" [control val init var let _dolist_iterator_ while (car _dolist_iterator_) append body setq cdr] 12 (#$ . 2407)])) #@74 syntax: (dolist (var-name count-expr &optional return-value) &body body) (defalias 'tar-dotimes '(macro . #[(control &rest body) "@A@AA@\nD DD E\n DEC\"BB F+" [control val n var let _dotimes_end_ 0 while < append body setq 1+] 10 (#$ . 2701)])) (defalias 'make-tar-header '(macro . #[(name mode uid git size date ck lt ln magic uname gname devmaj devmin) " \n \f  \n \f " [vector name mode uid git size date ck lt ln magic uname gname devmaj devmin] 15])) (defalias 'tar-header-name '(macro . #[(x) " E" [aref x 0] 3])) (defalias 'tar-header-mode '(macro . #[(x) " E" [aref x 1] 3])) (defalias 'tar-header-uid '(macro . #[(x) " E" [aref x 2] 3])) (defalias 'tar-header-gid '(macro . #[(x) " E" [aref x 3] 3])) (defalias 'tar-header-size '(macro . #[(x) " E" [aref x 4] 3])) (defalias 'tar-header-date '(macro . #[(x) " E" [aref x 5] 3])) (defalias 'tar-header-checksum '(macro . #[(x) " E" [aref x 6] 3])) (defalias 'tar-header-link-type '(macro . #[(x) " E" [aref x 7] 3])) (defalias 'tar-header-link-name '(macro . #[(x) " E" [aref x 8] 3])) (defalias 'tar-header-magic '(macro . #[(x) " E" [aref x 9] 3])) (defalias 'tar-header-uname '(macro . #[(x) " E" [aref x 10] 3])) (defalias 'tar-header-gname '(macro . #[(x) " E" [aref x 11] 3])) (defalias 'tar-header-dmaj '(macro . #[(x) " E" [aref x 12] 3])) (defalias 'tar-header-dmin '(macro . #[(x) " E" [aref x 13] 3])) (defalias 'make-tar-desc '(macro . #[(data-start tokens) " \nE" [cons data-start tokens] 3])) (defalias 'tar-desc-data-start '(macro . #[(x) " D" [car x] 2])) (defalias 'tar-desc-tokens '(macro . #[(x) " D" [cdr x] 2])) (byte-code "\nB \\\nB\f\\\nB\\\nB\\\nB\\\n\nB\n\\ \nB \\\f\nB\f\\\nB\\\nB\\\nB\\\nB\\\nB\\\nB\\\nB" [0 tar-name-offset current-load-list 100 tar-mode-offset 8 tar-uid-offset tar-gid-offset tar-size-offset 12 tar-time-offset tar-chk-offset tar-linkp-offset 1 tar-link-offset tar-magic-offset tar-uname-offset 32 tar-gname-offset tar-dmaj-offset tar-dmin-offset tar-end-offset] 2) #@129 Return a `tar-header' structure. This is a list of name, mode, uid, gid, size, write-date, checksum, link-type, and link-name. (defalias 'tar-header-block-tokenize #[(string) "GW ‡HUHU' SS S\n S\f HSOјEҘ#_ÕS^#qÕS^#\nÕS^\n #\fÕS^\fOUU?Z\" S# S# !S#!\"S#\"$S#$ S#O\nO \fO %S#%&S#&. " [string 512 nil 0 101 tar-mode-offset name-end tar-magic-offset link-end tar-gname-offset uname-end tar-dmaj-offset gname-end tar-linkp-offset link-p tar-uname-offset magic-str "ustar " "GNUtar " uname-valid-p name "[^]*" nulsexp string-match tar-name-offset tar-link-offset 48 "/$" 5 vector tar-parse-octal-integer tar-uid-offset tar-gid-offset tar-size-offset tar-time-offset tar-parse-octal-long-integer tar-chk-offset tar-dmin-offset tar-end-offset empty-tar-block] 19 (#$ . 4854)]) (defalias 'tar-parse-octal-integer #[(string &optional start end) "\n G HU\nW< HW+\f4\f_ HZ\\T\f)" [start 0 end string n 48 8] 4]) (defalias 'tar-parse-octal-long-integer #[(string &optional start end) "\n G HUD\nWJ HYC _ HZ\\\f_ \"\\ \"T\f *D" [start 0 end string hi lo 48 8 ash -16 logand 65535] 5]) (defalias 'tar-parse-octal-integer-safe #[(string) "GU !  W4 HW) HV-! T+!" [string L 0 error "empty string" i _dotimes_end_ 48 55 "'%c' is not an octal digit" tar-parse-octal-integer] 3]) #@62 Compute and return a tar-acceptable checksum for this block. (defalias 'tar-header-block-checksum #[(string) "\\ W\" H\\T\f W< H\\T& \\," [tar-chk-offset chk-field-start 8 chk-field-end 0 sum i string 512 256] 4 (#$ . 6449)]) #@57 Beep and print a warning if the checksum doesn't match. (defalias 'tar-header-block-check-checksum #[(hblock desired-checksum file-name) "\n!U? \"" [desired-checksum tar-header-block-checksum hblock beep message "Invalid checksum for file %s!" file-name] 3 (#$ . 6726)]) #@59 Modifies the given string to have a valid checksum field. (defalias 'tar-header-block-recompute-checksum #[(hblock) " !\n\"G I I \f \fW?  Z  ZZHI T - " [tar-header-block-checksum hblock chk format "%6o" chk-string l 154 0 155 32 i _dotimes_end_ 153 1] 6 (#$ . 7015)]) (defalias 'tar-clip-time-string #[(time) " !O\nOP)" [current-time-string time str 4 16 19 24] 5]) #@123 Store `-rw--r--r--' indicating MODE into STRING beginning at START. MODE should be an integer which is a file mode value. (defalias 'tar-grind-file-mode #[(mode string start) " \"UƂI \\ \"U#Ƃ$I \\ \"U7Ƃ8I \\ \"UKƂLI \\ \"U_Ƃ`I \\ \"UsƂtI \\ \"UƂI \\ \"UƂI \\ \"UƂI \"U \\I \"U \\I" [string start logand mode 256 0 45 114 1 128 119 2 64 120 3 32 4 16 5 8 6 7 1024 115 2048] 5 (#$ . 7433)]) #@53 Returns a line similar to the output of `tar -vtf'. (defalias 'tar-header-block-summarize #[(tar-hblock &optional mod-p) "HHHHHHHHHHH\f L܂M\\S\\\\\\ \\!!G ~\fG\\\\\\\"$H%$&炗I$%=%=%=%=%=%=%=%=%=%=%=%=I$#GU2!4GUE!G!!SG^:;:;W$:ZG:ZZHI:T:c*$TISG^:;:;W$\\:\\:HI:T:*G^:;:;W$:ZG:ZZHI:T:*G:;:;W$ :\\:HI:T:*G:;:;W@$!:\\:HI:T:#* =O =:;:;W$!G:\\\\\\ Uuv:HI:T:W*\fG:;:;W$!G:\\\\\\\f:HI:T:*!$G@A$%$." [tar-hblock 0 1 2 3 10 11 4 5 6 7 8 link-name link-p ck time size gname uname gid uid mode name left namew groupw sizew tar-mode-show-date 18 datew slash lastdigit datestart namestart make-string 32 string type mod-p 42 nil 45 108 115 99 98 100 112 20 29 77 35 83 38 86 tar-grind-file-mode int-to-string tar-clip-time-string i _dotimes_end_ 47 "==>" "-->" put-text-property mouse-face highlight] 13 (#$ . 7957)]) #@201 Parse the contents of the tar file in the current buffer. Place a dired-like listing on the front; then narrow to it, so that only that listing is visible (and the real data of the buffer is hidden). (defalias 'tar-summarize-buffer #[nil "! Z]ɥ]\n \\dX \\{! = \\ \n\" H=K \\ HWa H#  B B HV ׉S\"\"\\\\)!  =!!-eb@  A!!!A))!`$$}!*" [message "Parsing tar file..." nil result 1 pos buffer-size 1024 bs 100 bs100 tokens 512 tar-header-block-tokenize empty-tar-block "Parsing tar file...%d%%" 7 20 4 size 0 error "%s has size %s - corrupted" ash -9 9 make-local-variable tar-parse-info "Parsing tar file...done." "Warning: premature EOF parsing tar file" buffer-read-only _dolist_iterator_ tar-desc insert-string tar-header-block-summarize "\n" tar-header-offset set-buffer-modified-p] 6 (#$ . 9236)]) #@38 *Local keymap for Tar mode listings. (defvar tar-mode-map nil (#$ . -10183)) (byte-code " !#########################!B#####!B###@A#BCC!B#DE#FG#HI#JK#LM#NO#PQRS#PTRS#" [tar-mode-map make-keymap suppress-keymap define-key " " tar-next-line "c" tar-copy "d" tar-flag-deleted "" "e" tar-extract "f" " " [mouse-2] tar-mouse-extract "g" revert-buffer "h" describe-mode "n" "" "o" tar-extract-other-window "p" tar-previous-line "" "r" tar-rename-entry "u" tar-unflag "v" tar-view "x" tar-expunge "" tar-unflag-backwards "E" "M" tar-chmod-entry "G" tar-chgrp-entry "O" tar-chown-entry [menu-bar edit] undefined [menu-bar immediate] "Immediate" make-sparse-keymap [menu-bar immediate view] ("View This File" . tar-view) [menu-bar immediate display] ("Display in Other Window" . tar-display-other-file) [menu-bar immediate find-file-other-window] ("Find in Other Window" . tar-extract-other-window) [menu-bar immediate find-file] ("Find This File" . tar-extract) [menu-bar mark] "Mark" [menu-bar mark unmark-all] ("Unmark All" . tar-clear-modification-flags) [menu-bar mark deletion] ("Flag" . tar-flag-deleted) [menu-bar mark unmark] ("Unflag" . tar-unflag) [menu-bar operate] "Operate" [menu-bar operate chown] ("Change Owner..." . tar-chown-entry) [menu-bar operate chgrp] ("Change Group..." . tar-chgrp-entry) [menu-bar operate chmod] ("Change Mode..." . tar-chmod-entry) [menu-bar operate rename] ("Rename to..." . tar-rename-entry) [menu-bar operate copy] ("Copy to..." . tar-copy) [menu-bar operate expunge] ("Expunge Marked Files" . tar-expunge) put tar-mode mode-class special tar-subfile-mode] 6) #@739 Major mode for viewing a tar file as a dired-like listing of its contents. You can move around using the usual cursor motion commands. Letters no longer insert themselves. Type `e' to pull a file out of the tar file and into its own buffer; or click mouse-2 on the file's line in the Tar mode buffer. Type `c' to copy an entry from the tar file into another file on disk. If you edit a sub-file of this archive (as with the `e' command) and save it with Control-x Control-s, the contents of that buffer will be saved back into the tar-file buffer; in this way you can edit a file inside of a tar archive without extracting it and re-archiving it. See also: variables `tar-update-datestamp' and `tar-anal-blocksize'. \{tar-mode-map} (defalias 'tar-mode #[nil " !!!!!!   !!!~!O\nO\n}R !" [kill-all-local-variables make-local-variable tar-header-offset tar-parse-info require-final-newline nil revert-buffer-function tar-mode-revert enable-local-variables next-line-add-newlines tar-mode major-mode "Tar" mode-name use-local-map tar-mode-map auto-save-mode 0 write-contents-hooks (tar-mode-write-file) boundp 1 tar-summarize-buffer run-hooks tar-mode-hook] 2 (#$ . 12046)]) #@229 Minor mode for editing an element of a tar-file. This mode redefines the save-buffer command to save the current buffer back into its associated tar-file buffer. You must save that buffer to actually save your changes to disk. (defalias 'tar-subfile-mode #[(p) "!\n !! ?\"!V9! ! !!" [boundp tar-superior-buffer error "This buffer is not an element of a tar file" make-local-variable tar-subfile-mode p prefix-numeric-value 0 local-write-file-hooks (tar-subfile-save-buffer) auto-save-mode nil buffer-auto-save-file-name run-hooks tar-subfile-mode-hook kill-local-variable] 3 (#$ . 13293) "P"]) (defalias 'tar-mode-revert #[(&optional no-autosave no-confirm) " \"~) " [nil tar-header-offset revert-buffer-function revert-buffer t no-confirm tar-mode] 3]) (defalias 'tar-next-line #[(p) "ym? ‚u" [p tar-mode-show-date 54 36] 1 nil "p"]) (defalias 'tar-previous-line #[(p) " [!" [tar-next-line p] 2 nil "p"]) #@69 Return the tar-descriptor of the current line, or signals an error. (defalias 'tar-current-descriptor #[(&optional noerror) "ey`)\"\n8 ?!" [count-lines 0 tar-parse-info noerror error "This line does not describe a tar-file entry"] 3 (#$ . 14275)]) (defalias 'tar-get-descriptor #[nil " AH\nHO= ʂM=+̂M=6΂M=AЂM=L҂M\"\fUY! ," [tar-current-descriptor descriptor tokens 4 size 7 link-p error "This is a %s, not a real file" 5 "directory" 20 "tar directory header" 29 "multivolume-continuation" 35 "sparse entry" 38 "volume header" "link" 0 "This is a zero-length file"] 5]) #@55 Extract a file whose tar directory line you click on. (defalias 'tar-mouse-extract #[(event) "  8:‚ 8)@)!q  8:(‚) 8)A@:;\fA@@>\fA@)b *  8:S‚T 8)@)!  8:j‚k 8)A@:}\fA@@\fA@)b " [window-buffer event 2 1 position tar-get-descriptor select-window tar-extract] 4 (#$ . 14922) "e"]) #@70 In Tar mode, extract this entry of the tar file into its own buffer. (defalias 'tar-extract #[(&optional other-window-p) "= AH H \f@\n\\\\\f \\ p !!R=\n!!ݎ~q\f #bQ!!\"q#)# !!!'\f(!!)q)\n!.=!!!. " [other-window-p view view-p tar-get-descriptor descriptor tokens 0 name 4 size tar-header-offset -1 start end tar-buffer file-name-nondirectory buffer-file-name tarname " (" ")" bufname buffer-read-only read-only-p get-buffer buffer nil just-created get-buffer-create t ((narrow-to-region 1 tar-header-offset)) insert-buffer-substring expand-file-name ":" abbreviate-file-name buffer-file-truename default-directory normal-mode rename-buffer make-local-variable tar-superior-buffer tar-superior-descriptor tar-subfile-mode 1 set-buffer-modified-p view-buffer kill-buffer view-exit-action display display-buffer switch-to-buffer-other-window switch-to-buffer] 5 (#$ . 15263) nil]) #@66 *In Tar mode, find this entry of the tar file in another window. (defalias 'tar-extract-other-window #[nil "!" [tar-extract t] 2 (#$ . -16310) nil]) #@69 *In Tar mode, display this entry of the tar file in another window. (defalias 'tar-display-other-window #[nil "!" [tar-extract display] 2 (#$ . -16468) nil]) #@53 *In Tar mode, view the tar file entry on this line. (defalias 'tar-view #[nil "!" [tar-extract view] 2 (#$ . -16635) nil]) #@57 Read a file name with this line's entry as the default. (defalias 'tar-read-file-name #[(&optional prompt) " AH! ! $!  !˘* !E \"< ĉSO> !Q  *" [prompt "Copy to: " expand-file-name tar-current-descriptor 0 default-file read-file-name file-name-directory nil target file-name-nondirectory "" file-directory-p string-match "/$" "/"] 6 (#$ . 16767)]) #@168 *In Tar mode, extract this entry of the tar file into a file on disk. If TO-FILE is not supplied, it is prompted for, defaulting to the name of the current tar-entry. (defalias 'tar-copy #[(&optional to-file) " AH\nH @\\\\ \\\n~ \n\f#)\f\f#." [tar-get-descriptor descriptor tokens 0 name 4 size tar-header-offset -1 start end write-region to-file message "Copied tar entry %s to %s"] 5 (#$ . -17162) (list (tar-read-file-name))]) #@113 *In Tar mode, mark this sub-file to be deleted from the tar file. With a prefix argument, mark that many files. (defalias 'tar-flag-deleted #[(p &optional unflag) "y W [ \n WA !-! *Ȃ+c W7ʂ8y\nT*m?Iu" [0 p i _dotimes_end_ tar-current-descriptor unflag delete-char 1 " " "D" -1 36] 3 (#$ . -17629) "p"]) #@125 *In Tar mode, un-mark this sub-file if it is marked to be deleted. With a prefix argument, un-mark that many files forward. (defalias 'tar-unflag #[(p) " \"" [tar-flag-deleted p t] 3 (#$ . -17980) "p"]) #@126 *In Tar mode, un-mark this sub-file if it is marked to be deleted. With a prefix argument, un-mark that many files backward. (defalias 'tar-unflag-backwards #[(p) " [\"" [tar-flag-deleted p t] 3 (#$ . -18193) "p"]) #@54 Expunge the tar-entry specified by the current line. (defalias 'tar-expunge-internal #[nil " A @\nH\nH\nH @\n  >A\f *y` u` Z `|Z*  \" ~\n\\\\ԉ\\\"\"\\\\|Z\f@@ZA)|.\f}" [tar-current-descriptor descriptor tokens line 0 name 4 size 7 link-p start tar-parse-info following-descs line-start nil line-len tar-header-offset delq -513 data-start ash 511 -9 9 512 data-end data-length _dolist_iterator_ desc 1] 6 (#$ . 18417)]) #@164 *In Tar mode, delete all the archived files flagged for deletion. This does not modify the disk image; you must save the tar file itself for this to be permanent. (defalias 'tar-expunge #[(&optional noconfirm) "\n!Cbm)!# \fTy \n})\fU>!B\f\")" [noconfirm y-or-n-p "Expunge files marked for deletion? " 0 n looking-at "D" tar-expunge-internal 1 tar-pad-to-blocksize tar-header-offset message "Nothing to expunge." "%s files expunged. Be sure to save this buffer."] 3 (#$ . -18943) nil]) #@49 Remove the stars at the beginning of each line. (defalias 'tar-clear-modification-flags #[nil "b` Wg=!cy)" [1 tar-header-offset 32 delete-char " "] 2 (#$ . 19479) nil]) #@368 *Change the user-id associated with this entry in the tar file. If this tar file was written by GNU tar, then you will be able to edit the user id as a string; otherwise, you must edit it as a number. You can force editing as a number by calling this with a prefix arg. This does not modify the disk image; you must save the tar file itself for this to be permanent. (defalias 'tar-chown-entry #[(new-uid) "; AI\fP\" AI\"OP\"" [new-uid tar-current-descriptor 10 tar-alter-one-field tar-uname-offset "" 2 tar-uid-offset format "%6o" 0 6 " "] 5 (#$ . -19676) (list (let ((tokens (tar-desc-tokens (tar-current-descriptor)))) (if (or current-prefix-arg (not (tar-header-magic tokens))) (let (n) (while (not (numberp (setq n (read-minibuffer "New UID number: " (format "%s" (tar-header-uid tokens))))))) n) (read-string "New UID string: " (tar-header-uname tokens)))))]) #@370 *Change the group-id associated with this entry in the tar file. If this tar file was written by GNU tar, then you will be able to edit the group id as a string; otherwise, you must edit it as a number. You can force editing as a number by calling this with a prefix arg. This does not modify the disk image; you must save the tar file itself for this to be permanent. (defalias 'tar-chgrp-entry #[(new-gid) "; AI\fP\" AI\"OP\"" [new-gid tar-current-descriptor 11 tar-alter-one-field tar-gname-offset "" 3 tar-gid-offset format "%6o" 0 6 " "] 5 (#$ . -20577) (list (let ((tokens (tar-desc-tokens (tar-current-descriptor)))) (if (or current-prefix-arg (not (tar-header-magic tokens))) (let (n) (while (not (numberp (setq n (read-minibuffer "New GID number: " (format "%s" (tar-header-gid tokens))))))) n) (read-string "New GID string: " (tar-header-gname tokens)))))]) #@159 *Change the name associated with this entry in the tar file. This does not modify the disk image; you must save the tar file itself for this to be permanent. (defalias 'tar-rename-entry #[(new-name) "\n!GV! AI\"PO\"" [new-name "" error "zero length name" 98 "name too long" tar-current-descriptor 0 tar-alter-one-field make-string 99] 6 (#$ . -21480) (list (read-string "New name: " (tar-header-name (tar-desc-tokens (tar-current-descriptor)))))]) #@170 *Change the protection bits associated with this entry in the tar file. This does not modify the disk image; you must save the tar file itself for this to be permanent. (defalias 'tar-chmod-entry #[(new-mode) " A\nI\f\n\"OP\"" [tar-current-descriptor 1 new-mode tar-alter-one-field tar-mode-offset format "%6o" 0 6 " "] 5 (#$ . -21964) (list (tar-parse-octal-integer-safe (read-string "New protection (octal): ")))]) (defalias 'tar-alter-one-field #[(data-position new-data-string) " AÎy`y `|\n!ȱd )~ @ \\\\ \f\\b`` G\\| c \\{! \\b``\\|\"ccc\nI \\{\nH#." [tar-current-descriptor descriptor tokens ((narrow-to-region 1 tar-header-offset)) 0 p 1 tar-header-block-summarize "\n" tar-header-offset -513 start data-position new-data-string tar-header-block-checksum 512 chk tar-chk-offset 8 format "%6o" 32 6 tar-header-block-check-checksum] 6]) (defalias 'tar-octal-time #[(timeval) "@A@\n\"\n\"\" \"V\" \"$c*" [timeval lobits hibits format "%05o%01o%05o" lsh -2 logior logand 3 1 32768 0 32767] 8]) #@182 In tar subfile mode, save this buffer into its parent tar-file buffer. This doesn't write anything to disk; you must save the parent tar-file buffer to make your changes permanent. (defalias 'tar-subfile-save-buffer #[nil "!\n !!\f!p \f qA\n@ \nH \nHЉ\\\"\">A`!َ~ \\\\Љ\\\"\"\\|b !Љ\\\"\"\\bZ\"c\nIZ!\"\"\"@#@!\\\"A\")*Z%&\\b``\\|\"cc+ %,\\b``\\| !cc%{!0%1\\b``\\|0\"ccc\n0I*GGZ5b5!y` :;