;ELC ;;; compiled by roland@geech.gnu.ai.mit.edu on Mon Jun 27 16:11:01 1994 ;;; from file /gd/gnu/emacs/19.0/lisp/tar-mode.el ;;; emacs version 19.25.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"))) (error "`/gd/gnu/emacs/19.0/lisp/tar-mode.el' was compiled for Emacs 19")) (defvar tar-anal-blocksize 20 "\ *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-update-datestamp nil "\ *Whether 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.") (byte-code "!!!! !)####" [boundp tar-parse-info nil tar-header-offset tar-superior-buffer tar-superior-descriptor tar-subfile-mode put permanent-local t] 4) (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 "\ A mind-numbingly simple implementation of setf."])) (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 "\ syntax: (dolist (var-name list-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 "\ syntax: (dolist (var-name count-expr &optional return-value) &body body)"])) (byte-code "\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"&\\(\\*\\+\\,\\.\\/\\0\\2\\3\\4\\6\\7\\8\\9" [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]) tar-header-name (macro . #[(x) " E" [aref x 0] 3]) tar-header-mode (macro . #[(x) " E" [aref x 1] 3]) tar-header-uid (macro . #[(x) " E" [aref x 2] 3]) tar-header-gid (macro . #[(x) " E" [aref x 3] 3]) tar-header-size (macro . #[(x) " E" [aref x 4] 3]) tar-header-date (macro . #[(x) " E" [aref x 5] 3]) tar-header-checksum (macro . #[(x) " E" [aref x 6] 3]) tar-header-link-type (macro . #[(x) " E" [aref x 7] 3]) tar-header-link-name (macro . #[(x) " E" [aref x 8] 3]) tar-header-magic (macro . #[(x) " E" [aref x 9] 3]) tar-header-uname (macro . #[(x) " E" [aref x 10] 3]) tar-header-gname (macro . #[(x) " E" [aref x 11] 3]) tar-header-dmaj (macro . #[(x) " E" [aref x 12] 3]) tar-header-dmin (macro . #[(x) " E" [aref x 13] 3]) make-tar-desc (macro . #[(data-start tokens) " \nE" [cons data-start tokens] 3]) tar-desc-data-start (macro . #[(x) " D" [car x] 2]) tar-desc-tokens (macro . #[(x) " D" [cdr x] 2]) 0 tar-name-offset 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] 4) (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-chk-offset tar-dmin-offset tar-end-offset empty-tar-block] 19 "\ Return a `tar-header' structure. This is a list of name, mode, uid, gid, size, write-date, checksum, link-type, and link-name."]) (byte-code "\"\"" [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] 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]] 3) (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 "\ Compute and return a tar-acceptable checksum for this block."]) (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 "\ Beep and print a warning if the checksum doesn't match."]) (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 "\ Modifies the given string to have a valid checksum field."]) (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 "\ Write a \"-rw--r--r-\" representing MODE into STRING beginning at START."]) (defalias 'tar-header-block-summarize #[(tar-hblock &optional mod-p) "HHHHHHHHHHH\f \\S\\\\\\G p\fG\\q\\\\\"!H\"!#䂉I!\"=\"= \"= \"= \"= \"= \"= \"= \"= \"= \"= \"= I!#GU$!&GU7!9!SG^6767Wq!6ZG6ZZHI6T6O*!TISG^6767W!\\6\\6HI6T6*G^6767W!6ZG6ZZHI6T6*G6767W!6\\6HI6T6* = =r6767WC!G6\\\\\\ U456HI6T6*\fG6767Wq!G6\\\\\\\f6HI6T6N*!G!%!." [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 datew slash lastdigit 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 i _dotimes_end_ 47 "==>" "-->" put-text-property mouse-face highlight] 13 "\ Returns a line similar to the output of `tar -vtf'."]) (defalias 'tar-summarize-buffer #[nil "! Z]ɥ]\n  = \\{! \\ \n\" = K! H=X \\ HWn H#  B B HV ىS\"\"\\\\))! -eb@  A!!!A))!`$$}!*!" [message "parsing tar file..." nil result 1 pos buffer-size 1024 bs 100 bs100 tokens empty-tar-block 512 hblock tar-header-block-tokenize "parsing tar file...%s%%" error "premature EOF parsing tar file" 7 20 4 size 0 "%s has size %s - corrupted" ash -9 9 make-local-variable tar-parse-info buffer-read-only _dolist_iterator_ tar-desc insert-string tar-header-block-summarize "\n" tar-header-offset set-buffer-modified-p "parsing tar file...done."] 6 "\ 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)."]) (defvar tar-mode-map nil "\ *Local keymap for Tar mode listings.") (byte-code " !########################!B#####!B###@#ABB!B#CD#EF#GH#IJ#KL#MN#OPQR#OSQR#" [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-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) (defalias 'tar-mode #[nil " !!!!!\n\f!!~!A\nA\n}D !" [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 tar-mode major-mode "Tar" mode-name use-local-map tar-mode-map auto-save-mode 0 boundp 1 tar-summarize-buffer run-hooks tar-mode-hook] 2 "\ 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-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 "\ Minor mode for editing an element of a tar-file. This mode redefines C-x C-s to save the current buffer back into its associated tar-file buffer. You must save that buffer to actually save your changes to disk." "P"]) (byte-code "\"\"\"" [defalias tar-mode-revert #[(&optional no-autosave no-confirm) " \"~) " [nil tar-header-offset revert-buffer-function revert-buffer t no-confirm tar-mode] 3] tar-next-line #[(p) "ym?\nu" [p 36] 1 nil "p"] tar-previous-line #[(p) " [!" [tar-next-line p] 2 nil "p"]] 3) (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 "\ Return the tar-descriptor of the current line, or signals an error."]) (defalias (quote 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]) (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 "\ Extract a file whose tar directory line you click on." "e"]) (defalias 'tar-extract #[(&optional other-window-p) "= AH H \f@\n\\\\\f \\ p !!R=\n!!ݎ~q\f #bQ!! !!!%\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 ":" set-visited-file-name 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 "\ In Tar mode, extract this entry of the tar file into its own buffer." nil]) (defalias 'tar-extract-other-window #[nil "!" [tar-extract t] 2 "\ *In Tar mode, find this entry of the tar file in another window." nil]) (defalias 'tar-display-other-window #[nil "!" [tar-extract display] 2 "\ *In Tar mode, display this entry of the tar file in another window." nil]) (defalias 'tar-view #[nil "!" [tar-extract view] 2 "\ *In Tar mode, view the tar file entry on this line." nil]) (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 "\ Read a file name with this line's entry as the default."]) (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 "\ *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." (list (tar-read-file-name))]) (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 "\ *In Tar mode, mark this sub-file to be deleted from the tar file. With a prefix argument, mark that many files." "p"]) (defalias 'tar-unflag #[(p) " \"" [tar-flag-deleted p t] 3 "\ *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." "p"]) (defalias 'tar-unflag-backwards #[(p) " [\"" [tar-flag-deleted p t] 3 "\ *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." "p"]) (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 "\ Expunge the tar-entry specified by the current line."]) (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 expunged. Be sure to save this buffer."] 3 "\ *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." nil]) (defalias 'tar-clear-modification-flags #[nil "b` W!!cy)" [0 tar-header-offset looking-at "*" delete-char 1 " "] 2 "\ Remove the stars at the beginning of each line."]) (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 "\ *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." (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)))))]) (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 "\ *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." (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)))))]) (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 "\ *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." (list (read-string "New name: " (tar-header-name (tar-desc-tokens (tar-current-descriptor)))))]) (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 "\ *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." (list (tar-parse-octal-integer-safe (read-string "New protection (octal): ")))]) (byte-code "\"\"" [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] 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]] 3) (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` :; B!" [defalias tar-mode-maybe-write-tar-file #[nil "=%!% %Ď ~ T%*ʇ" [major-mode tar-mode boundp tar-header-offset ((narrow-to-region 1 tar-header-offset)) tar-clear-modification-flags write-region buffer-size buffer-file-name nil t] 6] write-file-hooks provide tar-mode] 3)