Show
Ignore:
Timestamp:
05/01/07 18:04:59 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs_22_BASE.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/arc-mode.el

    r4190 r4204  
    701701                              (or buffer-file-name (buffer-name)))) 
    702702           'arc) 
     703          ;; This pattern modelled on the BSD/GNU+Linux `file' command. 
     704          ;; Have seen capital "LHA's", and file has lower case "LHa's" too. 
     705          ;; Note this regexp is also in archive-exe-p. 
     706          ((looking-at "MZ\\(.\\|\n\\)\\{34\\}LH[aA]'s SFX ") 'lzh-exe) 
    703707          (t (error "Buffer format not recognized"))))) 
    704708;; ------------------------------------------------------------------------- 
     
    13991403;; Section: Lzh Archives 
    14001404 
    1401 (defun archive-lzh-summarize (
    1402   (let ((p 1) 
     1405(defun archive-lzh-summarize (&optional start
     1406  (let ((p (or start 1)) ;; 1 for .lzh, something further on for .exe 
    14031407        (totalsize 0) 
    14041408        (maxlen 8) 
     
    14161420             (hdrlvl  (char-after (+ p 20))) ;header level 
    14171421             thsize             ;total header size (base + extensions) 
    1418              fnlen efnname fiddle ifnname width p2 
     1422             fnlen efnname osid fiddle ifnname width p2 
    14191423             neh        ;beginning of next extension header (level 1 and 2) 
    14201424             mode modestr uid gid text dir prname 
     
    14751479        (if (= hdrlvl 0)  ;total header size 
    14761480            (setq thsize hsize)) 
    1477         (setq fiddle  (if efnname (string= efnname (upcase efnname)))) 
     1481        ;; OS ID field not present in level 0 header, use code 0 "generic" 
     1482        ;; in that case as per lha program header.c get_header() 
     1483        (setq osid (cond ((= hdrlvl 0)  0) 
     1484                         ((= hdrlvl 1)  (char-after (+ p 22 fnlen 2))) 
     1485                         ((= hdrlvl 2)  (char-after (+ p 23))))) 
     1486        ;; Filename fiddling must follow the lha program, otherwise the name 
     1487        ;; passed to "lha pq" etc won't match (which for an extract silently 
     1488        ;; results in no output).  As of version 1.14i it goes from the OS ID, 
     1489        ;; - For 'M' MSDOS: msdos_to_unix_filename() downcases always, and 
     1490        ;;   converts "\" to "/". 
     1491        ;; - For 0 generic: generic_to_unix_filename() downcases if there's 
     1492        ;;   no lower case already present, and converts "\" to "/". 
     1493        ;; - For 'm' MacOS: macos_to_unix_filename() changes "/" to ":" and 
     1494        ;;   ":" to "/" 
     1495        (setq fiddle (cond ((= ?M osid) t) 
     1496                           ((= 0 osid)  (string= efnname (upcase efnname))))) 
    14781497        (setq ifnname (if fiddle (downcase efnname) efnname)) 
    14791498        (setq prname (if dir (concat dir ifnname) ifnname)) 
     
    16071626   (lambda (old) (archive-calc-mode old newmode t)) 
    16081627   files "a unix-style mode" 8)) 
     1628 
     1629;; ------------------------------------------------------------------------- 
     1630;; Section: Lzh Self-Extracting .exe Archives 
     1631;; 
     1632;; No support for modifying these files.  It looks like the lha for unix 
     1633;; program (as of version 1.14i) can't create or retain the DOS exe part. 
     1634;; If you do an "lha a" on a .exe for instance it renames and writes to a 
     1635;; plain .lzh. 
     1636 
     1637(defun archive-lzh-exe-summarize () 
     1638  "Summarize the contents of an LZH self-extracting exe, for `archive-mode'." 
     1639 
     1640  ;; Skip the initial executable code part and apply archive-lzh-summarize 
     1641  ;; to the archive part proper.  The "-lh5-" etc regexp here for the start 
     1642  ;; is the same as in archive-find-type. 
     1643  ;; 
     1644  ;; The lha program (version 1.14i) does this in skip_msdos_sfx1_code() by 
     1645  ;; a similar scan.  It looks for "..-l..-" plus for level 0 or 1 a test of 
     1646  ;; the header checksum, or level 2 a test of the "attribute" and size. 
     1647  ;; 
     1648  (re-search-forward "..-l[hz][0-9ds]-" nil) 
     1649  (archive-lzh-summarize (match-beginning 0))) 
     1650 
     1651;; `archive-lzh-extract' runs "lha pq", and that works for .exe as well as 
     1652;; .lzh files 
     1653(defalias 'archive-lzh-exe-extract 'archive-lzh-extract 
     1654  "Extract a member from an LZH self-extracting exe, for `archive-mode'.") 
     1655 
    16091656;; ------------------------------------------------------------------------- 
    16101657;; Section: Zip Archives