| 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))))) |
|---|
| | 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 | |
|---|