home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: SHell self-extracting ARchive
(archive/shar).
You can browse this item here: 2594
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Newsgroup Content (archive/news)
| magic
| Supported |
100%
| dexvert
| SHell self-extracting ARchive (archive/shar)
| magic
| Supported |
100%
| dexvert
| Internet Message Format (text/imf)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| news or mail, ASCII text
| default
| |
100%
| TrID
| E-Mail message (Var. 2)
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/329 Shell Archive Format
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| xdgMime
| message/rfc822
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 46 72 6f 6d 3a 20 67 6f | 65 72 40 71 75 61 64 73 |From: go|er@quads|
|00000010| 2e 75 63 68 69 63 61 67 | 6f 2e 65 64 75 20 28 52 |.uchicag|o.edu (R|
|00000020| 69 63 68 61 72 64 20 4c | 2e 20 47 6f 65 72 77 69 |ichard L|. Goerwi|
|00000030| 74 7a 29 0a 4e 65 77 73 | 67 72 6f 75 70 73 3a 20 |tz).News|groups: |
|00000040| 61 6c 74 2e 73 6f 75 72 | 63 65 73 0a 53 75 62 6a |alt.sour|ces.Subj|
|00000050| 65 63 74 3a 20 6d 74 66 | 2c 20 70 61 72 74 20 31 |ect: mtf|, part 1|
|00000060| 20 6f 66 20 32 0a 4d 65 | 73 73 61 67 65 2d 49 44 | of 2.Me|ssage-ID|
|00000070| 3a 20 3c 31 39 39 31 4a | 61 6e 32 31 2e 30 30 30 |: <1991J|an21.000|
|00000080| 36 33 36 2e 33 35 31 38 | 40 6d 69 64 77 61 79 2e |636.3518|@midway.|
|00000090| 75 63 68 69 63 61 67 6f | 2e 65 64 75 3e 0a 44 61 |uchicago|.edu>.Da|
|000000a0| 74 65 3a 20 32 31 20 4a | 61 6e 20 39 31 20 30 30 |te: 21 J|an 91 00|
|000000b0| 3a 30 36 3a 33 36 20 47 | 4d 54 0a 0a 0a 45 76 65 |:06:36 G|MT...Eve|
|000000c0| 72 20 67 65 74 20 61 20 | 74 61 72 20 66 69 6c 65 |r get a |tar file|
|000000d0| 20 73 74 75 66 66 65 64 | 20 77 69 74 68 20 73 6f | stuffed| with so|
|000000e0| 75 72 63 65 20 66 69 6c | 65 73 20 68 61 76 69 6e |urce fil|es havin|
|000000f0| 67 20 31 35 2b 63 68 61 | 72 0a 66 69 6c 65 6e 61 |g 15+cha|r.filena|
|00000100| 6d 65 73 2c 20 61 6e 64 | 20 66 69 6e 64 20 74 68 |mes, and| find th|
|00000110| 61 74 20 79 6f 75 20 68 | 61 76 65 20 74 6f 20 67 |at you h|ave to g|
|00000120| 6f 20 74 68 72 6f 75 67 | 68 20 74 68 65 20 65 6e |o throug|h the en|
|00000130| 74 69 72 65 0a 61 72 63 | 68 69 76 65 2c 20 72 65 |tire.arc|hive, re|
|00000140| 6e 61 6d 69 6e 67 20 61 | 6e 64 20 67 72 65 70 70 |naming a|nd grepp|
|00000150| 69 6e 67 20 74 68 72 6f | 75 67 68 20 73 6f 75 72 |ing thro|ugh sour|
|00000160| 63 65 20 66 69 6c 65 73 | 20 74 6f 20 67 65 74 0a |ce files| to get.|
|00000170| 74 68 69 6e 67 73 20 74 | 6f 20 77 6f 72 6b 3f 0a |things t|o work?.|
|00000180| 0a 54 72 79 20 74 68 69 | 73 2e 0a 0a 2d 52 69 63 |.Try thi|s...-Ric|
|00000190| 68 61 72 64 0a 0a 0a 2d | 2d 2d 2d 20 43 75 74 20 |hard...-|--- Cut |
|000001a0| 48 65 72 65 20 61 6e 64 | 20 66 65 65 64 20 74 68 |Here and| feed th|
|000001b0| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 74 6f 20 73 |e follow|ing to s|
|000001c0| 68 20 2d 2d 2d 2d 0a 23 | 21 2f 62 69 6e 2f 73 68 |h ----.#|!/bin/sh|
|000001d0| 0a 23 20 54 68 69 73 20 | 69 73 20 61 20 73 68 65 |.# This |is a she|
|000001e0| 6c 6c 20 61 72 63 68 69 | 76 65 20 28 70 72 6f 64 |ll archi|ve (prod|
|000001f0| 75 63 65 64 20 62 79 20 | 73 68 61 72 20 33 2e 34 |uced by |shar 3.4|
|00000200| 39 29 0a 23 20 54 6f 20 | 65 78 74 72 61 63 74 20 |9).# To |extract |
|00000210| 74 68 65 20 66 69 6c 65 | 73 20 66 72 6f 6d 20 74 |the file|s from t|
|00000220| 68 69 73 20 61 72 63 68 | 69 76 65 2c 20 73 61 76 |his arch|ive, sav|
|00000230| 65 20 69 74 20 74 6f 20 | 61 20 66 69 6c 65 2c 20 |e it to |a file, |
|00000240| 72 65 6d 6f 76 65 0a 23 | 20 65 76 65 72 79 74 68 |remove.#| everyth|
|00000250| 69 6e 67 20 61 62 6f 76 | 65 20 74 68 65 20 22 21 |ing abov|e the "!|
|00000260| 2f 62 69 6e 2f 73 68 22 | 20 6c 69 6e 65 20 61 62 |/bin/sh"| line ab|
|00000270| 6f 76 65 2c 20 61 6e 64 | 20 74 79 70 65 20 22 73 |ove, and| type "s|
|00000280| 68 20 66 69 6c 65 5f 6e | 61 6d 65 22 2e 0a 23 0a |h file_n|ame"..#.|
|00000290| 23 20 6d 61 64 65 20 30 | 31 2f 32 30 2f 31 39 39 |# made 0|1/20/199|
|000002a0| 31 20 32 33 3a 33 34 20 | 55 54 43 20 62 79 20 67 |1 23:34 |UTC by g|
|000002b0| 6f 65 72 40 73 6f 70 68 | 69 73 74 2e 75 63 68 69 |oer@soph|ist.uchi|
|000002c0| 63 61 67 6f 2e 65 64 75 | 0a 23 20 53 6f 75 72 63 |cago.edu|.# Sourc|
|000002d0| 65 20 64 69 72 65 63 74 | 6f 72 79 20 2f 75 2f 72 |e direct|ory /u/r|
|000002e0| 69 63 68 61 72 64 2f 4d | 74 66 0a 23 0a 23 20 65 |ichard/M|tf.#.# e|
|000002f0| 78 69 73 74 69 6e 67 20 | 66 69 6c 65 73 20 77 69 |xisting |files wi|
|00000300| 6c 6c 20 4e 4f 54 20 62 | 65 20 6f 76 65 72 77 72 |ll NOT b|e overwr|
|00000310| 69 74 74 65 6e 20 75 6e | 6c 65 73 73 20 2d 63 20 |itten un|less -c |
|00000320| 69 73 20 73 70 65 63 69 | 66 69 65 64 0a 23 20 54 |is speci|fied.# T|
|00000330| 68 69 73 20 66 6f 72 6d | 61 74 20 72 65 71 75 69 |his form|at requi|
|00000340| 72 65 73 20 76 65 72 79 | 20 6c 69 74 74 6c 65 20 |res very| little |
|00000350| 69 6e 74 65 6c 6c 69 67 | 65 6e 63 65 20 61 74 20 |intellig|ence at |
|00000360| 75 6e 73 68 61 72 20 74 | 69 6d 65 2e 0a 23 20 22 |unshar t|ime..# "|
|00000370| 69 66 20 74 65 73 74 22 | 2c 20 22 63 61 74 22 2c |if test"|, "cat",|
|00000380| 20 22 72 6d 22 2c 20 22 | 65 63 68 6f 22 2c 20 22 | "rm", "|echo", "|
|00000390| 74 72 75 65 22 2c 20 61 | 6e 64 20 22 73 65 64 22 |true", a|nd "sed"|
|000003a0| 20 6d 61 79 20 62 65 20 | 6e 65 65 64 65 64 2e 0a | may be |needed..|
|000003b0| 23 0a 23 20 54 68 69 73 | 20 69 73 20 70 61 72 74 |#.# This| is part|
|000003c0| 20 31 20 6f 66 20 61 20 | 6d 75 6c 74 69 70 61 72 | 1 of a |multipar|
|000003d0| 74 20 61 72 63 68 69 76 | 65 20 20 20 20 20 20 20 |t archiv|e |
|000003e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000003f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 0a 23 20 | | .# |
|00000400| 64 6f 20 6e 6f 74 20 63 | 6f 6e 63 61 74 65 6e 61 |do not c|oncatena|
|00000410| 74 65 20 74 68 65 73 65 | 20 70 61 72 74 73 2c 20 |te these| parts, |
|00000420| 75 6e 70 61 63 6b 20 74 | 68 65 6d 20 69 6e 20 6f |unpack t|hem in o|
|00000430| 72 64 65 72 20 77 69 74 | 68 20 2f 62 69 6e 2f 73 |rder wit|h /bin/s|
|00000440| 68 20 20 20 20 20 20 20 | 20 0a 23 0a 23 20 54 68 |h | .#.# Th|
|00000450| 69 73 20 73 68 61 72 20 | 63 6f 6e 74 61 69 6e 73 |is shar |contains|
|00000460| 3a 0a 23 20 6c 65 6e 67 | 74 68 20 20 6d 6f 64 65 |:.# leng|th mode|
|00000470| 20 20 20 20 20 20 20 6e | 61 6d 65 0a 23 20 2d 2d | n|ame.# --|
|00000480| 2d 2d 2d 2d 20 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 20 |---- ---|------- |
|00000490| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000004a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000004b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 0a 23 20 20 31 36 |--------|--.# 16|
|000004c0| 37 32 31 20 2d 72 2d 2d | 72 2d 2d 72 2d 2d 20 6d |721 -r--|r--r-- m|
|000004d0| 74 66 2e 69 63 6e 0a 23 | 20 20 20 33 33 34 31 20 |tf.icn.#| 3341 |
|000004e0| 2d 72 77 2d 72 2d 2d 72 | 2d 2d 20 52 45 41 44 4d |-rw-r--r|-- READM|
|000004f0| 45 0a 23 20 20 20 20 36 | 35 39 20 2d 72 77 2d 72 |E.# 6|59 -rw-r|
|00000500| 2d 2d 72 2d 2d 20 4d 61 | 6b 65 66 69 6c 65 2e 64 |--r-- Ma|kefile.d|
|00000510| 69 73 74 0a 23 0a 69 66 | 20 74 65 73 74 20 2d 72 |ist.#.if| test -r|
|00000520| 20 5f 73 68 61 72 5f 73 | 65 71 5f 2e 74 6d 70 3b | _shar_s|eq_.tmp;|
|00000530| 20 74 68 65 6e 0a 09 65 | 63 68 6f 20 27 4d 75 73 | then..e|cho 'Mus|
|00000540| 74 20 75 6e 70 61 63 6b | 20 61 72 63 68 69 76 65 |t unpack| archive|
|00000550| 73 20 69 6e 20 73 65 71 | 75 65 6e 63 65 21 27 0a |s in seq|uence!'.|
|00000560| 09 65 63 68 6f 20 50 6c | 65 61 73 65 20 75 6e 70 |.echo Pl|ease unp|
|00000570| 61 63 6b 20 70 61 72 74 | 20 60 63 61 74 20 5f 73 |ack part| `cat _s|
|00000580| 68 61 72 5f 73 65 71 5f | 2e 74 6d 70 60 20 6e 65 |har_seq_|.tmp` ne|
|00000590| 78 74 0a 09 65 78 69 74 | 20 31 0a 66 69 0a 23 20 |xt..exit| 1.fi.# |
|000005a0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 20 6d 74 |========|===== mt|
|000005b0| 66 2e 69 63 6e 20 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |f.icn ==|========|
|000005c0| 3d 3d 3d 3d 0a 69 66 20 | 74 65 73 74 20 2d 66 20 |====.if |test -f |
|000005d0| 27 6d 74 66 2e 69 63 6e | 27 20 2d 61 20 58 22 24 |'mtf.icn|' -a X"$|
|000005e0| 31 22 20 21 3d 20 58 22 | 2d 63 22 3b 20 74 68 65 |1" != X"|-c"; the|
|000005f0| 6e 0a 09 65 63 68 6f 20 | 27 78 20 2d 20 73 6b 69 |n..echo |'x - ski|
|00000600| 70 70 69 6e 67 20 6d 74 | 66 2e 69 63 6e 20 28 46 |pping mt|f.icn (F|
|00000610| 69 6c 65 20 61 6c 72 65 | 61 64 79 20 65 78 69 73 |ile alre|ady exis|
|00000620| 74 73 29 27 0a 09 72 6d | 20 2d 66 20 5f 73 68 61 |ts)'..rm| -f _sha|
|00000630| 72 5f 77 6e 74 5f 2e 74 | 6d 70 0a 65 6c 73 65 0a |r_wnt_.t|mp.else.|
|00000640| 3e 20 5f 73 68 61 72 5f | 77 6e 74 5f 2e 74 6d 70 |> _shar_|wnt_.tmp|
|00000650| 0a 65 63 68 6f 20 27 78 | 20 2d 20 65 78 74 72 61 |.echo 'x| - extra|
|00000660| 63 74 69 6e 67 20 6d 74 | 66 2e 69 63 6e 20 28 54 |cting mt|f.icn (T|
|00000670| 65 78 74 29 27 0a 73 65 | 64 20 27 73 2f 5e 58 2f |ext)'.se|d 's/^X/|
|00000680| 2f 27 20 3c 3c 20 27 53 | 48 41 52 5f 45 4f 46 27 |/' << 'S|HAR_EOF'|
|00000690| 20 3e 20 27 6d 74 66 2e | 69 63 6e 27 20 26 26 0a | > 'mtf.|icn' &&.|
|000006a0| 58 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |X#######|########|
|000006b0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000006c0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000006d0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000006e0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 0a 58 |########|######.X|
|000006f0| 23 0a 58 23 09 4e 41 4d | 45 3a 09 6d 74 66 33 2e |#.X#.NAM|E:.mtf3.|
|00000700| 69 63 6e 0a 58 23 0a 58 | 23 09 54 49 54 4c 45 3a |icn.X#.X|#.TITLE:|
|00000710| 09 6d 61 70 20 74 61 72 | 20 66 69 6c 65 0a 58 23 |.map tar| file.X#|
|00000720| 0a 58 23 09 41 55 54 48 | 4f 52 3a 09 52 69 63 68 |.X#.AUTH|OR:.Rich|
|00000730| 61 72 64 20 47 6f 65 72 | 77 69 74 7a 0a 58 23 0a |ard Goer|witz.X#.|
|00000740| 58 23 09 56 45 52 53 49 | 4f 4e 3a 20 33 2e 33 0a |X#.VERSI|ON: 3.3.|
|00000750| 58 23 0a 58 23 23 23 23 | 23 23 23 23 23 23 23 23 |X#.X####|########|
|00000760| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000770| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000780| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000790| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000007a0| 23 0a 58 23 0a 58 23 20 | 20 54 68 69 73 20 61 6e |#.X#.X# | This an|
|000007b0| 64 20 66 75 74 75 72 65 | 20 76 65 72 73 69 6f 6e |d future| version|
|000007c0| 73 20 6f 66 20 6d 74 66 | 20 61 72 65 20 68 65 72 |s of mtf| are her|
|000007d0| 65 62 79 20 70 6c 61 63 | 65 64 20 69 6e 20 74 68 |eby plac|ed in th|
|000007e0| 65 20 70 75 62 6c 69 63 | 20 64 6f 6d 61 69 6e 20 |e public| domain |
|000007f0| 2d 52 4c 47 0a 58 23 0a | 58 23 23 23 23 23 23 23 |-RLG.X#.|X#######|
|00000800| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000810| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000820| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000830| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000840| 23 23 23 23 23 23 0a 58 | 23 0a 58 23 20 20 50 55 |######.X|#.X# PU|
|00000850| 52 50 4f 53 45 3a 20 4d | 61 70 73 20 31 35 2b 20 |RPOSE: M|aps 15+ |
|00000860| 63 68 61 72 2e 20 66 69 | 6c 65 6e 61 6d 65 73 20 |char. fi|lenames |
|00000870| 69 6e 20 61 20 74 61 72 | 20 61 72 63 68 69 76 65 |in a tar| archive|
|00000880| 20 74 6f 20 31 34 20 63 | 68 61 72 73 2e 0a 58 23 | to 14 c|hars..X#|
|00000890| 20 20 48 61 6e 64 6c 65 | 73 20 62 6f 74 68 20 68 | Handle|s both h|
|000008a0| 65 61 64 65 72 20 62 6c | 6f 63 6b 73 20 61 6e 64 |eader bl|ocks and|
|000008b0| 20 74 68 65 20 61 72 63 | 68 69 76 65 20 69 74 73 | the arc|hive its|
|000008c0| 65 6c 66 2e 20 20 4d 74 | 66 20 69 73 20 69 6e 74 |elf. Mt|f is int|
|000008d0| 65 6e 64 65 64 0a 58 23 | 20 20 74 6f 20 66 61 63 |ended.X#| to fac|
|000008e0| 69 6c 69 74 61 74 65 20 | 69 6e 73 74 61 6c 6c 61 |ilitate |installa|
|000008f0| 74 69 6f 6e 20 6f 66 20 | 74 61 72 27 64 20 61 72 |tion of |tar'd ar|
|00000900| 63 68 69 76 65 73 20 6f | 6e 20 73 79 73 74 65 6d |chives o|n system|
|00000910| 73 20 73 75 62 6a 65 63 | 74 20 74 6f 0a 58 23 20 |s subjec|t to.X# |
|00000920| 20 74 68 65 20 53 79 73 | 74 65 6d 20 56 20 31 34 | the Sys|tem V 14|
|00000930| 2d 63 68 61 72 61 63 74 | 65 72 20 66 69 6c 65 6e |-charact|er filen|
|00000940| 61 6d 65 20 6c 69 6d 69 | 74 2e 0a 58 23 0a 58 23 |ame limi|t..X#.X#|
|00000950| 20 20 55 53 41 47 45 3a | 20 20 6d 74 66 20 69 6e | USAGE:| mtf in|
|00000960| 70 75 74 66 69 6c 65 20 | 5b 2d 72 20 72 65 70 6f |putfile |[-r repo|
|00000970| 72 74 66 69 6c 65 5d 20 | 5b 2d 65 20 2e 65 78 74 |rtfile] |[-e .ext|
|00000980| 65 6e 73 69 6f 6e 73 5d | 20 5b 2d 78 20 65 78 63 |ensions]| [-x exc|
|00000990| 65 70 74 69 6f 6e 73 5d | 0a 58 23 0a 58 23 20 20 |eptions]|.X#.X# |
|000009a0| 22 49 6e 70 75 74 66 69 | 6c 65 22 20 69 73 20 61 |"Inputfi|le" is a|
|000009b0| 20 74 61 72 20 61 72 63 | 68 69 76 65 2e 20 20 22 | tar arc|hive. "|
|000009c0| 52 65 70 6f 72 74 66 69 | 6c 65 22 20 69 73 20 66 |Reportfi|le" is f|
|000009d0| 69 6c 65 20 63 6f 6e 74 | 61 69 6e 69 6e 67 20 61 |ile cont|aining a|
|000009e0| 0a 58 23 20 20 6c 69 73 | 74 20 6f 66 20 66 69 6c |.X# lis|t of fil|
|000009f0| 65 73 20 61 6c 72 65 61 | 64 79 20 6d 61 70 70 65 |es alrea|dy mappe|
|00000a00| 64 20 62 79 20 6d 74 66 | 20 69 6e 20 61 20 70 72 |d by mtf| in a pr|
|00000a10| 65 76 69 6f 75 73 20 72 | 75 6e 20 28 75 73 65 64 |evious r|un (used|
|00000a20| 20 74 6f 0a 58 23 20 20 | 61 76 6f 69 64 20 63 6c | to.X# |avoid cl|
|00000a30| 61 73 68 65 73 20 77 69 | 74 68 20 66 69 6c 65 6e |ashes wi|th filen|
|00000a40| 61 6d 65 73 20 69 6e 20 | 75 73 65 20 6f 75 74 73 |ames in |use outs|
|00000a50| 69 64 65 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 |ide the |current |
|00000a60| 61 72 63 68 69 76 65 29 | 2e 0a 58 23 20 20 54 68 |archive)|..X# Th|
|00000a70| 65 20 2d 65 20 73 77 69 | 74 63 68 20 70 72 65 63 |e -e swi|tch prec|
|00000a80| 65 64 65 73 20 61 20 6c | 69 73 74 20 6f 66 20 66 |edes a l|ist of f|
|00000a90| 69 6c 65 6e 61 6d 65 20 | 2e 65 78 74 65 6e 73 69 |ilename |.extensi|
|00000aa0| 6f 6e 73 20 77 68 69 63 | 68 20 6d 74 66 20 69 73 |ons whic|h mtf is|
|00000ab0| 0a 58 23 20 20 73 75 70 | 70 6f 73 65 64 20 74 6f |.X# sup|posed to|
|00000ac0| 20 6c 65 61 76 65 20 75 | 6e 73 63 61 74 68 65 64 | leave u|nscathed|
|00000ad0| 20 62 79 20 74 68 65 20 | 6d 61 70 70 69 6e 67 20 | by the |mapping |
|00000ae0| 70 72 6f 63 65 73 73 0a | 58 23 20 20 28 73 69 6e |process.|X# (sin|
|00000af0| 67 6c 65 2d 63 68 61 72 | 61 63 74 65 72 20 65 78 |gle-char|acter ex|
|00000b00| 74 65 6e 73 69 6f 6e 73 | 20 73 75 63 68 20 61 73 |tensions| such as|
|00000b10| 20 2e 63 20 61 6e 64 20 | 2e 6f 20 61 72 65 20 61 | .c and |.o are a|
|00000b20| 75 74 6f 6d 61 74 69 63 | 61 6c 6c 79 0a 58 23 20 |utomatic|ally.X# |
|00000b30| 20 70 72 65 73 65 72 76 | 65 64 3b 20 2d 65 20 61 | preserv|ed; -e a|
|00000b40| 6c 6c 6f 77 73 20 74 68 | 65 20 75 73 65 72 20 74 |llows th|e user t|
|00000b50| 6f 20 73 70 65 63 69 66 | 79 20 61 64 64 69 74 69 |o specif|y additi|
|00000b60| 6f 6e 61 6c 20 65 78 74 | 65 6e 73 69 6f 6e 73 2c |onal ext|ensions,|
|00000b70| 0a 58 23 20 20 73 75 63 | 68 20 61 73 20 2e 70 78 |.X# suc|h as .px|
|00000b80| 6c 2c 20 2e 63 70 69 2c | 20 61 6e 64 20 2e 69 63 |l, .cpi,| and .ic|
|00000b90| 6e 29 2e 20 20 54 68 65 | 20 66 69 6e 61 6c 20 73 |n). The| final s|
|00000ba0| 77 69 74 63 68 2c 20 2d | 78 2c 20 70 72 65 63 65 |witch, -|x, prece|
|00000bb0| 64 65 73 20 61 0a 58 23 | 20 20 6c 69 73 74 20 6f |des a.X#| list o|
|00000bc0| 66 20 73 74 72 69 6e 67 | 73 20 77 68 69 63 68 20 |f string|s which |
|00000bd0| 73 68 6f 75 6c 64 20 6e | 6f 74 20 62 65 20 6d 61 |should n|ot be ma|
|00000be0| 70 70 65 64 20 61 74 20 | 61 6c 6c 2e 20 20 55 73 |pped at |all. Us|
|00000bf0| 65 20 74 68 69 73 20 73 | 77 69 74 63 68 0a 58 23 |e this s|witch.X#|
|00000c00| 20 20 69 66 2c 20 73 61 | 79 2c 20 79 6f 75 20 68 | if, sa|y, you h|
|00000c10| 61 76 65 20 61 20 43 20 | 66 69 6c 65 20 77 69 74 |ave a C |file wit|
|00000c20| 68 20 61 20 73 74 72 75 | 63 74 75 72 65 2e 66 69 |h a stru|cture.fi|
|00000c30| 65 6c 64 20 63 6f 6d 62 | 69 6e 61 74 69 6f 6e 20 |eld comb|ination |
|00000c40| 73 75 63 68 0a 58 23 20 | 20 61 73 20 22 74 68 69 |such.X# | as "thi|
|00000c50| 73 69 73 76 65 72 79 76 | 65 72 79 62 69 67 2e 68 |sisveryv|erybig.h|
|00000c60| 61 73 68 70 74 72 22 20 | 69 6e 20 61 6e 20 61 72 |ashptr" |in an ar|
|00000c70| 63 68 69 76 65 20 74 68 | 61 74 20 63 6f 6e 74 61 |chive th|at conta|
|00000c80| 69 6e 73 20 61 20 66 69 | 6c 65 0a 58 23 20 20 63 |ins a fi|le.X# c|
|00000c90| 61 6c 6c 65 64 20 22 74 | 68 69 73 69 73 76 65 72 |alled "t|hisisver|
|00000ca0| 79 76 65 72 79 62 69 67 | 2e 68 2c 22 20 61 6e 64 |yverybig|.h," and|
|00000cb0| 20 79 6f 75 20 77 61 6e | 74 20 74 6f 20 61 76 6f | you wan|t to avo|
|00000cc0| 69 64 20 6d 61 70 70 69 | 6e 67 20 74 68 61 74 0a |id mappi|ng that.|
|00000cd0| 58 23 20 20 70 6f 72 74 | 69 6f 6e 20 6f 66 20 74 |X# port|ion of t|
|00000ce0| 68 65 20 73 74 72 75 63 | 74 20 6e 61 6d 65 20 77 |he struc|t name w|
|00000cf0| 68 69 63 68 20 6d 61 74 | 63 68 65 73 20 74 68 65 |hich mat|ches the|
|00000d00| 20 6e 61 6d 65 20 6f 66 | 20 74 68 65 20 6f 76 65 | name of| the ove|
|00000d10| 72 6c 6f 6e 67 0a 58 23 | 20 20 66 69 6c 65 20 28 |rlong.X#| file (|
|00000d20| 74 6f 20 77 69 74 2c 20 | 22 6d 74 66 20 69 6e 70 |to wit, |"mtf inp|
|00000d30| 75 74 66 69 6c 65 20 2d | 78 20 74 68 69 73 69 73 |utfile -|x thisis|
|00000d40| 76 65 72 79 76 65 72 79 | 62 69 67 2e 68 61 73 68 |veryvery|big.hash|
|00000d50| 70 74 72 22 29 2e 20 20 | 54 6f 0a 58 23 20 20 70 |ptr"). |To.X# p|
|00000d60| 72 65 76 65 6e 74 20 6d | 61 70 70 69 6e 67 20 6f |revent m|apping o|
|00000d70| 66 20 61 6e 79 20 73 74 | 72 69 6e 67 20 28 69 6e |f any st|ring (in|
|00000d80| 63 6c 75 64 69 6e 67 20 | 6f 76 65 72 6c 6f 6e 67 |cluding |overlong|
|00000d90| 20 66 69 6c 65 6e 61 6d | 65 73 29 20 62 65 67 69 | filenam|es) begi|
|00000da0| 6e 2d 0a 58 23 20 20 6e | 69 6e 67 2c 20 73 61 79 |n-.X# n|ing, say|
|00000db0| 2c 20 77 69 74 68 20 22 | 74 68 69 73 69 73 76 65 |, with "|thisisve|
|00000dc0| 72 79 2c 22 20 75 73 65 | 20 22 6d 74 66 20 69 6e |ry," use| "mtf in|
|00000dd0| 70 75 74 66 69 6c 65 20 | 2d 78 20 74 68 69 73 69 |putfile |-x thisi|
|00000de0| 73 76 65 72 79 2e 22 0a | 58 23 20 20 42 65 20 63 |svery.".|X# Be c|
|00000df0| 61 72 65 66 75 6c 20 77 | 69 74 68 20 74 68 69 73 |areful w|ith this|
|00000e00| 20 6f 70 74 69 6f 6e 2c | 20 6f 72 20 79 6f 75 20 | option,| or you |
|00000e10| 6d 69 67 68 74 20 65 6e | 64 20 75 70 20 64 65 66 |might en|d up def|
|00000e20| 65 61 74 69 6e 67 20 74 | 68 65 0a 58 23 20 20 77 |eating t|he.X# w|
|00000e30| 68 6f 6c 65 20 70 6f 69 | 6e 74 20 6f 66 20 75 73 |hole poi|nt of us|
|00000e40| 69 6e 67 20 6d 74 66 20 | 69 6e 20 74 68 65 20 66 |ing mtf |in the f|
|00000e50| 69 72 73 74 20 70 6c 61 | 63 65 2e 0a 58 23 0a 58 |irst pla|ce..X#.X|
|00000e60| 23 20 20 4f 55 54 50 55 | 54 20 46 4f 52 4d 41 54 |# OUTPU|T FORMAT|
|00000e70| 3a 20 20 4d 74 66 20 77 | 72 69 74 65 73 20 61 20 |: Mtf w|rites a |
|00000e80| 6d 61 70 70 65 64 20 74 | 61 72 20 61 72 63 68 69 |mapped t|ar archi|
|00000e90| 76 65 20 74 6f 20 74 68 | 65 20 73 74 64 6f 75 74 |ve to th|e stdout|
|00000ea0| 2e 0a 58 23 20 20 57 68 | 65 6e 20 66 69 6e 69 73 |..X# Wh|en finis|
|00000eb0| 68 65 64 2c 20 69 74 20 | 6c 65 61 76 65 73 20 61 |hed, it |leaves a|
|00000ec0| 20 66 69 6c 65 20 63 61 | 6c 6c 65 64 20 22 6d 61 | file ca|lled "ma|
|00000ed0| 70 2e 72 65 70 6f 72 74 | 22 20 69 6e 20 74 68 65 |p.report|" in the|
|00000ee0| 20 63 75 72 72 65 6e 74 | 0a 58 23 20 20 64 69 72 | current|.X# dir|
|00000ef0| 65 63 74 6f 72 79 20 77 | 68 69 63 68 20 72 65 63 |ectory w|hich rec|
|00000f00| 6f 72 64 73 20 77 68 61 | 74 20 66 69 6c 65 6e 61 |ords wha|t filena|
|00000f10| 6d 65 73 20 77 65 72 65 | 20 6d 61 70 70 65 64 20 |mes were| mapped |
|00000f20| 61 6e 64 20 68 6f 77 2e | 20 20 52 65 6e 61 6d 65 |and how.| Rename|
|00000f30| 0a 58 23 20 20 61 6e 64 | 20 73 61 76 65 20 74 68 |.X# and| save th|
|00000f40| 69 73 20 66 69 6c 65 2c | 20 61 6e 64 20 75 73 65 |is file,| and use|
|00000f50| 20 69 74 20 61 73 20 74 | 68 65 20 22 72 65 70 6f | it as t|he "repo|
|00000f60| 72 74 66 69 6c 65 22 20 | 61 72 67 75 6d 65 6e 74 |rtfile" |argument|
|00000f70| 20 74 6f 20 61 6e 79 0a | 58 23 20 20 73 75 62 73 | to any.|X# subs|
|00000f80| 65 71 75 65 6e 74 20 72 | 75 6e 73 20 6f 66 20 6d |equent r|uns of m|
|00000f90| 74 66 20 69 6e 20 74 68 | 69 73 20 73 61 6d 65 20 |tf in th|is same |
|00000fa0| 64 69 72 65 63 74 6f 72 | 79 2e 20 20 45 76 65 6e |director|y. Even|
|00000fb0| 20 69 66 20 79 6f 75 20 | 64 6f 6e 27 74 0a 58 23 | if you |don't.X#|
|00000fc0| 20 20 70 6c 61 6e 20 74 | 6f 20 72 75 6e 20 6d 74 | plan t|o run mt|
|00000fd0| 66 20 61 67 61 69 6e 2c | 20 74 68 69 73 20 66 69 |f again,| this fi|
|00000fe0| 6c 65 20 73 68 6f 75 6c | 64 20 73 74 69 6c 6c 20 |le shoul|d still |
|00000ff0| 62 65 20 65 78 61 6d 69 | 6e 65 64 2c 20 6a 75 73 |be exami|ned, jus|
|00001000| 74 20 74 6f 0a 58 23 20 | 20 62 65 20 73 75 72 65 |t to.X# | be sure|
|00001010| 20 74 68 61 74 20 74 68 | 65 20 6e 65 77 20 66 69 | that th|e new fi|
|00001020| 6c 65 6e 61 6d 65 73 20 | 61 72 65 20 61 63 63 65 |lenames |are acce|
|00001030| 70 74 61 62 6c 65 2c 20 | 61 6e 64 20 74 6f 20 73 |ptable, |and to s|
|00001040| 65 65 20 69 66 0a 58 23 | 20 20 70 65 72 68 61 70 |ee if.X#| perhap|
|00001050| 73 20 61 64 64 69 74 69 | 6f 6e 61 6c 20 2e 65 78 |s additi|onal .ex|
|00001060| 74 65 6e 73 69 6f 6e 73 | 20 61 6e 64 2f 6f 72 20 |tensions| and/or |
|00001070| 65 78 63 65 70 74 69 6f | 6e 73 20 73 68 6f 75 6c |exceptio|ns shoul|
|00001080| 64 20 62 65 0a 58 23 20 | 20 73 70 65 63 69 66 69 |d be.X# | specifi|
|00001090| 65 64 2e 0a 58 23 0a 58 | 23 20 20 42 55 47 53 3a |ed..X#.X|# BUGS:|
|000010a0| 20 20 4d 74 66 20 6f 6e | 6c 79 20 6d 61 70 73 20 | Mtf on|ly maps |
|000010b0| 66 69 6c 65 6e 61 6d 65 | 73 20 66 6f 75 6e 64 20 |filename|s found |
|000010c0| 69 6e 20 74 68 65 20 6d | 61 69 6e 20 74 61 72 20 |in the m|ain tar |
|000010d0| 68 65 61 64 65 72 73 2e | 0a 58 23 20 20 42 65 63 |headers.|.X# Bec|
|000010e0| 61 75 73 65 20 6f 66 20 | 74 68 69 73 2c 20 6d 74 |ause of |this, mt|
|000010f0| 66 20 63 61 6e 6e 6f 74 | 20 61 63 63 65 70 74 20 |f cannot| accept |
|00001100| 6e 65 73 74 65 64 20 74 | 61 72 20 61 72 63 68 69 |nested t|ar archi|
|00001110| 76 65 73 2e 20 20 49 66 | 20 79 6f 75 20 74 72 79 |ves. If| you try|
|00001120| 0a 58 23 20 20 74 6f 20 | 6d 61 70 20 61 20 74 61 |.X# to |map a ta|
|00001130| 72 20 61 72 63 68 69 76 | 65 20 77 69 74 68 69 6e |r archiv|e within|
|00001140| 20 61 20 74 61 72 20 66 | 69 6c 65 2c 20 6d 74 66 | a tar f|ile, mtf|
|00001150| 20 77 69 6c 6c 20 61 62 | 6f 72 74 20 77 69 74 68 | will ab|ort with|
|00001160| 20 61 20 6e 61 73 74 79 | 0a 58 23 20 20 6d 65 73 | a nasty|.X# mes|
|00001170| 73 61 67 65 20 61 62 6f | 75 74 20 73 63 72 65 77 |sage abo|ut screw|
|00001180| 69 6e 67 20 75 70 20 79 | 6f 75 72 20 66 69 6c 65 |ing up y|our file|
|00001190| 73 2e 20 20 50 6c 65 61 | 73 65 20 6e 6f 74 65 20 |s. Plea|se note |
|000011a0| 74 68 61 74 2c 20 75 6e | 6c 65 73 73 20 79 6f 75 |that, un|less you|
|000011b0| 0a 58 23 20 20 67 69 76 | 65 20 6d 74 66 20 61 20 |.X# giv|e mtf a |
|000011c0| 22 72 65 70 6f 72 74 66 | 69 6c 65 22 20 74 6f 20 |"reportf|ile" to |
|000011d0| 63 6f 6e 73 69 64 65 72 | 2c 20 69 74 20 6b 6e 6f |consider|, it kno|
|000011e0| 77 73 20 6e 6f 74 68 69 | 6e 67 20 61 62 6f 75 74 |ws nothi|ng about|
|000011f0| 20 66 69 6c 65 73 0a 58 | 23 20 20 65 78 69 73 74 | files.X|# exist|
|00001200| 69 6e 67 20 6f 75 74 73 | 69 64 65 20 74 68 65 20 |ing outs|ide the |
|00001210| 61 72 63 68 69 76 65 2e | 20 20 48 65 6e 63 65 2c |archive.| Hence,|
|00001220| 20 69 66 20 61 6e 20 69 | 6e 70 75 74 20 61 72 63 | if an i|nput arc|
|00001230| 68 69 76 65 20 72 65 66 | 65 72 73 20 74 6f 0a 58 |hive ref|ers to.X|
|00001240| 23 20 20 61 6e 20 6f 76 | 65 72 6c 6f 6e 67 20 66 |# an ov|erlong f|
|00001250| 69 6c 65 6e 61 6d 65 20 | 69 6e 20 61 6e 6f 74 68 |ilename |in anoth|
|00001260| 65 72 20 61 72 63 68 69 | 76 65 2c 20 6d 74 66 20 |er archi|ve, mtf |
|00001270| 6e 61 74 75 72 61 6c 6c | 79 20 77 69 6c 6c 20 6e |naturall|y will n|
|00001280| 6f 74 0a 58 23 20 20 6b | 6e 6f 77 20 74 6f 20 73 |ot.X# k|now to s|
|00001290| 68 6f 72 74 65 6e 20 69 | 74 2e 20 20 4d 74 66 20 |horten i|t. Mtf |
|000012a0| 77 69 6c 6c 2c 20 69 6e | 20 66 61 63 74 2c 20 68 |will, in| fact, h|
|000012b0| 61 76 65 20 6e 6f 20 77 | 61 79 20 6f 66 20 6b 6e |ave no w|ay of kn|
|000012c0| 6f 77 69 6e 67 20 74 68 | 61 74 0a 58 23 20 20 69 |owing th|at.X# i|
|000012d0| 74 20 69 73 20 61 20 66 | 69 6c 65 6e 61 6d 65 2c |t is a f|ilename,|
|000012e0| 20 61 6e 64 20 6e 6f 74 | 2c 20 73 61 79 2c 20 61 | and not|, say, a|
|000012f0| 6e 20 69 64 65 6e 74 69 | 66 69 65 72 20 69 6e 20 |n identi|fier in |
|00001300| 61 20 43 20 70 72 6f 67 | 72 61 6d 2e 0a 58 23 20 |a C prog|ram..X# |
|00001310| 20 46 69 6e 61 6c 20 77 | 6f 72 64 20 6f 66 20 63 | Final w|ord of c|
|00001320| 61 75 74 69 6f 6e 3a 20 | 20 54 72 79 20 6e 6f 74 |aution: | Try not|
|00001330| 20 74 6f 20 75 73 65 20 | 6d 74 66 20 6f 6e 20 62 | to use |mtf on b|
|00001340| 69 6e 61 72 69 65 73 2e | 20 20 49 74 20 63 61 6e |inaries.| It can|
|00001350| 6e 6f 74 0a 58 23 20 20 | 70 6f 73 73 69 62 6c 79 |not.X# |possibly|
|00001360| 20 70 72 65 73 65 72 76 | 65 20 74 68 65 20 63 6f | preserv|e the co|
|00001370| 72 72 65 63 74 20 66 6f | 72 6d 61 74 20 61 6e 64 |rrect fo|rmat and|
|00001380| 20 61 6c 69 67 6e 6d 65 | 6e 74 20 6f 66 20 73 74 | alignme|nt of st|
|00001390| 72 69 6e 67 73 20 69 6e | 20 61 6e 0a 58 23 20 20 |rings in| an.X# |
|000013a0| 65 78 65 63 75 74 61 62 | 6c 65 2e 20 20 53 61 6d |executab|le. Sam|
|000013b0| 65 20 67 6f 65 73 20 66 | 6f 72 20 63 6f 6d 70 72 |e goes f|or compr|
|000013c0| 65 73 73 65 64 20 66 69 | 6c 65 73 2e 20 20 4d 74 |essed fi|les. Mt|
|000013d0| 66 20 63 61 6e 27 74 20 | 6d 61 70 0a 58 23 20 20 |f can't |map.X# |
|000013e0| 66 69 6c 65 6e 61 6d 65 | 73 20 74 68 61 74 20 69 |filename|s that i|
|000013f0| 74 20 63 61 6e 27 74 20 | 72 65 61 64 21 0a 58 23 |t can't |read!.X#|
|00001400| 0a 58 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |.X######|########|
|00001410| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001420| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001430| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001440| 23 23 23 23 23 23 0a 58 | 0a 58 0a 58 67 6c 6f 62 |######.X|.X.Xglob|
|00001450| 61 6c 20 66 69 6c 65 6e | 61 6d 65 74 62 6c 2c 20 |al filen|ametbl, |
|00001460| 63 68 75 6e 6b 73 65 74 | 2c 20 73 68 6f 72 74 5f |chunkset|, short_|
|00001470| 63 68 75 6e 6b 73 65 74 | 20 20 20 23 20 73 65 65 |chunkset| # see|
|00001480| 20 70 72 6f 63 65 64 75 | 72 65 20 6d 61 70 70 69 | procedu|re mappi|
|00001490| 65 63 65 28 73 29 0a 58 | 67 6c 6f 62 61 6c 20 65 |ece(s).X|global e|
|000014a0| 78 74 65 6e 73 69 6f 6e | 73 2c 20 6e 6f 5f 6e 6f |xtension|s, no_no|
|000014b0| 73 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |s | |
|000014c0| 20 20 20 20 20 20 20 23 | 20 64 69 74 74 6f 0a 58 | #| ditto.X|
|000014d0| 0a 58 72 65 63 6f 72 64 | 20 68 62 6c 6f 63 6b 28 |.Xrecord| hblock(|
|000014e0| 6e 61 6d 65 2c 6a 75 6e | 6b 2c 73 69 7a 65 2c 6d |name,jun|k,size,m|
|000014f0| 74 69 6d 65 2c 63 68 6b | 73 75 6d 2c 20 20 20 20 |time,chk|sum, |
|00001500| 20 23 20 74 61 72 20 68 | 65 61 64 65 72 20 73 74 | # tar h|eader st|
|00001510| 72 75 63 74 3b 0a 58 20 | 20 20 20 20 20 20 20 20 |ruct;.X | |
|00001520| 20 20 20 20 20 6c 69 6e | 6b 66 6c 61 67 2c 6c 69 | lin|kflag,li|
|00001530| 6e 6b 6e 61 6d 65 2c 74 | 68 65 72 65 73 74 29 20 |nkname,t|herest) |
|00001540| 20 20 20 20 20 20 23 20 | 73 65 65 20 72 65 61 64 | # |see read|
|00001550| 74 61 72 68 64 72 28 73 | 29 0a 58 0a 58 0a 58 70 |tarhdr(s|).X.X.Xp|
|00001560| 72 6f 63 65 64 75 72 65 | 20 6d 61 69 6e 28 61 29 |rocedure| main(a)|
|00001570| 0a 58 0a 58 20 20 20 20 | 75 73 61 67 65 20 3a 3d |.X.X |usage :=|
|00001580| 20 22 75 73 61 67 65 3a | 20 20 6d 74 66 20 69 6e | "usage:| mtf in|
|00001590| 70 75 74 66 69 6c 65 20 | 5b 2d 72 20 72 65 70 6f |putfile |[-r repo|
|000015a0| 72 74 66 69 6c 65 5d 20 | 22 20 7c 7c 0a 58 09 20 |rtfile] |" ||.X. |
|000015b0| 20 20 20 20 22 5b 2d 65 | 20 2e 65 78 74 65 6e 73 | "[-e| .extens|
|000015c0| 69 6f 6e 73 5d 20 5b 2d | 78 20 65 78 63 65 70 74 |ions] [-|x except|
|000015d0| 69 6f 6e 73 5d 22 0a 58 | 0a 58 20 20 20 20 2a 61 |ions]".X|.X *a|
|000015e0| 20 3d 20 30 20 26 20 73 | 74 6f 70 28 75 73 61 67 | = 0 & s|top(usag|
|000015f0| 65 29 0a 58 0a 58 20 20 | 20 20 69 6e 74 65 78 74 |e).X.X | intext|
|00001600| 20 3a 3d 20 6f 70 65 6e | 5f 69 6e 70 75 74 5f 66 | := open|_input_f|
|00001610| 69 6c 65 28 61 5b 31 5d | 29 20 26 20 70 6f 70 28 |ile(a[1]|) & pop(|
|00001620| 61 29 0a 58 0a 58 20 20 | 20 20 69 20 3a 3d 20 30 |a).X.X | i := 0|
|00001630| 0a 58 20 20 20 20 65 78 | 74 65 6e 73 69 6f 6e 73 |.X ex|tensions|
|00001640| 20 3a 3d 20 5b 5d 3b 20 | 6e 6f 5f 6e 6f 73 20 3a | := []; |no_nos :|
|00001650| 3d 20 5b 5d 0a 58 20 20 | 20 20 77 68 69 6c 65 20 |= [].X | while |
|00001660| 28 69 20 2b 3a 3d 20 31 | 29 20 3c 3d 20 2a 61 20 |(i +:= 1|) <= *a |
|00001670| 64 6f 20 7b 0a 58 09 63 | 61 73 65 20 61 5b 69 5d |do {.X.c|ase a[i]|
|00001680| 20 6f 66 20 7b 0a 58 09 | 20 20 20 20 22 2d 72 22 | of {.X.| "-r"|
|00001690| 20 20 20 20 3a 20 20 20 | 20 72 65 61 64 69 6e 5f | : | readin_|
|000016a0| 6f 6c 64 5f 6d 61 70 5f | 72 65 70 6f 72 74 28 61 |old_map_|report(a|
|000016b0| 5b 69 2b 3a 3d 31 5d 29 | 0a 58 09 20 20 20 20 22 |[i+:=1])|.X. "|
|000016c0| 2d 65 22 20 20 20 20 3a | 20 20 20 20 63 75 72 72 |-e" :| curr|
|000016d0| 65 6e 74 5f 6c 69 73 74 | 20 3a 3d 20 65 78 74 65 |ent_list| := exte|
|000016e0| 6e 73 69 6f 6e 73 0a 58 | 09 20 20 20 20 22 2d 78 |nsions.X|. "-x|
|000016f0| 22 20 20 20 20 3a 20 20 | 20 20 63 75 72 72 65 6e |" : | curren|
|00001700| 74 5f 6c 69 73 74 20 3a | 3d 20 6e 6f 5f 6e 6f 73 |t_list :|= no_nos|
|00001710| 0a 58 09 20 20 20 20 64 | 65 66 61 75 6c 74 20 3a |.X. d|efault :|
|00001720| 20 20 20 20 70 75 74 28 | 63 75 72 72 65 6e 74 5f | put(|current_|
|00001730| 6c 69 73 74 2c 61 5b 69 | 5d 29 0a 58 09 7d 0a 58 |list,a[i|]).X.}.X|
|00001740| 20 20 20 20 7d 0a 58 0a | 58 20 20 20 20 65 76 65 | }.X.|X eve|
|00001750| 72 79 20 21 65 78 74 65 | 6e 73 69 6f 6e 73 20 3f |ry !exte|nsions ?|
|00001760| 3a 3d 20 28 3d 22 2e 22 | 2c 20 74 61 62 28 30 29 |:= (="."|, tab(0)|
|00001770| 29 0a 58 20 20 20 20 0a | 58 20 20 20 20 23 20 52 |).X .|X # R|
|00001780| 75 6e 20 74 68 72 6f 75 | 67 68 20 61 6c 6c 20 74 |un throu|gh all t|
|00001790| 68 65 20 68 65 61 64 65 | 72 73 20 69 6e 20 74 68 |he heade|rs in th|
|000017a0| 65 20 69 6e 70 75 74 20 | 66 69 6c 65 2c 20 66 69 |e input |file, fi|
|000017b0| 6c 6c 69 6e 67 0a 58 20 | 20 20 20 23 20 28 67 6c |lling.X | # (gl|
|000017c0| 6f 62 61 6c 29 20 66 69 | 6c 65 6e 61 6d 65 74 62 |obal) fi|lenametb|
|000017d0| 6c 20 77 69 74 68 20 74 | 68 65 20 6e 61 6d 65 73 |l with t|he names|
|000017e0| 20 6f 66 20 6f 76 65 72 | 6c 6f 6e 67 20 66 69 6c | of over|long fil|
|000017f0| 65 73 3b 0a 58 20 20 20 | 20 23 20 6d 61 6b 65 5f |es;.X | # make_|
|00001800| 74 61 62 6c 65 5f 6f 66 | 5f 66 69 6c 65 6e 61 6d |table_of|_filenam|
|00001810| 65 73 20 66 61 69 6c 73 | 20 69 66 20 74 68 65 72 |es fails| if ther|
|00001820| 65 20 61 72 65 20 6e 6f | 20 73 75 63 68 20 66 69 |e are no| such fi|
|00001830| 6c 65 73 2e 0a 58 20 20 | 20 20 6d 61 6b 65 5f 74 |les..X | make_t|
|00001840| 61 62 6c 65 5f 6f 66 5f | 66 69 6c 65 6e 61 6d 65 |able_of_|filename|
|00001850| 73 28 69 6e 74 65 78 74 | 29 20 7c 20 7b 0a 58 09 |s(intext|) | {.X.|
|00001860| 77 72 69 74 65 28 26 65 | 72 72 6f 75 74 2c 22 6d |write(&e|rrout,"m|
|00001870| 74 66 3a 20 20 6e 6f 20 | 6f 76 65 72 6c 6f 6e 67 |tf: no |overlong|
|00001880| 20 70 61 74 68 20 6e 61 | 6d 65 73 20 74 6f 20 6d | path na|mes to m|
|00001890| 61 70 22 29 20 0a 58 09 | 61 5b 31 5d 20 3f 20 28 |ap") .X.|a[1] ? (|
|000018a0| 74 61 62 28 66 69 6e 64 | 28 22 2e 74 61 72 22 29 |tab(find|(".tar")|
|000018b0| 2b 34 29 2c 20 70 6f 73 | 28 30 29 29 20 7c 0a 58 |+4), pos|(0)) |.X|
|000018c0| 09 20 20 77 72 69 74 65 | 28 26 65 72 72 6f 75 74 |. write|(&errout|
|000018d0| 2c 22 28 49 73 20 22 2c | 61 5b 31 5d 2c 22 20 65 |,"(Is ",|a[1]," e|
|000018e0| 76 65 6e 20 61 20 74 61 | 72 20 61 72 63 68 69 76 |ven a ta|r archiv|
|000018f0| 65 3f 29 22 29 0a 58 20 | 09 65 78 69 74 28 31 29 |e?)").X |.exit(1)|
|00001900| 0a 58 20 20 20 20 7d 20 | 0a 58 0a 58 20 20 20 20 |.X } |.X.X |
|00001910| 23 20 4e 6f 77 20 74 68 | 61 74 20 61 20 74 61 62 |# Now th|at a tab|
|00001920| 6c 65 20 6f 66 20 6f 76 | 65 72 6c 6f 6e 67 20 66 |le of ov|erlong f|
|00001930| 69 6c 65 6e 61 6d 65 73 | 20 65 78 69 73 74 73 2c |ilenames| exists,|
|00001940| 20 67 6f 20 62 61 63 6b | 0a 58 20 20 20 20 23 20 | go back|.X # |
|00001950| 74 68 72 6f 75 67 68 20 | 74 68 65 20 74 65 78 74 |through |the text|
|00001960| 2c 20 72 65 6d 61 70 70 | 69 6e 67 20 61 6c 6c 20 |, remapp|ing all |
|00001970| 6f 63 63 75 72 72 65 6e | 63 65 73 20 6f 66 20 74 |occurren|ces of t|
|00001980| 68 65 73 65 20 6e 61 6d | 65 73 0a 58 20 20 20 20 |hese nam|es.X |
|00001990| 23 20 74 6f 20 6e 65 77 | 2c 20 31 34 2d 63 68 61 |# to new|, 14-cha|
|000019a0| 72 20 76 61 6c 75 65 73 | 3b 20 61 6c 73 6f 2c 20 |r values|; also, |
|000019b0| 72 65 73 65 74 20 68 65 | 61 64 65 72 20 63 68 65 |reset he|ader che|
|000019c0| 63 6b 73 75 6d 73 2c 20 | 61 6e 64 0a 58 20 20 20 |cksums, |and.X |
|000019d0| 20 23 20 72 65 66 6f 72 | 6d 61 74 20 74 65 78 74 | # refor|mat text|
|000019e0| 20 69 6e 74 6f 20 63 6f | 72 72 65 63 74 6c 79 20 | into co|rrectly |
|000019f0| 70 61 64 64 65 64 20 35 | 31 32 2d 62 79 74 65 20 |padded 5|12-byte |
|00001a00| 62 6c 6f 63 6b 73 2e 20 | 20 54 65 72 2d 0a 58 20 |blocks. | Ter-.X |
|00001a10| 20 20 20 23 20 6d 69 6e | 61 74 65 20 6f 75 74 70 | # min|ate outp|
|00001a20| 75 74 20 77 69 74 68 20 | 35 31 32 20 6e 75 6c 6c |ut with |512 null|
|00001a30| 73 2e 0a 58 20 20 20 20 | 73 65 65 6b 28 69 6e 74 |s..X |seek(int|
|00001a40| 65 78 74 2c 31 29 0a 58 | 20 20 20 20 65 76 65 72 |ext,1).X| ever|
|00001a50| 79 20 77 72 69 74 65 73 | 28 6f 75 74 70 75 74 5f |y writes|(output_|
|00001a60| 6d 61 70 70 65 64 5f 68 | 65 61 64 65 72 73 5f 61 |mapped_h|eaders_a|
|00001a70| 6e 64 5f 74 65 78 74 73 | 28 69 6e 74 65 78 74 29 |nd_texts|(intext)|
|00001a80| 29 0a 58 0a 58 20 20 20 | 20 63 6c 6f 73 65 28 69 |).X.X | close(i|
|00001a90| 6e 74 65 78 74 29 0a 58 | 20 20 20 20 77 72 69 74 |ntext).X| writ|
|00001aa0| 65 5f 72 65 70 6f 72 74 | 28 29 20 20 20 23 20 52 |e_report|() # R|
|00001ab0| 65 63 6f 72 64 20 6d 61 | 70 70 65 64 20 66 69 6c |ecord ma|pped fil|
|00001ac0| 65 20 61 6e 64 20 64 69 | 72 20 6e 61 6d 65 73 20 |e and di|r names |
|00001ad0| 66 6f 72 20 66 75 74 75 | 72 65 20 72 65 66 2e 0a |for futu|re ref..|
|00001ae0| 58 20 20 20 20 65 78 69 | 74 28 30 29 0a 58 20 20 |X exi|t(0).X |
|00001af0| 20 20 0a 58 65 6e 64 0a | 58 0a 58 0a 58 0a 58 70 | .Xend.|X.X.X.Xp|
|00001b00| 72 6f 63 65 64 75 72 65 | 20 6f 70 65 6e 5f 69 6e |rocedure| open_in|
|00001b10| 70 75 74 5f 66 69 6c 65 | 28 73 29 0a 58 20 20 20 |put_file|(s).X |
|00001b20| 20 69 6e 74 65 78 74 20 | 3a 3d 20 6f 70 65 6e 28 | intext |:= open(|
|00001b30| 22 22 20 7e 3d 3d 20 73 | 2c 22 72 22 29 20 7c 0a |"" ~== s|,"r") |.|
|00001b40| 58 09 73 74 6f 70 28 22 | 6d 74 66 3a 20 20 63 61 |X.stop("|mtf: ca|
|00001b50| 6e 27 74 20 6f 70 65 6e | 20 22 2c 73 29 0a 58 20 |n't open| ",s).X |
|00001b60| 20 20 20 66 69 6e 64 28 | 22 55 4e 49 58 22 2c 26 | find(|"UNIX",&|
|00001b70| 66 65 61 74 75 72 65 73 | 29 20 7c 0a 58 09 73 74 |features|) |.X.st|
|00001b80| 6f 70 28 22 6d 74 66 3a | 20 20 49 27 6d 20 6e 6f |op("mtf:| I'm no|
|00001b90| 74 20 74 65 73 74 65 64 | 20 6f 6e 20 6e 6f 6e 2d |t tested| on non-|
|00001ba0| 55 6e 69 78 20 73 79 73 | 74 65 6d 73 2e 22 29 0a |Unix sys|tems.").|
|00001bb0| 58 20 20 20 20 73 5b 2d | 32 3a 30 5d 20 3d 3d 20 |X s[-|2:0] == |
|00001bc0| 22 2e 5a 22 20 26 0a 58 | 20 20 20 20 20 20 20 20 |".Z" &.X| |
|00001bd0| 73 74 6f 70 28 22 6d 74 | 66 3a 20 20 73 6f 72 72 |stop("mt|f: sorr|
|00001be0| 79 2c 20 63 61 6e 27 74 | 20 61 63 63 65 70 74 20 |y, can't| accept |
|00001bf0| 63 6f 6d 70 72 65 73 73 | 65 64 20 66 69 6c 65 73 |compress|ed files|
|00001c00| 22 29 0a 58 20 20 20 20 | 72 65 74 75 72 6e 20 69 |").X |return i|
|00001c10| 6e 74 65 78 74 0a 58 65 | 6e 64 0a 58 0a 58 0a 58 |ntext.Xe|nd.X.X.X|
|00001c20| 0a 58 70 72 6f 63 65 64 | 75 72 65 20 72 65 61 64 |.Xproced|ure read|
|00001c30| 69 6e 5f 6f 6c 64 5f 6d | 61 70 5f 72 65 70 6f 72 |in_old_m|ap_repor|
|00001c40| 74 28 73 29 0a 58 0a 58 | 20 20 20 20 69 6e 69 74 |t(s).X.X| init|
|00001c50| 69 61 6c 20 7b 0a 58 09 | 66 69 6c 65 6e 61 6d 65 |ial {.X.|filename|
|00001c60| 74 62 6c 20 3a 3d 20 74 | 61 62 6c 65 28 29 0a 58 |tbl := t|able().X|
|00001c70| 09 63 68 75 6e 6b 73 65 | 74 20 3a 3d 20 73 65 74 |.chunkse|t := set|
|00001c80| 28 29 0a 58 09 73 68 6f | 72 74 5f 63 68 75 6e 6b |().X.sho|rt_chunk|
|00001c90| 73 65 74 20 3a 3d 20 73 | 65 74 28 29 0a 58 20 20 |set := s|et().X |
|00001ca0| 20 20 7d 0a 58 0a 58 20 | 20 20 20 6d 61 70 66 69 | }.X.X | mapfi|
|00001cb0| 6c 65 20 3a 3d 20 6f 70 | 65 6e 5f 69 6e 70 75 74 |le := op|en_input|
|00001cc0| 5f 66 69 6c 65 28 73 29 | 0a 58 20 20 20 20 77 68 |_file(s)|.X wh|
|00001cd0| 69 6c 65 20 6c 69 6e 65 | 20 3a 3d 20 72 65 61 64 |ile line| := read|
|00001ce0| 28 6d 61 70 66 69 6c 65 | 29 20 64 6f 20 7b 0a 58 |(mapfile|) do {.X|
|00001cf0| 09 6c 69 6e 65 20 3f 20 | 7b 09 0a 58 09 20 20 20 |.line ? |{..X. |
|00001d00| 20 69 66 20 63 68 75 6e | 6b 20 3a 3d 20 74 61 62 | if chun|k := tab|
|00001d10| 28 6d 61 6e 79 28 7e 27 | 20 5c 74 27 29 29 20 26 |(many(~'| \t')) &|
|00001d20| 20 74 61 62 28 75 70 74 | 6f 28 7e 27 20 5c 74 27 | tab(upt|o(~' \t'|
|00001d30| 29 29 20 26 0a 58 09 09 | 6c 63 68 75 6e 6b 20 3a |)) &.X..|lchunk :|
|00001d40| 3d 20 6d 6f 76 65 28 31 | 34 29 20 26 20 70 6f 73 |= move(1|4) & pos|
|00001d50| 28 30 29 20 74 68 65 6e | 20 7b 0a 58 09 09 66 69 |(0) then| {.X..fi|
|00001d60| 6c 65 6e 61 6d 65 74 62 | 6c 5b 63 68 75 6e 6b 5d |lenametb|l[chunk]|
|00001d70| 20 3a 3d 20 6c 63 68 75 | 6e 6b 0a 58 09 09 69 6e | := lchu|nk.X..in|
|00001d80| 73 65 72 74 28 63 68 75 | 6e 6b 73 65 74 2c 63 68 |sert(chu|nkset,ch|
|00001d90| 75 6e 6b 29 0a 58 09 09 | 69 6e 73 65 72 74 28 73 |unk).X..|insert(s|
|00001da0| 68 6f 72 74 5f 63 68 75 | 6e 6b 73 65 74 2c 63 68 |hort_chu|nkset,ch|
|00001db0| 75 6e 6b 5b 31 3a 31 36 | 5d 29 0a 58 09 20 20 20 |unk[1:16|]).X. |
|00001dc0| 20 7d 0a 58 09 69 66 20 | 2f 63 68 75 6e 6b 20 7c | }.X.if |/chunk ||
|00001dd0| 20 2f 6c 63 68 75 6e 6b | 0a 58 09 74 68 65 6e 20 | /lchunk|.X.then |
|00001de0| 73 74 6f 70 28 22 6d 74 | 66 3a 20 20 72 65 70 6f |stop("mt|f: repo|
|00001df0| 72 74 20 66 69 6c 65 2c | 20 22 2c 73 2c 22 20 73 |rt file,| ",s," s|
|00001e00| 65 65 6d 73 20 6d 61 6e | 67 6c 65 64 2e 22 29 0a |eems man|gled.").|
|00001e10| 58 09 7d 0a 58 20 20 20 | 20 7d 0a 58 0a 58 65 6e |X.}.X | }.X.Xen|
|00001e20| 64 0a 58 0a 58 0a 58 0a | 58 70 72 6f 63 65 64 75 |d.X.X.X.|Xprocedu|
|00001e30| 72 65 20 6d 61 6b 65 5f | 74 61 62 6c 65 5f 6f 66 |re make_|table_of|
|00001e40| 5f 66 69 6c 65 6e 61 6d | 65 73 28 69 6e 74 65 78 |_filenam|es(intex|
|00001e50| 74 29 0a 58 0a 58 20 20 | 20 20 6c 6f 63 61 6c 20 |t).X.X | local |
|00001e60| 68 65 61 64 65 72 20 23 | 20 63 68 75 6e 6b 73 65 |header #| chunkse|
|00001e70| 74 20 69 73 20 67 6c 6f | 62 61 6c 0a 58 0a 58 20 |t is glo|bal.X.X |
|00001e80| 20 20 20 23 20 73 65 61 | 72 63 68 20 68 65 61 64 | # sea|rch head|
|00001e90| 65 72 73 20 66 6f 72 20 | 6f 76 65 72 6c 6f 6e 67 |ers for |overlong|
|00001ea0| 20 66 69 6c 65 6e 61 6d | 65 73 3b 20 66 6f 72 20 | filenam|es; for |
|00001eb0| 6e 6f 77 0a 58 20 20 20 | 20 23 20 69 67 6e 6f 72 |now.X | # ignor|
|00001ec0| 65 20 65 76 65 72 79 74 | 68 69 6e 67 20 65 6c 73 |e everyt|hing els|
|00001ed0| 65 0a 58 20 20 20 20 77 | 68 69 6c 65 20 68 65 61 |e.X w|hile hea|
|00001ee0| 64 65 72 20 3a 3d 20 72 | 65 61 64 74 61 72 68 64 |der := r|eadtarhd|
|00001ef0| 72 28 72 65 61 64 73 28 | 69 6e 74 65 78 74 2c 35 |r(reads(|intext,5|
|00001f00| 31 32 29 29 20 64 6f 20 | 7b 0a 58 09 23 20 74 61 |12)) do |{.X.# ta|
|00001f10| 62 20 75 70 74 6f 20 74 | 68 65 20 6e 65 78 74 20 |b upto t|he next |
|00001f20| 68 65 61 64 65 72 20 62 | 6c 6f 63 6b 0a 58 09 74 |header b|lock.X.t|
|00001f30| 61 62 5f 6e 78 74 5f 68 | 64 72 28 69 6e 74 65 78 |ab_nxt_h|dr(intex|
|00001f40| 74 2c 74 72 69 6d 5f 73 | 74 72 28 68 65 61 64 65 |t,trim_s|tr(heade|
|00001f50| 72 2e 73 69 7a 65 29 2c | 31 29 0a 58 09 23 20 72 |r.size),|1).X.# r|
|00001f60| 65 63 6f 72 64 20 6f 76 | 65 72 6c 6f 6e 67 20 66 |ecord ov|erlong f|
|00001f70| 69 6c 65 6e 61 6d 65 73 | 20 69 6e 20 73 65 76 65 |ilenames| in seve|
|00001f80| 72 61 6c 20 67 6c 6f 62 | 61 6c 20 74 61 62 6c 65 |ral glob|al table|
|00001f90| 73 2c 20 73 65 74 73 0a | 58 09 66 69 78 70 61 74 |s, sets.|X.fixpat|
|00001fa0| 68 28 74 72 69 6d 5f 73 | 74 72 28 68 65 61 64 65 |h(trim_s|tr(heade|
|00001fb0| 72 2e 6e 61 6d 65 29 29 | 0a 58 20 20 20 20 7d 0a |r.name))|.X }.|
|00001fc0| 58 20 20 20 20 2a 5c 63 | 68 75 6e 6b 73 65 74 20 |X *\c|hunkset |
|00001fd0| 7e 3d 20 30 20 7c 20 66 | 61 69 6c 0a 58 20 20 20 |~= 0 | f|ail.X |
|00001fe0| 20 72 65 74 75 72 6e 20 | 26 6e 75 6c 6c 0a 58 0a | return |&null.X.|
|00001ff0| 58 65 6e 64 0a 58 0a 58 | 0a 58 0a 58 70 72 6f 63 |Xend.X.X|.X.Xproc|
|00002000| 65 64 75 72 65 20 6f 75 | 74 70 75 74 5f 6d 61 70 |edure ou|tput_map|
|00002010| 70 65 64 5f 68 65 61 64 | 65 72 73 5f 61 6e 64 5f |ped_head|ers_and_|
|00002020| 74 65 78 74 73 28 69 6e | 74 65 78 74 29 0a 58 0a |texts(in|text).X.|
|00002030| 58 20 20 20 20 23 20 52 | 65 6d 65 6d 62 65 72 20 |X # R|emember |
|00002040| 74 68 61 74 20 66 69 6c | 65 6e 61 6d 65 74 62 6c |that fil|enametbl|
|00002050| 2c 20 63 68 75 6e 6b 73 | 65 74 2c 20 61 6e 64 20 |, chunks|et, and |
|00002060| 73 68 6f 72 74 5f 63 68 | 75 6e 6b 73 65 74 0a 58 |short_ch|unkset.X|
|00002070| 20 20 20 20 23 20 28 77 | 68 69 63 68 20 61 72 65 | # (w|hich are|
|00002080| 20 75 73 65 64 20 62 79 | 20 76 61 72 69 6f 75 73 | used by| various|
|00002090| 20 70 72 6f 63 65 64 75 | 72 65 73 20 62 65 6c 6f | procedu|res belo|
|000020a0| 77 29 20 61 72 65 20 67 | 6c 6f 62 61 6c 2e 0a 58 |w) are g|lobal..X|
|000020b0| 20 20 20 20 6c 6f 63 61 | 6c 20 68 65 61 64 65 72 | loca|l header|
|000020c0| 2c 20 6e 65 77 74 65 78 | 74 2c 20 66 75 6c 6c 5f |, newtex|t, full_|
|000020d0| 62 6c 6f 63 6b 2c 20 62 | 6c 6f 63 6b 2c 20 6c 61 |block, b|lock, la|
|000020e0| 73 74 62 6c 6f 63 6b 0a | 58 0a 58 20 20 20 20 23 |stblock.|X.X #|
|000020f0| 20 52 65 61 64 20 69 6e | 20 68 65 61 64 65 72 73 | Read in| headers|
|00002100| 2c 20 6f 6e 65 20 61 74 | 20 61 20 74 69 6d 65 2e |, one at| a time.|
|00002110| 0a 58 20 20 20 20 77 68 | 69 6c 65 20 68 65 61 64 |.X wh|ile head|
|00002120| 65 72 20 3a 3d 20 72 65 | 61 64 74 61 72 68 64 72 |er := re|adtarhdr|
|00002130| 28 72 65 61 64 73 28 69 | 6e 74 65 78 74 2c 35 31 |(reads(i|ntext,51|
|00002140| 32 29 29 20 64 6f 20 7b | 0a 58 0a 58 09 23 20 52 |2)) do {|.X.X.# R|
|00002150| 65 70 6c 61 63 65 20 6f | 76 65 72 6c 6f 6e 67 20 |eplace o|verlong |
|00002160| 66 69 6c 65 6e 61 6d 65 | 73 20 77 69 74 68 20 73 |filename|s with s|
|00002170| 68 6f 72 74 65 72 20 6f | 6e 65 73 2c 20 61 63 63 |horter o|nes, acc|
|00002180| 6f 72 64 69 6e 67 20 74 | 6f 0a 58 09 23 20 74 68 |ording t|o.X.# th|
|00002190| 65 20 63 6f 6e 76 65 72 | 73 69 6f 6e 73 20 73 70 |e conver|sions sp|
|000021a0| 65 63 69 66 69 65 64 20 | 69 6e 20 74 68 65 20 67 |ecified |in the g|
|000021b0| 6c 6f 62 61 6c 20 68 61 | 73 68 20 74 61 62 6c 65 |lobal ha|sh table|
|000021c0| 20 66 69 6c 65 6e 61 6d | 65 74 62 6c 0a 58 09 23 | filenam|etbl.X.#|
|000021d0| 20 28 77 68 69 63 68 20 | 77 65 72 65 20 67 65 6e | (which |were gen|
|000021e0| 65 72 61 74 65 64 20 62 | 79 20 66 69 78 70 61 74 |erated b|y fixpat|
|000021f0| 68 28 29 20 6f 6e 20 74 | 68 65 20 66 69 72 73 74 |h() on t|he first|
|00002200| 20 70 61 73 73 29 2e 0a | 58 20 20 20 20 20 20 09 | pass)..|X .|
|00002210| 68 65 61 64 65 72 2e 6e | 61 6d 65 20 3a 3d 20 6c |header.n|ame := l|
|00002220| 65 66 74 28 6d 61 70 5f | 66 69 6c 65 6e 61 6d 73 |eft(map_|filenams|
|00002230| 28 68 65 61 64 65 72 2e | 6e 61 6d 65 29 2c 31 30 |(header.|name),10|
|00002240| 30 2c 22 5c 78 30 30 22 | 29 0a 58 09 68 65 61 64 |0,"\x00"|).X.head|
|00002250| 65 72 2e 6c 69 6e 6b 6e | 61 6d 65 20 3a 3d 20 6c |er.linkn|ame := l|
|00002260| 65 66 74 28 6d 61 70 5f | 66 69 6c 65 6e 61 6d 73 |eft(map_|filenams|
|00002270| 28 68 65 61 64 65 72 2e | 6c 69 6e 6b 6e 61 6d 65 |(header.|linkname|
|00002280| 29 2c 31 30 30 2c 22 5c | 78 30 30 22 29 0a 58 0a |),100,"\|x00").X.|
|00002290| 58 09 23 20 55 73 65 20 | 68 65 61 64 65 72 2e 73 |X.# Use |header.s|
|000022a0| 69 7a 65 20 66 69 65 6c | 64 20 74 6f 20 64 65 74 |ize fiel|d to det|
|000022b0| 65 72 6d 69 6e 65 20 74 | 68 65 20 73 69 7a 65 20 |ermine t|he size |
|000022c0| 6f 66 20 74 68 65 20 73 | 75 62 73 65 71 75 65 6e |of the s|ubsequen|
|000022d0| 74 20 74 65 78 74 2e 0a | 58 09 23 20 52 65 61 64 |t text..|X.# Read|
|000022e0| 20 69 6e 20 74 68 65 20 | 74 65 78 74 20 61 73 20 | in the |text as |
|000022f0| 6f 6e 65 20 73 74 72 69 | 6e 67 2e 20 20 4d 61 70 |one stri|ng. Map|
|00002300| 20 6f 76 65 72 6c 6f 6e | 67 20 66 69 6c 65 6e 61 | overlon|g filena|
|00002310| 6d 65 73 20 66 6f 75 6e | 64 20 69 6e 20 69 74 0a |mes foun|d in it.|
|00002320| 58 20 09 23 20 74 6f 20 | 73 68 6f 72 74 65 72 20 |X .# to |shorter |
|00002330| 6e 61 6d 65 73 20 61 73 | 20 73 70 65 63 69 66 69 |names as| specifi|
|00002340| 65 64 20 69 6e 20 74 68 | 65 20 67 6c 6f 62 61 6c |ed in th|e global|
|00002350| 20 68 61 73 68 20 74 61 | 62 6c 65 20 66 69 6c 65 | hash ta|ble file|
|00002360| 6e 61 6d 74 62 6c 2e 0a | 58 09 6e 65 77 74 65 78 |namtbl..|X.newtex|
|00002370| 74 20 3a 3d 20 6d 61 70 | 5f 66 69 6c 65 6e 61 6d |t := map|_filenam|
|00002380| 73 28 74 61 62 5f 6e 78 | 74 5f 68 64 72 28 69 6e |s(tab_nx|t_hdr(in|
|00002390| 74 65 78 74 2c 74 72 69 | 6d 5f 73 74 72 28 68 65 |text,tri|m_str(he|
|000023a0| 61 64 65 72 2e 73 69 7a | 65 29 29 29 0a 58 0a 58 |ader.siz|e))).X.X|
|000023b0| 09 23 20 4e 6f 77 2c 20 | 66 69 6e 64 20 74 68 65 |.# Now, |find the|
|000023c0| 20 6c 65 6e 67 74 68 20 | 6f 66 20 6e 65 77 74 65 | length |of newte|
|000023d0| 78 74 2c 20 61 6e 64 20 | 69 6e 73 65 72 74 20 69 |xt, and |insert i|
|000023e0| 74 20 69 6e 74 6f 20 74 | 68 65 20 73 69 7a 65 20 |t into t|he size |
|000023f0| 66 69 65 6c 64 2e 0a 58 | 09 68 65 61 64 65 72 2e |field..X|.header.|
|00002400| 73 69 7a 65 20 3a 3d 20 | 72 69 67 68 74 28 65 78 |size := |right(ex|
|00002410| 62 61 73 65 31 30 28 2a | 6e 65 77 74 65 78 74 2c |base10(*|newtext,|
|00002420| 38 29 20 7c 7c 20 22 20 | 22 2c 31 32 2c 22 20 22 |8) || " |",12," "|
|00002430| 29 0a 58 0a 58 09 23 20 | 43 61 6c 63 75 6c 61 74 |).X.X.# |Calculat|
|00002440| 65 20 74 68 65 20 63 68 | 65 63 6b 73 75 6d 20 6f |e the ch|ecksum o|
|00002450| 66 20 74 68 65 20 6e 65 | 77 6c 79 20 72 65 74 6f |f the ne|wly reto|
|00002460| 75 63 68 65 64 20 68 65 | 61 64 65 72 2e 0a 58 09 |uched he|ader..X.|
|00002470| 68 65 61 64 65 72 2e 63 | 68 6b 73 75 6d 20 3a 3d |header.c|hksum :=|
|00002480| 20 72 69 67 68 74 28 65 | 78 62 61 73 65 31 30 28 | right(e|xbase10(|
|00002490| 67 65 74 5f 63 68 65 63 | 6b 73 75 6d 28 68 65 61 |get_chec|ksum(hea|
|000024a0| 64 65 72 29 2c 38 29 7c | 7c 22 5c 78 30 30 20 22 |der),8)|||"\x00 "|
|000024b0| 2c 38 2c 22 20 22 29 0a | 58 0a 58 09 23 20 46 69 |,8," ").|X.X.# Fi|
|000024c0| 6e 61 6c 6c 79 2c 20 6a | 6f 69 6e 20 61 6c 6c 20 |nally, j|oin all |
|000024d0| 74 68 65 20 68 65 61 64 | 65 72 20 66 69 65 6c 64 |the head|er field|
|000024e0| 73 20 69 6e 74 6f 20 61 | 20 6e 65 77 20 62 6c 6f |s into a| new blo|
|000024f0| 63 6b 20 61 6e 64 20 77 | 72 69 74 65 20 69 74 20 |ck and w|rite it |
|00002500| 6f 75 74 0a 58 09 66 75 | 6c 6c 5f 62 6c 6f 63 6b |out.X.fu|ll_block|
|00002510| 20 3a 3d 20 22 22 3b 20 | 65 76 65 72 79 20 66 75 | := ""; |every fu|
|00002520| 6c 6c 5f 62 6c 6f 63 6b | 20 7c 7c 3a 3d 20 21 68 |ll_block| ||:= !h|
|00002530| 65 61 64 65 72 0a 58 09 | 73 75 73 70 65 6e 64 20 |eader.X.|suspend |
|00002540| 6c 65 66 74 28 66 75 6c | 6c 5f 62 6c 6f 63 6b 2c |left(ful|l_block,|
|00002550| 35 31 32 2c 22 5c 78 30 | 30 22 29 0a 58 0a 58 09 |512,"\x0|0").X.X.|
|00002560| 23 20 4e 6f 77 20 77 65 | 27 72 65 20 72 65 61 64 |# Now we|'re read|
|00002570| 79 20 74 6f 20 77 72 69 | 74 65 20 6f 75 74 20 74 |y to wri|te out t|
|00002580| 68 65 20 74 65 78 74 2c | 20 70 61 64 64 69 6e 67 |he text,| padding|
|00002590| 20 74 68 65 20 66 69 6e | 61 6c 20 62 6c 6f 63 6b | the fin|al block|
|000025a0| 0a 58 09 23 20 6f 75 74 | 20 74 6f 20 61 6e 20 65 |.X.# out| to an e|
|000025b0| 76 65 6e 20 35 31 32 20 | 62 79 74 65 73 20 69 66 |ven 512 |bytes if|
|000025c0| 20 6e 65 63 65 73 73 61 | 72 79 3b 20 74 68 65 20 | necessa|ry; the |
|000025d0| 6e 65 78 74 20 68 65 61 | 64 65 72 20 6d 75 73 74 |next hea|der must|
|000025e0| 20 73 74 61 72 74 0a 58 | 09 23 20 72 69 67 68 74 | start.X|.# right|
|000025f0| 20 61 74 20 74 68 65 20 | 62 65 67 69 6e 6e 69 6e | at the |beginnin|
|00002600| 67 20 6f 66 20 61 20 35 | 31 32 2d 62 79 74 65 20 |g of a 5|12-byte |
|00002610| 62 6c 6f 63 6b 2e 0a 58 | 09 6e 65 77 74 65 78 74 |block..X|.newtext|
|00002620| 20 3f 20 7b 0a 58 09 20 | 20 20 20 77 68 69 6c 65 | ? {.X. | while|
|00002630| 20 62 6c 6f 63 6b 20 3a | 3d 20 6d 6f 76 65 28 35 | block :|= move(5|
|00002640| 31 32 29 0a 58 09 20 20 | 20 20 64 6f 20 73 75 73 |12).X. | do sus|
|00002650| 70 65 6e 64 20 62 6c 6f | 63 6b 0a 58 09 20 20 20 |pend blo|ck.X. |
|00002660| 20 70 6f 73 28 30 29 20 | 26 20 6e 65 78 74 0a 58 | pos(0) |& next.X|
|00002670| 20 20 20 20 20 20 20 20 | 20 20 20 20 6c 61 73 74 | | last|
|00002680| 62 6c 6f 63 6b 20 3a 3d | 20 6c 65 66 74 28 74 61 |block :=| left(ta|
|00002690| 62 28 30 29 2c 35 31 32 | 2c 22 5c 78 30 30 22 29 |b(0),512|,"\x00")|
|000026a0| 0a 58 09 20 20 20 20 73 | 75 73 70 65 6e 64 20 6c |.X. s|uspend l|
|000026b0| 61 73 74 62 6c 6f 63 6b | 0a 58 09 7d 0a 58 20 20 |astblock|.X.}.X |
|000026c0| 20 20 7d 0a 58 20 20 20 | 20 23 20 57 72 69 74 65 | }.X | # Write|
|000026d0| 20 6f 75 74 20 61 20 66 | 69 6e 61 6c 20 6e 75 6c | out a f|inal nul|
|000026e0| 6c 2d 66 69 6c 6c 65 64 | 20 62 6c 6f 63 6b 2e 20 |l-filled| block. |
|000026f0| 20 53 6f 6d 65 20 74 61 | 72 20 70 72 6f 67 72 61 | Some ta|r progra|
|00002700| 6d 73 20 77 69 6c 6c 20 | 77 72 69 74 65 0a 58 20 |ms will |write.X |
|00002710| 20 20 20 23 20 6f 75 74 | 20 31 30 32 34 20 6e 75 | # out| 1024 nu|
|00002720| 6c 6c 73 20 61 74 20 74 | 68 65 20 65 6e 64 2e 20 |lls at t|he end. |
|00002730| 20 44 75 6e 6e 6f 20 77 | 68 79 2e 0a 58 20 20 20 | Dunno w|hy..X |
|00002740| 20 72 65 74 75 72 6e 20 | 72 65 70 6c 28 22 5c 78 | return |repl("\x|
|00002750| 30 30 22 2c 35 31 32 29 | 0a 58 0a 58 65 6e 64 0a |00",512)|.X.Xend.|
|00002760| 58 0a 58 0a 58 0a 58 70 | 72 6f 63 65 64 75 72 65 |X.X.X.Xp|rocedure|
|00002770| 20 74 72 69 6d 5f 73 74 | 72 28 73 29 0a 58 0a 58 | trim_st|r(s).X.X|
|00002780| 20 20 20 20 23 20 4b 6e | 6f 63 6b 20 6f 75 74 20 | # Kn|ock out |
|00002790| 73 70 61 63 65 73 2c 20 | 6e 75 6c 6c 73 20 66 72 |spaces, |nulls fr|
|000027a0| 6f 6d 20 74 68 6f 73 65 | 20 63 72 61 7a 79 20 74 |om those| crazy t|
|000027b0| 61 72 20 68 65 61 64 65 | 72 0a 58 20 20 20 20 23 |ar heade|r.X #|
|000027c0| 20 62 6c 6f 63 6b 20 66 | 69 65 6c 64 73 20 28 73 | block f|ields (s|
|000027d0| 6f 6d 65 20 6f 66 20 77 | 68 69 63 68 20 65 6e 64 |ome of w|hich end|
|000027e0| 20 69 6e 20 61 20 73 70 | 61 63 65 20 61 6e 64 20 | in a sp|ace and |
|000027f0| 61 20 6e 75 6c 6c 2c 0a | 58 20 20 20 20 23 20 73 |a null,.|X # s|
|00002800| 6f 6d 65 20 6a 75 73 74 | 20 61 20 73 70 61 63 65 |ome just| a space|
|00002810| 2c 20 61 6e 64 20 73 6f | 6d 65 20 6a 75 73 74 20 |, and so|me just |
|00002820| 61 20 6e 75 6c 6c 20 5b | 61 6e 79 6f 6e 65 20 6b |a null [|anyone k|
|00002830| 6e 6f 77 0a 58 20 20 20 | 20 23 20 77 68 79 3f 5d |now.X | # why?]|
|00002840| 29 2e 0a 58 20 20 20 20 | 72 65 74 75 72 6e 20 73 |)..X |return s|
|00002850| 20 3f 20 7b 0a 58 09 28 | 74 61 62 28 6d 61 6e 79 | ? {.X.(|tab(many|
|00002860| 28 27 20 27 29 29 20 7c | 20 26 6e 75 6c 6c 29 20 |(' ')) || &null) |
|00002870| 26 0a 58 09 20 20 20 20 | 74 72 69 6d 28 74 61 62 |&.X. |trim(tab|
|00002880| 28 66 69 6e 64 28 22 5c | 78 30 30 22 29 7c 30 29 |(find("\|x00")|0)|
|00002890| 29 0a 58 20 20 20 20 7d | 20 5c 20 31 0a 58 0a 58 |).X }| \ 1.X.X|
|000028a0| 65 6e 64 20 0a 58 0a 58 | 0a 58 0a 58 70 72 6f 63 |end .X.X|.X.Xproc|
|000028b0| 65 64 75 72 65 20 74 61 | 62 5f 6e 78 74 5f 68 64 |edure ta|b_nxt_hd|
|000028c0| 72 28 66 2c 73 69 7a 65 | 5f 73 74 72 2c 66 69 72 |r(f,size|_str,fir|
|000028d0| 73 74 70 61 73 73 29 0a | 58 0a 58 20 20 20 20 23 |stpass).|X.X #|
|000028e0| 20 54 61 62 20 75 70 74 | 6f 20 74 68 65 20 6e 65 | Tab upt|o the ne|
|000028f0| 78 74 20 68 65 61 64 65 | 72 20 62 6c 6f 63 6b 2e |xt heade|r block.|
|00002900| 20 20 52 65 74 75 72 6e | 20 74 68 65 20 62 79 70 | Return| the byp|
|00002910| 61 73 73 65 64 20 74 65 | 78 74 0a 58 20 20 20 20 |assed te|xt.X |
|00002920| 23 20 61 73 20 61 20 73 | 74 72 69 6e 67 20 69 66 |# as a s|tring if|
|00002930| 20 6e 6f 74 20 74 68 65 | 20 66 69 72 73 74 20 70 | not the| first p|
|00002940| 61 73 73 2e 0a 58 0a 58 | 20 20 20 20 6c 6f 63 61 |ass..X.X| loca|
|00002950| 6c 20 68 73 2c 20 6e 65 | 78 74 5f 68 65 61 64 65 |l hs, ne|xt_heade|
|00002960| 72 5f 6f 66 66 73 65 74 | 0a 58 0a 58 20 20 20 20 |r_offset|.X.X |
|00002970| 68 73 20 3a 3d 20 69 6e | 74 65 67 65 72 28 22 38 |hs := in|teger("8|
|00002980| 72 22 20 7c 7c 20 73 69 | 7a 65 5f 73 74 72 29 0a |r" || si|ze_str).|
|00002990| 58 20 20 20 20 6e 65 78 | 74 5f 68 65 61 64 65 72 |X nex|t_header|
|000029a0| 5f 6f 66 66 73 65 74 20 | 3a 3d 20 28 68 73 20 2f |_offset |:= (hs /|
|000029b0| 20 35 31 32 29 20 2a 20 | 35 31 32 0a 58 20 20 20 | 512) * |512.X |
|000029c0| 20 68 73 20 25 20 35 31 | 32 20 7e 3d 20 30 20 26 | hs % 51|2 ~= 0 &|
|000029d0| 20 6e 65 78 74 5f 68 65 | 61 64 65 72 5f 6f 66 66 | next_he|ader_off|
|000029e0| 73 65 74 20 2b 3a 3d 20 | 35 31 32 0a 58 20 20 20 |set +:= |512.X |
|000029f0| 20 69 66 20 30 20 3d 20 | 6e 65 78 74 5f 68 65 61 | if 0 = |next_hea|
|00002a00| 64 65 72 5f 6f 66 66 73 | 65 74 20 74 68 65 6e 20 |der_offs|et then |
|00002a10| 72 65 74 75 72 6e 20 22 | 22 0a 58 20 20 20 20 65 |return "|".X e|
|00002a20| 6c 73 65 20 7b 0a 58 09 | 23 20 69 66 20 74 68 69 |lse {.X.|# if thi|
|00002a30| 73 20 69 73 20 70 61 73 | 73 20 6e 6f 2e 20 31 20 |s is pas|s no. 1 |
|00002a40| 64 6f 6e 27 74 20 62 6f | 74 68 65 72 20 72 65 74 |don't bo|ther ret|
|00002a50| 75 72 6e 69 6e 67 20 61 | 20 76 61 6c 75 65 3b 20 |urning a| value; |
|00002a60| 77 65 27 72 65 0a 58 09 | 23 20 6a 75 73 74 20 63 |we're.X.|# just c|
|00002a70| 6f 6c 6c 65 63 74 69 6e | 67 20 6c 6f 6e 67 20 66 |ollectin|g long f|
|00002a80| 69 6c 65 6e 61 6d 65 73 | 3b 0a 58 09 69 66 20 5c |ilenames|;.X.if \|
|00002a90| 66 69 72 73 74 70 61 73 | 73 20 74 68 65 6e 20 7b |firstpas|s then {|
|00002aa0| 0a 58 09 20 20 20 20 73 | 65 65 6b 28 66 2c 77 68 |.X. s|eek(f,wh|
|00002ab0| 65 72 65 28 66 29 2b 6e | 65 78 74 5f 68 65 61 64 |ere(f)+n|ext_head|
|00002ac0| 65 72 5f 6f 66 66 73 65 | 74 29 0a 58 09 20 20 20 |er_offse|t).X. |
|00002ad0| 20 72 65 74 75 72 6e 0a | 58 09 7d 0a 58 09 65 6c | return.|X.}.X.el|
|00002ae0| 73 65 20 7b 0a 58 09 20 | 20 20 20 72 65 74 75 72 |se {.X. | retur|
|00002af0| 6e 20 72 65 61 64 73 28 | 66 2c 6e 65 78 74 5f 68 |n reads(|f,next_h|
|00002b00| 65 61 64 65 72 5f 6f 66 | 66 73 65 74 29 5b 31 3a |eader_of|fset)[1:|
|00002b10| 68 73 2b 31 5d 20 7c 0a | 58 09 09 73 74 6f 70 28 |hs+1] |.|X..stop(|
|00002b20| 22 6d 74 66 3a 20 20 65 | 72 72 6f 72 20 72 65 61 |"mtf: e|rror rea|
|00002b30| 64 69 6e 67 20 69 6e 20 | 22 2c 0a 58 09 09 20 20 |ding in |",.X.. |
|00002b40| 20 20 20 73 74 72 69 6e | 67 28 6e 65 78 74 5f 68 | strin|g(next_h|
|00002b50| 65 61 64 65 72 5f 6f 66 | 66 73 65 74 29 2c 22 20 |eader_of|fset)," |
|00002b60| 62 79 74 65 73 2e 22 29 | 0a 58 09 7d 0a 58 20 20 |bytes.")|.X.}.X |
|00002b70| 20 20 7d 0a 58 0a 58 65 | 6e 64 0a 58 0a 58 0a 58 | }.X.Xe|nd.X.X.X|
|00002b80| 0a 58 70 72 6f 63 65 64 | 75 72 65 20 66 69 78 70 |.Xproced|ure fixp|
|00002b90| 61 74 68 28 73 29 0a 58 | 0a 58 20 20 20 20 23 20 |ath(s).X|.X # |
|00002ba0| 46 69 78 70 61 74 68 20 | 69 73 20 61 20 6d 69 73 |Fixpath |is a mis|
|00002bb0| 6e 6f 6d 65 72 20 6f 66 | 20 73 6f 72 74 73 2c 20 |nomer of| sorts, |
|00002bc0| 73 69 6e 63 65 20 69 74 | 20 69 73 20 75 73 65 64 |since it| is used|
|00002bd0| 20 6f 6e 0a 58 20 20 20 | 20 23 20 74 68 65 20 66 | on.X | # the f|
|00002be0| 69 72 73 74 20 70 61 73 | 73 20 6f 6e 6c 79 2c 20 |irst pas|s only, |
|00002bf0| 61 6e 64 20 6d 65 72 65 | 6c 79 20 65 78 61 6d 69 |and mere|ly exami|
|00002c00| 6e 65 73 20 65 61 63 68 | 20 66 69 6c 65 6e 61 6d |nes each| filenam|
|00002c10| 65 0a 58 20 20 20 20 23 | 20 69 6e 20 61 20 70 61 |e.X #| in a pa|
|00002c20| 74 68 2c 20 75 73 69 6e | 67 20 74 68 65 20 70 72 |th, usin|g the pr|
|00002c30| 6f 63 65 64 75 72 65 20 | 6d 61 70 70 69 65 63 65 |ocedure |mappiece|
|00002c40| 20 74 6f 20 72 65 63 6f | 72 64 20 61 6e 79 0a 58 | to reco|rd any.X|
|00002c50| 20 20 20 20 23 20 6f 76 | 65 72 6c 6f 6e 67 20 6f | # ov|erlong o|
|00002c60| 6e 65 73 20 69 6e 20 74 | 68 65 20 67 6c 6f 62 61 |nes in t|he globa|
|00002c70| 6c 20 74 61 62 6c 65 20 | 66 69 6c 65 6e 61 6d 65 |l table |filename|
|00002c80| 74 62 6c 20 61 6e 64 20 | 69 6e 0a 58 20 20 20 20 |tbl and |in.X |
|00002c90| 23 20 74 68 65 20 67 6c | 6f 62 61 6c 20 73 65 74 |# the gl|obal set|
|00002ca0| 73 20 63 68 75 6e 6b 73 | 65 74 20 61 6e 64 20 73 |s chunks|et and s|
|00002cb0| 68 6f 72 74 5f 63 68 75 | 6e 6b 73 65 74 3b 20 6e |hort_chu|nkset; n|
|00002cc0| 6f 20 66 69 78 69 6e 67 | 0a 58 20 20 20 20 23 20 |o fixing|.X # |
|00002cd0| 69 73 20 61 63 74 75 61 | 6c 6c 79 20 64 6f 6e 65 |is actua|lly done|
|00002ce0| 20 68 65 72 65 2e 0a 58 | 0a 58 20 20 20 20 73 32 | here..X|.X s2|
|00002cf0| 20 3a 3d 20 22 22 0a 58 | 20 20 20 20 73 20 3f 20 | := "".X| s ? |
|00002d00| 7b 0a 58 09 77 68 69 6c | 65 20 70 69 65 63 65 20 |{.X.whil|e piece |
|00002d10| 3a 3d 20 74 61 62 28 66 | 69 6e 64 28 22 2f 22 29 |:= tab(f|ind("/")|
|00002d20| 2b 31 29 0a 58 09 64 6f | 20 73 32 20 7c 7c 3a 3d |+1).X.do| s2 ||:=|
|00002d30| 20 6d 61 70 70 69 65 63 | 65 28 70 69 65 63 65 29 | mappiec|e(piece)|
|00002d40| 20 0a 58 09 73 32 20 7c | 7c 3a 3d 20 6d 61 70 70 | .X.s2 |||:= mapp|
|00002d50| 69 65 63 65 28 74 61 62 | 28 30 29 29 0a 58 20 20 |iece(tab|(0)).X |
|00002d60| 20 20 7d 0a 58 20 20 20 | 20 72 65 74 75 72 6e 20 | }.X | return |
|00002d70| 73 32 0a 58 0a 58 65 6e | 64 0a 58 0a 58 0a 58 0a |s2.X.Xen|d.X.X.X.|
|00002d80| 58 70 72 6f 63 65 64 75 | 72 65 20 6d 61 70 70 69 |Xprocedu|re mappi|
|00002d90| 65 63 65 28 73 29 0a 58 | 0a 58 20 20 20 20 23 20 |ece(s).X|.X # |
|00002da0| 43 68 65 63 6b 20 73 20 | 28 74 68 65 20 6e 61 6d |Check s |(the nam|
|00002db0| 65 20 6f 66 20 61 20 66 | 69 6c 65 20 6f 72 20 64 |e of a f|ile or d|
|00002dc0| 69 72 20 61 73 20 72 65 | 63 6f 72 64 65 64 20 69 |ir as re|corded i|
|00002dd0| 6e 20 74 68 65 20 74 61 | 72 20 68 65 61 64 65 72 |n the ta|r header|
|00002de0| 0a 58 20 20 20 20 23 20 | 62 65 69 6e 67 20 65 78 |.X # |being ex|
|00002df0| 61 6d 69 6e 65 64 29 20 | 74 6f 20 73 65 65 20 69 |amined) |to see i|
|00002e00| 66 20 69 74 20 69 73 20 | 6f 76 65 72 20 31 34 20 |f it is |over 14 |
|00002e10| 63 68 61 72 73 20 6c 6f | 6e 67 2e 20 20 49 66 20 |chars lo|ng. If |
|00002e20| 73 6f 2c 0a 58 20 20 20 | 20 23 20 67 65 6e 65 72 |so,.X | # gener|
|00002e30| 61 74 65 20 61 20 75 6e | 69 71 75 65 20 31 34 2d |ate a un|ique 14-|
|00002e40| 63 68 61 72 20 76 65 72 | 73 69 6f 6e 20 6f 66 20 |char ver|sion of |
|00002e50| 74 68 65 20 6e 61 6d 65 | 2c 20 61 6e 64 20 73 74 |the name|, and st|
|00002e60| 6f 72 65 0a 58 20 20 20 | 20 23 20 62 6f 74 68 20 |ore.X | # both |
|00002e70| 76 61 6c 75 65 73 20 69 | 6e 20 74 68 65 20 67 6c |values i|n the gl|
|00002e80| 6f 62 61 6c 20 68 61 73 | 68 74 61 62 6c 65 20 66 |obal has|htable f|
|00002e90| 69 6c 65 6e 61 6d 65 74 | 62 6c 2e 20 20 41 6c 73 |ilenamet|bl. Als|
|00002ea0| 6f 20 73 74 6f 72 65 0a | 58 20 20 20 20 23 20 74 |o store.|X # t|
|00002eb0| 68 65 20 6f 72 69 67 69 | 6e 61 6c 20 28 6f 76 65 |he origi|nal (ove|
|00002ec0| 72 6c 6f 6e 67 29 20 66 | 69 6c 65 20 6e 61 6d 65 |rlong) f|ile name|
|00002ed0| 20 69 6e 20 63 68 75 6e | 6b 73 65 74 2e 20 20 53 | in chun|kset. S|
|00002ee0| 74 6f 72 65 20 74 68 65 | 0a 58 20 20 20 20 23 20 |tore the|.X # |
|00002ef0| 66 69 72 73 74 20 66 69 | 66 74 65 65 6e 20 63 68 |first fi|fteen ch|
|00002f00| 61 72 73 20 6f 66 20 74 | 68 65 20 6f 72 69 67 69 |ars of t|he origi|
|00002f10| 6e 61 6c 20 66 69 6c 65 | 20 6e 61 6d 65 20 69 6e |nal file| name in|
|00002f20| 20 73 68 6f 72 74 5f 63 | 68 75 6e 6b 73 65 74 2e | short_c|hunkset.|
|00002f30| 0a 58 20 20 20 20 23 20 | 53 6f 72 72 79 20 61 62 |.X # |Sorry ab|
|00002f40| 6f 75 74 20 61 6c 6c 20 | 6f 66 20 74 68 65 20 74 |out all |of the t|
|00002f50| 61 62 6c 65 73 20 61 6e | 64 20 73 65 74 73 2e 20 |ables an|d sets. |
|00002f60| 20 49 74 20 61 63 74 75 | 61 6c 6c 79 20 6d 61 6b | It actu|ally mak|
|00002f70| 65 73 20 66 6f 72 0a 58 | 20 20 20 20 23 20 61 20 |es for.X| # a |
|00002f80| 72 65 61 73 6f 6e 61 62 | 6c 79 20 65 66 66 69 63 |reasonab|ly effic|
|00002f90| 69 65 6e 74 20 70 72 6f | 67 72 61 6d 2e 20 20 44 |ient pro|gram. D|
|00002fa0| 6f 69 6e 67 20 61 77 61 | 79 20 77 69 74 68 20 62 |oing awa|y with b|
|00002fb0| 6f 74 68 20 73 65 74 73 | 2c 0a 58 20 20 20 20 23 |oth sets|,.X #|
|00002fc0| 20 77 68 69 6c 65 20 70 | 6f 73 73 69 62 6c 65 2c | while p|ossible,|
|00002fd0| 20 63 61 75 73 65 73 20 | 61 20 74 65 6e 66 6f 6c | causes |a tenfol|
|00002fe0| 64 20 64 72 6f 70 20 69 | 6e 20 65 78 65 63 75 74 |d drop i|n execut|
|00002ff0| 69 6f 6e 20 73 70 65 65 | 64 21 0a 58 20 20 20 20 |ion spee|d!.X |
|00003000| 0a 58 20 20 20 20 23 20 | 67 6c 6f 62 61 6c 20 66 |.X # |global f|
|00003010| 69 6c 65 6e 61 6d 65 74 | 62 6c 2c 20 63 68 75 6e |ilenamet|bl, chun|
|00003020| 6b 73 65 74 2c 20 73 68 | 6f 72 74 5f 63 68 75 6e |kset, sh|ort_chun|
|00003030| 6b 73 65 74 2c 20 65 78 | 74 65 6e 73 69 6f 6e 73 |kset, ex|tensions|
|00003040| 0a 58 20 20 20 20 6c 6f | 63 61 6c 20 6a 2c 20 65 |.X lo|cal j, e|
|00003050| 6e 64 69 6e 67 0a 58 0a | 58 20 20 20 20 69 6e 69 |nding.X.|X ini|
|00003060| 74 69 61 6c 20 7b 0a 58 | 09 2f 66 69 6c 65 6e 61 |tial {.X|./filena|
|00003070| 6d 65 74 62 6c 20 3a 3d | 20 74 61 62 6c 65 28 29 |metbl :=| table()|
|00003080| 0a 58 09 2f 63 68 75 6e | 6b 73 65 74 20 3a 3d 20 |.X./chun|kset := |
|00003090| 73 65 74 28 29 0a 58 09 | 2f 73 68 6f 72 74 5f 63 |set().X.|/short_c|
|000030a0| 68 75 6e 6b 73 65 74 20 | 3a 3d 20 73 65 74 28 29 |hunkset |:= set()|
|000030b0| 0a 58 20 20 20 20 7d 0a | 58 20 20 20 0a 58 20 20 |.X }.|X .X |
|000030c0| 20 20 63 68 75 6e 6b 20 | 3a 3d 20 74 72 69 6d 28 | chunk |:= trim(|
|000030d0| 73 2c 27 2f 27 29 0a 58 | 20 20 20 20 69 66 20 63 |s,'/').X| if c|
|000030e0| 68 75 6e 6b 20 3f 20 28 | 74 61 62 28 66 69 6e 64 |hunk ? (|tab(find|
|000030f0| 28 22 2e 74 61 72 22 29 | 2b 34 29 2c 20 70 6f 73 |(".tar")|+4), pos|
|00003100| 28 30 29 29 20 74 68 65 | 6e 20 7b 0a 58 09 77 72 |(0)) the|n {.X.wr|
|00003110| 69 74 65 28 26 65 72 72 | 6f 75 74 2c 20 22 6d 74 |ite(&err|out, "mt|
|00003120| 66 3a 20 20 53 6f 72 72 | 79 2c 20 49 20 63 61 6e |f: Sorr|y, I can|
|00003130| 27 74 20 6c 65 74 20 79 | 6f 75 20 64 6f 20 74 68 |'t let y|ou do th|
|00003140| 69 73 2e 5c 6e 22 2c 0a | 58 09 20 20 20 20 20 20 |is.\n",.|X. |
|00003150| 20 20 20 20 20 20 20 20 | 20 22 20 20 20 20 20 20 | | " |
|00003160| 59 6f 75 27 76 65 20 6e | 65 73 74 65 64 20 61 20 |You've n|ested a |
|00003170| 74 61 72 20 61 72 63 68 | 69 76 65 20 77 69 74 68 |tar arch|ive with|
|00003180| 69 6e 5c 6e 22 2c 0a 58 | 09 20 20 20 20 20 20 20 |in\n",.X|. |
|00003190| 20 20 20 20 20 20 20 20 | 22 20 20 20 20 20 20 61 | |" a|
|000031a0| 6e 6f 74 68 65 72 20 74 | 61 72 20 61 72 63 68 69 |nother t|ar archi|
|000031b0| 76 65 2c 20 77 68 69 63 | 68 20 6d 61 6b 65 73 20 |ve, whic|h makes |
|000031c0| 69 74 5c 6e 22 2c 0a 58 | 09 20 20 20 20 20 20 20 |it\n",.X|. |
|000031d0| 20 20 20 20 20 20 20 20 | 22 20 20 20 20 20 20 6c | |" l|
|000031e0| 69 6b 65 6c 79 20 49 27 | 6c 6c 20 66 20 79 6f 75 |ikely I'|ll f you|
|000031f0| 72 20 66 69 6c 65 6e 61 | 6d 65 73 20 75 62 61 72 |r filena|mes ubar|
|00003200| 2e 22 29 0a 58 09 65 78 | 69 74 28 32 29 0a 58 20 |.").X.ex|it(2).X |
|00003210| 20 20 20 7d 0a 58 20 20 | 20 20 69 66 20 2a 63 68 | }.X | if *ch|
|00003220| 75 6e 6b 20 3e 20 31 34 | 20 74 68 65 6e 20 7b 0a |unk > 14| then {.|
|00003230| 58 09 69 20 3a 3d 20 30 | 0a 58 0a 58 09 69 66 20 |X.i := 0|.X.X.if |
|00003240| 2f 66 69 6c 65 6e 61 6d | 65 74 62 6c 5b 63 68 75 |/filenam|etbl[chu|
|00003250| 6e 6b 5d 20 74 68 65 6e | 20 7b 0a 58 09 23 20 69 |nk] then| {.X.# i|
|00003260| 66 20 77 65 20 68 61 76 | 65 20 6e 6f 74 20 73 65 |f we hav|e not se|
|00003270| 65 6e 20 74 68 69 73 20 | 66 69 6c 65 2c 20 74 68 |en this |file, th|
|00003280| 65 6e 2e 2e 2e 0a 58 09 | 20 20 20 20 72 65 70 65 |en....X.| repe|
|00003290| 61 74 20 7b 0a 58 09 09 | 23 20 2e 2e 2e 66 69 6e |at {.X..|# ...fin|
|000032a0| 64 20 61 20 6e 65 77 20 | 75 6e 69 71 75 65 20 31 |d a new |unique 1|
|000032b0| 34 2d 63 68 61 72 61 63 | 74 65 72 20 6e 61 6d 65 |4-charac|ter name|
|000032c0| 20 66 6f 72 20 69 74 3b | 0a 58 09 09 23 20 70 72 | for it;|.X..# pr|
|000032d0| 65 73 65 72 76 65 20 69 | 6d 70 6f 72 74 61 6e 74 |eserve i|mportant|
|000032e0| 20 73 75 66 66 69 78 65 | 73 20 6c 69 6b 65 20 22 | suffixe|s like "|
|000032f0| 2e 5a 2c 22 20 22 2e 63 | 2c 22 20 65 74 63 2e 0a |.Z," ".c|," etc..|
|00003300| 58 09 09 23 20 46 69 72 | 73 74 2c 20 63 68 65 63 |X..# Fir|st, chec|
|00003310| 6b 20 74 6f 20 73 65 65 | 20 69 66 20 74 68 65 20 |k to see| if the |
|00003320| 6f 72 69 67 69 6e 61 6c | 20 66 69 6c 65 6e 61 6d |original| filenam|
|00003330| 65 20 28 63 68 75 6e 6b | 29 0a 58 09 09 23 20 65 |e (chunk|).X..# e|
|00003340| 6e 64 73 20 69 6e 20 61 | 6e 20 69 6d 70 6f 72 74 |nds in a|n import|
|00003350| 61 6e 74 20 65 78 74 65 | 6e 73 69 6f 6e 2e 2e 2e |ant exte|nsion...|
|00003360| 0a 58 09 09 69 66 20 63 | 68 75 6e 6b 20 3f 0a 58 |.X..if c|hunk ?.X|
|00003370| 09 09 20 20 20 20 28 74 | 61 62 28 66 69 6e 64 28 |.. (t|ab(find(|
|00003380| 22 2e 22 29 29 2c 0a 58 | 09 09 20 20 20 20 20 65 |".")),.X|.. e|
|00003390| 6e 64 69 6e 67 20 3a 3d | 20 6d 6f 76 65 28 31 29 |nding :=| move(1)|
|000033a0| 20 7c 7c 20 74 61 62 28 | 6d 61 74 63 68 28 21 65 | || tab(|match(!e|
|000033b0| 78 74 65 6e 73 69 6f 6e | 73 29 7c 61 6e 79 28 26 |xtension|s)|any(&|
|000033c0| 61 73 63 69 69 29 29 2c | 0a 58 09 09 20 20 20 20 |ascii)),|.X.. |
|000033d0| 20 70 6f 73 28 30 29 0a | 58 09 09 20 20 20 20 20 | pos(0).|X.. |
|000033e0| 29 0a 58 09 09 23 20 2e | 2e 2e 49 66 20 73 6f 2c |).X..# .|..If so,|
|000033f0| 20 74 68 65 6e 20 6c 65 | 61 76 65 20 74 68 65 20 | then le|ave the |
|00003400| 65 78 74 65 6e 73 69 6f | 6e 20 61 6c 6f 6e 65 3b |extensio|n alone;|
|00003410| 20 6d 65 73 73 20 77 69 | 74 68 20 74 68 65 0a 58 | mess wi|th the.X|
|00003420| 09 09 23 20 6d 69 64 64 | 6c 65 20 70 61 72 74 20 |..# midd|le part |
|00003430| 6f 66 20 74 68 65 20 66 | 69 6c 65 6e 61 6d 65 20 |of the f|ilename |
|00003440| 28 65 2e 67 2e 20 66 69 | 6c 65 2e 77 69 74 68 2e |(e.g. fi|le.with.|
|00003450| 65 78 74 65 6e 73 69 6f | 6e 2e 63 20 2d 3e 0a 58 |extensio|n.c ->.X|
|00003460| 09 09 23 20 66 69 6c 65 | 2e 77 69 74 68 30 30 31 |..# file|.with001|
|00003470| 2e 63 29 2e 0a 58 09 09 | 74 68 65 6e 20 7b 0a 58 |.c)..X..|then {.X|
|00003480| 09 09 20 20 20 20 6a 20 | 3a 3d 20 28 31 35 20 2d |.. j |:= (15 -|
|00003490| 20 2a 65 6e 64 69 6e 67 | 20 2d 20 33 29 0a 58 09 | *ending| - 3).X.|
|000034a0| 09 20 20 20 20 6c 63 68 | 75 6e 6b 3a 3d 20 63 68 |. lch|unk:= ch|
|000034b0| 75 6e 6b 5b 31 3a 6a 5d | 20 7c 7c 20 72 69 67 68 |unk[1:j]| || righ|
|000034c0| 74 28 73 74 72 69 6e 67 | 28 69 2b 3a 3d 31 29 2c |t(string|(i+:=1),|
|000034d0| 33 2c 22 30 22 29 20 7c | 7c 20 65 6e 64 69 6e 67 |3,"0") ||| ending|
|000034e0| 0a 58 09 09 7d 0a 58 09 | 09 23 20 49 66 20 6e 6f |.X..}.X.|.# If no|
|000034f0| 20 69 6d 70 6f 72 74 61 | 6e 74 20 65 78 74 65 6e | importa|nt exten|
|00003500| 73 69 6f 6e 20 69 73 20 | 70 72 65 73 65 6e 74 2c |sion is |present,|
|00003510| 20 74 68 65 6e 20 72 65 | 66 6f 72 6d 61 74 20 74 | then re|format t|
|00003520| 68 65 0a 58 09 09 23 20 | 65 6e 64 20 6f 66 20 74 |he.X..# |end of t|
|00003530| 68 65 20 66 69 6c 65 20 | 28 65 2e 67 2e 20 74 6f |he file |(e.g. to|
|00003540| 6f 2e 6c 6f 6e 67 2e 66 | 69 6c 65 2e 6e 61 6d 65 |o.long.f|ile.name|
|00003550| 20 2d 3e 20 74 6f 6f 2e | 6c 6f 6e 67 2e 66 69 30 | -> too.|long.fi0|
|00003560| 31 29 2e 0a 58 09 09 65 | 6c 73 65 20 6c 63 68 75 |1)..X..e|lse lchu|
|00003570| 6e 6b 20 3a 3d 20 63 68 | 75 6e 6b 5b 31 3a 31 33 |nk := ch|unk[1:13|
|00003580| 5d 20 7c 7c 20 72 69 67 | 68 74 28 73 74 72 69 6e |] || rig|ht(strin|
|00003590| 67 28 69 2b 3a 3d 31 29 | 2c 32 2c 22 30 22 29 0a |g(i+:=1)|,2,"0").|
|000035a0| 58 0a 58 09 09 23 20 49 | 66 20 74 68 65 20 72 65 |X.X..# I|f the re|
|000035b0| 73 75 6c 74 69 6e 67 20 | 73 68 6f 72 74 65 72 20 |sulting |shorter |
|000035c0| 66 69 6c 65 20 6e 61 6d | 65 20 68 61 73 20 61 6c |file nam|e has al|
|000035d0| 72 65 61 64 79 20 62 65 | 65 6e 20 75 73 65 64 2e |ready be|en used.|
|000035e0| 2e 2e 0a 58 09 09 69 66 | 20 6c 63 68 75 6e 6b 20 |...X..if| lchunk |
|000035f0| 3d 3d 20 21 66 69 6c 65 | 6e 61 6d 65 74 62 6c 0a |== !file|nametbl.|
|00003600| 58 09 09 23 20 2e 2e 2e | 74 68 65 6e 20 67 6f 20 |X..# ...|then go |
|00003610| 62 61 63 6b 20 61 6e 64 | 20 66 69 6e 64 20 61 6e |back and| find an|
|00003620| 6f 74 68 65 72 20 28 69 | 2e 65 2e 20 69 6e 63 72 |other (i|.e. incr|
|00003630| 65 6d 65 6e 74 20 69 20 | 26 20 74 72 79 0a 58 09 |ement i |& try.X.|
|00003640| 09 23 20 61 67 61 69 6e | 3b 20 65 6c 73 65 20 62 |.# again|; else b|
|00003650| 72 65 61 6b 20 66 72 6f | 6d 20 74 68 65 20 72 65 |reak fro|m the re|
|00003660| 70 65 61 74 20 6c 6f 6f | 70 2c 20 61 6e 64 2e 2e |peat loo|p, and..|
|00003670| 2e 0a 58 09 09 74 68 65 | 6e 20 6e 65 78 74 20 65 |..X..the|n next e|
|00003680| 6c 73 65 20 62 72 65 61 | 6b 0a 58 09 20 20 20 20 |lse brea|k.X. |
|00003690| 7d 0a 58 20 20 20 20 20 | 20 20 20 20 20 20 20 23 |}.X | #|
|000036a0| 20 2e 2e 2e 72 65 63 6f | 72 64 20 62 6f 74 68 20 | ...reco|rd both |
|000036b0| 74 68 65 20 6f 6c 64 20 | 66 69 6c 65 6e 61 6d 65 |the old |filename|
|000036c0| 20 28 63 68 75 6e 6b 29 | 20 61 6e 64 20 69 74 73 | (chunk)| and its|
|000036d0| 20 6e 65 77 2c 0a 58 09 | 20 20 20 20 23 20 6d 61 | new,.X.| # ma|
|000036e0| 70 70 65 64 20 6e 61 6d | 65 20 28 6c 63 68 75 6e |pped nam|e (lchun|
|000036f0| 6b 29 20 69 6e 20 66 69 | 6c 65 6e 61 6d 65 74 62 |k) in fi|lenametb|
|00003700| 6c 2e 20 20 41 6c 73 6f | 20 72 65 63 6f 72 64 20 |l. Also| record |
|00003710| 74 68 65 0a 58 09 20 20 | 20 20 23 20 6d 61 70 70 |the.X. | # mapp|
|00003720| 65 64 20 6e 61 6d 65 73 | 20 69 6e 20 63 68 75 6e |ed names| in chun|
|00003730| 6b 73 65 74 20 61 6e 64 | 20 73 68 6f 72 74 5f 63 |kset and| short_c|
|00003740| 68 75 6e 6b 73 65 74 2e | 0a 58 09 20 20 20 20 66 |hunkset.|.X. f|
|00003750| 69 6c 65 6e 61 6d 65 74 | 62 6c 5b 63 68 75 6e 6b |ilenamet|bl[chunk|
|00003760| 5d 20 3a 3d 20 6c 63 68 | 75 6e 6b 0a 58 09 20 20 |] := lch|unk.X. |
|00003770| 20 20 69 6e 73 65 72 74 | 28 63 68 75 6e 6b 73 65 | insert|(chunkse|
|00003780| 74 2c 63 68 75 6e 6b 29 | 0a 58 09 20 20 20 20 69 |t,chunk)|.X. i|
|00003790| 6e 73 65 72 74 28 73 68 | 6f 72 74 5f 63 68 75 6e |nsert(sh|ort_chun|
|000037a0| 6b 73 65 74 2c 63 68 75 | 6e 6b 5b 31 3a 31 36 5d |kset,chu|nk[1:16]|
|000037b0| 29 0a 58 09 7d 0a 58 20 | 20 20 20 7d 0a 58 0a 58 |).X.}.X | }.X.X|
|000037c0| 20 20 20 20 23 20 49 66 | 20 74 68 65 20 66 69 6c | # If| the fil|
|000037d0| 65 6e 61 6d 65 20 69 73 | 20 6f 76 65 72 6c 6f 6e |ename is| overlon|
|000037e0| 67 2c 20 72 65 74 75 72 | 6e 20 6c 63 68 75 6e 6b |g, retur|n lchunk|
|000037f0| 20 28 74 68 65 20 73 68 | 6f 72 74 65 6e 65 64 0a | (the sh|ortened.|
|00003800| 58 20 20 20 20 23 20 6e | 61 6d 65 29 2c 20 65 6c |X # n|ame), el|
|00003810| 73 65 20 72 65 74 75 72 | 6e 20 74 68 65 20 6f 72 |se retur|n the or|
|00003820| 69 67 69 6e 61 6c 20 6e | 61 6d 65 20 28 63 68 75 |iginal n|ame (chu|
|00003830| 6e 6b 29 2e 20 20 49 66 | 20 74 68 65 20 6e 61 6d |nk). If| the nam|
|00003840| 65 2c 0a 58 20 20 20 20 | 23 20 61 73 20 70 61 73 |e,.X |# as pas|
|00003850| 73 65 64 20 74 6f 20 74 | 68 65 20 63 75 72 72 65 |sed to t|he curre|
|00003860| 6e 74 20 66 75 6e 63 74 | 69 6f 6e 2c 20 63 6f 6e |nt funct|ion, con|
|00003870| 74 61 69 6e 65 64 20 61 | 20 74 72 61 69 6c 69 6e |tained a| trailin|
|00003880| 67 20 2f 0a 58 20 20 20 | 20 23 20 28 69 2e 65 2e |g /.X | # (i.e.|
|00003890| 20 69 66 20 73 5b 2d 31 | 5d 3d 3d 22 2f 22 29 2c | if s[-1|]=="/"),|
|000038a0| 20 74 68 65 6e 20 70 75 | 74 20 74 68 65 20 2f 20 | then pu|t the / |
|000038b0| 62 61 63 6b 2e 20 20 54 | 68 69 73 20 63 6f 75 6c |back. T|his coul|
|000038c0| 64 20 62 65 0a 58 20 20 | 20 20 23 20 64 6f 6e 65 |d be.X | # done|
|000038d0| 20 6d 6f 72 65 20 65 6c | 65 67 61 6e 74 6c 79 2e | more el|egantly.|
|000038e0| 0a 58 20 20 20 20 72 65 | 74 75 72 6e 20 28 5c 6c |.X re|turn (\l|
|000038f0| 63 68 75 6e 6b 20 7c 20 | 63 68 75 6e 6b 29 20 7c |chunk | |chunk) ||
|00003900| 7c 20 28 28 73 5b 2d 31 | 5d 20 3d 3d 20 22 2f 22 || ((s[-1|] == "/"|
|00003910| 29 20 7c 20 22 22 29 0a | 58 0a 58 65 6e 64 0a 58 |) | "").|X.Xend.X|
|00003920| 0a 58 0a 58 0a 58 70 72 | 6f 63 65 64 75 72 65 20 |.X.X.Xpr|ocedure |
|00003930| 72 65 61 64 74 61 72 68 | 64 72 28 73 29 0a 58 0a |readtarh|dr(s).X.|
|00003940| 58 20 20 20 20 23 20 52 | 65 61 64 20 74 68 65 20 |X # R|ead the |
|00003950| 73 69 6c 6c 79 20 74 61 | 72 20 68 65 61 64 65 72 |silly ta|r header|
|00003960| 20 69 6e 74 6f 20 61 20 | 72 65 63 6f 72 64 2e 20 | into a |record. |
|00003970| 20 4e 6f 74 65 20 74 68 | 61 74 2c 20 61 73 20 77 | Note th|at, as w|
|00003980| 61 73 0a 58 20 20 20 20 | 23 20 63 6f 6d 70 6c 61 |as.X |# compla|
|00003990| 69 6e 65 64 20 61 62 6f | 75 74 20 61 62 6f 76 65 |ined abo|ut above|
|000039a0| 2c 20 73 6f 6d 65 20 6f | 66 20 74 68 65 20 66 69 |, some o|f the fi|
|000039b0| 65 6c 64 73 20 65 6e 64 | 20 69 6e 20 61 20 6e 75 |elds end| in a nu|
|000039c0| 6c 6c 2c 20 73 6f 6d 65 | 0a 58 20 20 20 20 23 20 |ll, some|.X # |
|000039d0| 69 6e 20 61 20 73 70 61 | 63 65 2c 20 61 6e 64 20 |in a spa|ce, and |
|000039e0| 73 6f 6d 65 20 69 6e 20 | 61 20 73 70 61 63 65 20 |some in |a space |
|000039f0| 61 6e 64 20 61 20 6e 75 | 6c 6c 2e 20 20 54 68 65 |and a nu|ll. The|
|00003a00| 20 70 72 6f 63 65 64 75 | 72 65 0a 58 20 20 20 20 | procedu|re.X |
|00003a10| 23 20 74 72 69 6d 5f 73 | 74 72 28 29 20 6d 61 79 |# trim_s|tr() may|
|00003a20| 20 28 61 6e 64 20 69 6e | 20 66 61 63 74 20 6f 66 | (and in| fact of|
|00003a30| 74 65 6e 20 5f 69 73 5f | 29 20 75 73 65 64 20 74 |ten _is_|) used t|
|00003a40| 6f 20 72 65 6d 6f 76 65 | 20 74 68 69 73 0a 58 20 |o remove| this.X |
|00003a50| 20 20 20 23 20 65 78 74 | 72 61 20 67 61 72 62 61 | # ext|ra garba|
|00003a60| 67 65 2e 0a 58 0a 58 20 | 20 20 20 74 68 69 73 5f |ge..X.X | this_|
|00003a70| 62 6c 6f 63 6b 20 3a 3d | 20 68 62 6c 6f 63 6b 28 |block :=| hblock(|
|00003a80| 29 0a 58 20 20 20 20 73 | 20 3f 20 7b 0a 58 09 74 |).X s| ? {.X.t|
|00003a90| 68 69 73 5f 62 6c 6f 63 | 6b 2e 6e 61 6d 65 20 20 |his_bloc|k.name |
|00003aa0| 20 20 20 3a 3d 20 6d 6f | 76 65 28 31 30 30 29 20 | := mo|ve(100) |
|00003ab0| 20 20 20 23 20 3c 2d 20 | 74 6f 20 62 65 20 6c 6f | # <- |to be lo|
|00003ac0| 6f 6b 65 64 20 61 74 20 | 6c 61 74 65 72 0a 58 09 |oked at |later.X.|
|00003ad0| 74 68 69 73 5f 62 6c 6f | 63 6b 2e 6a 75 6e 6b 20 |this_blo|ck.junk |
|00003ae0| 20 20 20 20 3a 3d 20 6d | 6f 76 65 28 38 2b 38 2b | := m|ove(8+8+|
|00003af0| 38 29 20 20 23 20 73 6b | 69 70 20 74 68 65 20 70 |8) # sk|ip the p|
|00003b00| 65 72 6d 69 73 73 69 6f | 6e 73 2c 20 75 69 64 2c |ermissio|ns, uid,|
|00003b10| 20 65 74 63 2e 0a 58 09 | 74 68 69 73 5f 62 6c 6f | etc..X.|this_blo|
|00003b20| 63 6b 2e 73 69 7a 65 20 | 20 20 20 20 3a 3d 20 6d |ck.size | := m|
|00003b30| 6f 76 65 28 31 32 29 20 | 20 20 20 20 23 20 3c 2d |ove(12) | # <-|
|00003b40| 20 74 6f 20 62 65 20 6c | 6f 6f 6b 65 64 20 61 74 | to be l|ooked at|
|00003b50| 20 6c 61 74 65 72 0a 58 | 09 74 68 69 73 5f 62 6c | later.X|.this_bl|
|00003b60| 6f 63 6b 2e 6d 74 69 6d | 65 20 20 20 20 3a 3d 20 |ock.mtim|e := |
|00003b70| 6d 6f 76 65 28 31 32 29 | 0a 58 09 74 68 69 73 5f |move(12)|.X.this_|
|00003b80| 62 6c 6f 63 6b 2e 63 68 | 6b 73 75 6d 20 20 20 3a |block.ch|ksum :|
|00003b90| 3d 20 6d 6f 76 65 28 38 | 29 20 20 20 20 20 20 23 |= move(8|) #|
|00003ba0| 20 3c 2d 20 74 6f 20 62 | 65 20 6c 6f 6f 6b 65 64 | <- to b|e looked|
|00003bb0| 20 61 74 20 6c 61 74 65 | 72 0a 58 09 74 68 69 73 | at late|r.X.this|
|00003bc0| 5f 62 6c 6f 63 6b 2e 6c | 69 6e 6b 66 6c 61 67 20 |_block.l|inkflag |
|00003bd0| 3a 3d 20 6d 6f 76 65 28 | 31 29 0a 58 09 74 68 69 |:= move(|1).X.thi|
|00003be0| 73 5f 62 6c 6f 63 6b 2e | 6c 69 6e 6b 6e 61 6d 65 |s_block.|linkname|
|00003bf0| 20 3a 3d 20 6d 6f 76 65 | 28 31 30 30 29 20 20 20 | := move|(100) |
|00003c00| 20 23 20 3c 2d 20 74 6f | 20 62 65 20 6c 6f 6f 6b | # <- to| be look|
|00003c10| 65 64 20 61 74 20 6c 61 | 74 65 72 0a 58 09 74 68 |ed at la|ter.X.th|
|00003c20| 69 73 5f 62 6c 6f 63 6b | 2e 74 68 65 72 65 73 74 |is_block|.therest|
|00003c30| 20 20 3a 3d 20 74 61 62 | 28 30 29 0a 58 20 20 20 | := tab|(0).X |
|00003c40| 20 7d 0a 58 20 20 20 20 | 69 6e 74 65 67 65 72 28 | }.X |integer(|
|00003c50| 74 68 69 73 5f 62 6c 6f | 63 6b 2e 73 69 7a 65 29 |this_blo|ck.size)|
|00003c60| 20 7c 20 66 61 69 6c 20 | 20 23 20 49 66 20 69 74 | | fail | # If it|
|00003c70| 27 73 20 6e 6f 74 20 61 | 6e 20 69 6e 74 65 67 65 |'s not a|n intege|
|00003c80| 72 2c 20 77 65 27 76 65 | 20 68 69 74 0a 58 20 20 |r, we've| hit.X |
|00003c90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003ca0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003cb0| 20 20 20 23 20 74 68 65 | 20 66 69 6e 61 6c 20 28 | # the| final (|
|00003cc0| 6e 75 6c 6c 2d 66 69 6c | 6c 65 64 29 20 62 6c 6f |null-fil|led) blo|
|00003cd0| 63 6b 2e 0a 58 20 20 20 | 20 72 65 74 75 72 6e 20 |ck..X | return |
|00003ce0| 74 68 69 73 5f 62 6c 6f | 63 6b 0a 58 0a 58 65 6e |this_blo|ck.X.Xen|
|00003cf0| 64 0a 58 0a 58 0a 58 0a | 58 70 72 6f 63 65 64 75 |d.X.X.X.|Xprocedu|
|00003d00| 72 65 20 6d 61 70 5f 66 | 69 6c 65 6e 61 6d 73 28 |re map_f|ilenams(|
|00003d10| 73 29 0a 58 0a 58 20 20 | 20 20 23 20 43 68 75 6e |s).X.X | # Chun|
|00003d20| 6b 73 65 74 20 69 73 20 | 67 6c 6f 62 61 6c 2c 20 |kset is |global, |
|00003d30| 61 6e 64 20 63 6f 6e 74 | 61 69 6e 73 20 61 6c 6c |and cont|ains all|
|00003d40| 20 74 68 65 20 6f 76 65 | 72 6c 6f 6e 67 20 66 69 | the ove|rlong fi|
|00003d50| 6c 65 6e 61 6d 65 73 0a | 58 20 20 20 20 23 20 66 |lenames.|X # f|
|00003d60| 6f 75 6e 64 20 69 6e 20 | 74 68 65 20 66 69 72 73 |ound in |the firs|
|00003d70| 74 20 70 61 73 73 20 74 | 68 72 6f 75 67 68 20 74 |t pass t|hrough t|
|00003d80| 68 65 20 69 6e 70 75 74 | 20 66 69 6c 65 3b 20 68 |he input| file; h|
|00003d90| 65 72 65 20 74 68 65 20 | 61 69 6d 0a 58 20 20 20 |ere the |aim.X |
|00003da0| 20 23 20 69 73 20 74 6f | 20 6d 61 70 20 74 68 65 | # is to| map the|
|00003db0| 73 65 20 66 69 6c 65 6e | 61 6d 65 73 20 74 6f 20 |se filen|ames to |
|00003dc0| 74 68 65 20 73 68 6f 72 | 74 65 6e 65 64 20 76 61 |the shor|tened va|
|00003dd0| 72 69 61 6e 74 73 20 61 | 73 20 73 74 6f 72 65 64 |riants a|s stored|
|00003de0| 0a 58 20 20 20 20 23 20 | 69 6e 20 66 69 6c 65 6e |.X # |in filen|
|00003df0| 61 6d 65 74 62 6c 20 28 | 47 4c 4f 42 41 4c 29 2e |ametbl (|GLOBAL).|
|00003e00| 0a 58 0a 58 20 20 20 20 | 6c 6f 63 61 6c 20 73 32 |.X.X |local s2|
|00003e10| 2c 20 74 6d 70 5f 63 68 | 75 6e 6b 5f 74 62 6c 2c |, tmp_ch|unk_tbl,|
|00003e20| 20 74 6d 70 5f 6c 73 74 | 0a 58 20 20 20 20 73 74 | tmp_lst|.X st|
|00003e30| 61 74 69 63 20 6e 65 77 | 5f 63 68 75 6e 6b 6c 69 |atic new|_chunkli|
|00003e40| 73 74 0a 58 20 20 20 20 | 69 6e 69 74 69 61 6c 20 |st.X |initial |
|00003e50| 7b 0a 58 0a 58 20 20 20 | 20 20 20 20 20 23 20 4d |{.X.X | # M|
|00003e60| 61 6b 65 20 73 75 72 65 | 20 66 69 6c 65 6e 61 6d |ake sure| filenam|
|00003e70| 65 73 20 61 72 65 20 73 | 6f 72 74 65 64 2c 20 6c |es are s|orted, l|
|00003e80| 6f 6e 67 65 73 74 20 66 | 69 72 73 74 2e 20 20 53 |ongest f|irst. S|
|00003e90| 61 79 20 77 65 0a 58 20 | 20 20 20 20 20 20 20 23 |ay we.X | #|
|00003ea0| 20 68 61 76 65 20 61 20 | 66 69 6c 65 20 63 61 6c | have a |file cal|
|00003eb0| 6c 65 64 20 6c 6f 6e 67 | 5f 66 69 6c 65 5f 6e 61 |led long|_file_na|
|00003ec0| 6d 65 5f 68 65 72 65 2e | 31 20 61 6e 64 20 6f 6e |me_here.|1 and on|
|00003ed0| 65 20 63 61 6c 6c 65 64 | 0a 58 20 20 20 20 20 20 |e called|.X |
|00003ee0| 20 20 23 20 6c 6f 6e 67 | 5f 66 69 6c 65 5f 6e 61 | # long|_file_na|
|00003ef0| 6d 65 5f 68 65 72 65 2e | 31 61 2e 20 20 57 65 20 |me_here.|1a. We |
|00003f00| 77 61 6e 74 20 74 6f 20 | 63 68 65 63 6b 20 66 6f |want to |check fo|
|00003f10| 72 20 74 68 65 20 6c 6f | 6e 67 65 72 0a 58 20 20 |r the lo|nger.X |
|00003f20| 20 20 20 20 20 20 23 20 | 6f 6e 65 20 66 69 72 73 | # |one firs|
|00003f30| 74 2e 20 20 4f 74 68 65 | 72 77 69 73 65 20 74 68 |t. Othe|rwise th|
|00003f40| 65 20 70 6f 72 74 69 6f | 6e 20 6f 66 20 74 68 65 |e portio|n of the|
|00003f50| 20 73 65 63 6f 6e 64 20 | 66 69 6c 65 20 77 68 69 | second |file whi|
|00003f60| 63 68 0a 58 20 20 20 20 | 20 20 20 20 23 20 6d 61 |ch.X | # ma|
|00003f70| 74 63 68 65 73 20 74 68 | 65 20 66 69 72 73 74 20 |tches th|e first |
|00003f80| 66 69 6c 65 20 77 69 6c | 6c 20 67 65 74 20 72 65 |file wil|l get re|
|00003f90| 6d 61 70 70 65 64 2e 0a | 58 20 20 20 20 20 20 20 |mapped..|X |
|00003fa0| 20 74 6d 70 5f 63 68 75 | 6e 6b 5f 74 62 6c 20 3a | tmp_chu|nk_tbl :|
|00003fb0| 3d 20 74 61 62 6c 65 28 | 29 0a 58 20 20 20 20 20 |= table(|).X |
|00003fc0| 20 20 20 65 76 65 72 79 | 20 65 6c 20 3a 3d 20 21 | every| el := !|
|00003fd0| 63 68 75 6e 6b 73 65 74 | 0a 58 20 20 20 20 20 20 |chunkset|.X |
|00003fe0| 20 20 64 6f 20 69 6e 73 | 65 72 74 28 74 6d 70 5f | do ins|ert(tmp_|
|00003ff0| 63 68 75 6e 6b 5f 74 62 | 6c 2c 65 6c 2c 2a 65 6c |chunk_tb|l,el,*el|
|00004000| 29 0a 58 20 20 20 20 20 | 20 20 20 74 6d 70 5f 6c |).X | tmp_l|
|00004010| 73 74 20 3a 3d 20 73 6f | 72 74 28 74 6d 70 5f 63 |st := so|rt(tmp_c|
|00004020| 68 75 6e 6b 5f 74 62 6c | 2c 34 29 0a 58 20 20 20 |hunk_tbl|,4).X |
|00004030| 20 20 20 20 20 6e 65 77 | 5f 63 68 75 6e 6b 6c 69 | new|_chunkli|
|00004040| 73 74 20 3a 3d 20 6c 69 | 73 74 28 29 0a 58 20 20 |st := li|st().X |
|00004050| 20 20 20 20 20 20 65 76 | 65 72 79 20 70 75 74 28 | ev|ery put(|
|00004060| 6e 65 77 5f 63 68 75 6e | 6b 6c 69 73 74 2c 74 6d |new_chun|klist,tm|
|00004070| 70 5f 6c 73 74 5b 2a 74 | 6d 70 5f 6c 73 74 2d 31 |p_lst[*t|mp_lst-1|
|00004080| 20 74 6f 20 31 20 62 79 | 20 2d 32 5d 29 0a 58 0a | to 1 by| -2]).X.|
|00004090| 58 20 20 20 20 7d 0a 58 | 0a 58 20 20 20 20 73 32 |X }.X|.X s2|
|000040a0| 20 3a 3d 20 22 22 0a 58 | 20 20 20 20 73 20 3f 20 | := "".X| s ? |
|000040b0| 7b 0a 58 09 75 6e 74 69 | 6c 20 70 6f 73 28 30 29 |{.X.unti|l pos(0)|
|000040c0| 20 64 6f 20 7b 0a 58 09 | 20 20 20 20 23 20 66 69 | do {.X.| # fi|
|000040d0| 72 73 74 20 6e 61 72 72 | 6f 77 20 74 68 65 20 70 |rst narr|ow the p|
|000040e0| 6f 73 73 69 62 69 6c 69 | 74 69 65 73 2c 20 75 73 |ossibili|ties, us|
|000040f0| 69 6e 67 20 73 68 6f 72 | 74 5f 63 68 75 6e 6b 73 |ing shor|t_chunks|
|00004100| 65 74 0a 58 09 20 20 20 | 20 69 66 20 6d 65 6d 62 |et.X. | if memb|
|00004110| 65 72 28 73 68 6f 72 74 | 5f 63 68 75 6e 6b 73 65 |er(short|_chunkse|
|00004120| 74 2c 26 73 75 62 6a 65 | 63 74 5b 26 70 6f 73 3a |t,&subje|ct[&pos:|
|00004130| 26 70 6f 73 2b 31 35 5d | 29 0a 58 20 20 20 20 20 |&pos+15]|).X |
|00004140| 20 20 20 20 20 20 20 23 | 20 74 68 65 6e 20 74 72 | #| then tr|
|00004150| 79 20 74 6f 20 6d 61 70 | 20 66 72 6f 6d 20 61 20 |y to map| from a |
|00004160| 6c 6f 6e 67 20 74 6f 20 | 61 20 73 68 6f 72 74 65 |long to |a shorte|
|00004170| 72 20 31 34 2d 63 68 61 | 72 20 66 69 6c 65 6e 61 |r 14-cha|r filena|
|00004180| 6d 65 0a 58 09 20 20 20 | 20 74 68 65 6e 20 7b 0a |me.X. | then {.|
|00004190| 58 09 09 69 66 20 6d 61 | 74 63 68 28 63 68 20 3a |X..if ma|tch(ch :|
|000041a0| 3d 20 21 6e 65 77 5f 63 | 68 75 6e 6b 6c 69 73 74 |= !new_c|hunklist|
|000041b0| 29 20 26 20 6e 6f 74 20 | 6d 61 74 63 68 28 21 6e |) & not |match(!n|
|000041c0| 6f 5f 6e 6f 73 29 0a 58 | 09 09 74 68 65 6e 20 73 |o_nos).X|..then s|
|000041d0| 32 20 7c 7c 3a 3d 20 66 | 69 6c 65 6e 61 6d 65 74 |2 ||:= f|ilenamet|
|000041e0| 62 6c 5b 3d 63 68 5d 0a | 58 09 09 65 6c 73 65 20 |bl[=ch].|X..else |
|000041f0| 73 32 20 7c 7c 3a 3d 20 | 6d 6f 76 65 28 31 29 0a |s2 ||:= |move(1).|
|00004200| 58 09 20 20 20 20 7d 0a | 58 09 20 20 20 20 65 6c |X. }.|X. el|
|00004210| 73 65 20 73 32 20 7c 7c | 3a 3d 20 6d 6f 76 65 28 |se s2 |||:= move(|
|00004220| 31 29 0a 58 09 7d 0a 58 | 20 20 20 20 7d 0a 58 20 |1).X.}.X| }.X |
|00004230| 20 20 20 72 65 74 75 72 | 6e 20 73 32 0a 58 0a 58 | retur|n s2.X.X|
|00004240| 65 6e 64 0a 58 0a 58 0a | 58 23 20 20 46 72 6f 6d |end.X.X.|X# From|
|00004250| 20 74 68 65 20 49 50 4c | 2e 20 20 54 68 61 6e 6b | the IPL|. Thank|
|00004260| 73 2c 20 52 61 6c 70 68 | 20 2d 0a 58 23 20 20 41 |s, Ralph| -.X# A|
|00004270| 75 74 68 6f 72 3a 20 20 | 52 61 6c 70 68 20 45 2e |uthor: |Ralph E.|
|00004280| 20 47 72 69 73 77 6f 6c | 64 0a 58 23 20 20 44 61 | Griswol|d.X# Da|
|00004290| 74 65 3a 20 20 4a 75 6e | 65 20 31 30 2c 20 31 39 |te: Jun|e 10, 19|
|000042a0| 38 38 0a 58 23 20 20 65 | 78 62 61 73 65 31 30 28 |88.X# e|xbase10(|
|000042b0| 69 2c 6a 29 20 63 6f 6e | 76 65 72 74 20 62 61 73 |i,j) con|vert bas|
|000042c0| 65 2d 31 30 20 69 6e 74 | 65 67 65 72 20 69 20 74 |e-10 int|eger i t|
|000042d0| 6f 20 62 61 73 65 20 6a | 0a 58 23 20 20 54 68 65 |o base j|.X# The|
|000042e0| 20 6d 61 78 69 6d 75 6d | 20 62 61 73 65 20 61 6c | maximum| base al|
|000042f0| 6c 6f 77 65 64 20 69 73 | 20 33 36 2e 0a 58 0a 58 |lowed is| 36..X.X|
|00004300| 70 72 6f 63 65 64 75 72 | 65 20 65 78 62 61 73 65 |procedur|e exbase|
|00004310| 31 30 28 69 2c 6a 29 0a | 58 0a 58 20 20 20 73 74 |10(i,j).|X.X st|
|00004320| 61 74 69 63 20 64 69 67 | 69 74 73 0a 58 20 20 20 |atic dig|its.X |
|00004330| 6c 6f 63 61 6c 20 73 2c | 20 64 2c 20 73 69 67 6e |local s,| d, sign|
|00004340| 0a 58 20 20 20 69 6e 69 | 74 69 61 6c 20 64 69 67 |.X ini|tial dig|
|00004350| 69 74 73 20 3a 3d 20 26 | 64 69 67 69 74 73 20 7c |its := &|digits ||
|00004360| 7c 20 26 6c 63 61 73 65 | 0a 58 20 20 20 69 66 20 || &lcase|.X if |
|00004370| 69 20 3d 20 30 20 74 68 | 65 6e 20 72 65 74 75 72 |i = 0 th|en retur|
|00004380| 6e 20 30 0a 58 20 20 20 | 69 66 20 69 20 3c 20 30 |n 0.X |if i < 0|
|00004390| 20 74 68 65 6e 20 7b 0a | 58 20 20 20 20 20 20 73 | then {.|X s|
|000043a0| 69 67 6e 20 3a 3d 20 22 | 2d 22 0a 58 20 20 20 20 |ign := "|-".X |
|000043b0| 20 20 69 20 3a 3d 20 2d | 69 0a 58 20 20 20 20 20 | i := -|i.X |
|000043c0| 20 7d 0a 58 20 20 20 65 | 6c 73 65 20 73 69 67 6e | }.X e|lse sign|
|000043d0| 20 3a 3d 20 22 22 0a 58 | 20 20 20 73 20 3a 3d 20 | := "".X| s := |
|000043e0| 22 22 0a 58 20 20 20 77 | 68 69 6c 65 20 69 20 3e |"".X w|hile i >|
|000043f0| 20 30 20 64 6f 20 7b 0a | 58 20 20 20 20 20 20 64 | 0 do {.|X d|
|00004400| 20 3a 3d 20 69 20 25 20 | 6a 0a 58 20 20 20 20 20 | := i % |j.X |
|00004410| 20 69 66 20 64 20 3e 20 | 39 20 74 68 65 6e 20 64 | if d > |9 then d|
|00004420| 20 3a 3d 20 64 69 67 69 | 74 73 5b 64 20 2b 20 31 | := digi|ts[d + 1|
|00004430| 5d 0a 58 20 20 20 20 20 | 20 73 20 3a 3d 20 64 20 |].X | s := d |
|00004440| 7c 7c 20 73 0a 58 20 20 | 20 20 20 20 69 20 2f 3a ||| s.X | i /:|
|00004450| 3d 20 6a 0a 58 20 20 20 | 20 20 20 7d 0a 58 20 20 |= j.X | }.X |
|00004460| 20 72 65 74 75 72 6e 20 | 73 69 67 6e 20 7c 7c 20 | return |sign || |
|00004470| 73 0a 58 0a 58 65 6e 64 | 0a 58 0a 58 23 20 65 6e |s.X.Xend|.X.X# en|
|00004480| 64 20 49 50 4c 20 6d 61 | 74 65 72 69 61 6c 0a 58 |d IPL ma|terial.X|
|00004490| 0a 58 0a 58 70 72 6f 63 | 65 64 75 72 65 20 67 65 |.X.Xproc|edure ge|
|000044a0| 74 5f 63 68 65 63 6b 73 | 75 6d 28 72 29 0a 58 20 |t_checks|um(r).X |
|000044b0| 0a 58 20 20 20 20 23 20 | 43 61 6c 63 75 6c 61 74 |.X # |Calculat|
|000044c0| 65 73 20 74 68 65 20 6e | 65 77 20 76 61 6c 75 65 |es the n|ew value|
|000044d0| 20 6f 66 20 74 68 65 20 | 63 68 65 63 6b 73 75 6d | of the |checksum|
|000044e0| 20 66 69 65 6c 64 20 66 | 6f 72 20 74 68 65 0a 58 | field f|or the.X|
|000044f0| 20 20 20 20 23 20 63 75 | 72 72 65 6e 74 20 68 65 | # cu|rrent he|
|00004500| 61 64 65 72 20 62 6c 6f | 63 6b 2e 20 20 4e 6f 74 |ader blo|ck. Not|
|00004510| 65 20 74 68 61 74 20 74 | 68 65 20 73 70 65 63 69 |e that t|he speci|
|00004520| 66 69 63 61 74 69 6f 6e | 20 73 61 79 0a 58 20 20 |fication| say.X |
|00004530| 20 20 23 20 74 68 61 74 | 2c 20 77 68 65 6e 20 63 | # that|, when c|
|00004540| 61 6c 63 75 6c 61 74 69 | 6e 67 20 74 68 69 73 20 |alculati|ng this |
|00004550| 76 61 6c 75 65 2c 20 74 | 68 65 20 63 68 6b 73 75 |value, t|he chksu|
|00004560| 6d 20 66 69 65 6c 64 20 | 6d 75 73 74 0a 58 20 20 |m field |must.X |
|00004570| 20 20 23 20 62 65 20 62 | 6c 61 6e 6b 2d 66 69 6c | # be b|lank-fil|
|00004580| 6c 65 64 2e 0a 58 0a 58 | 20 20 20 20 73 75 6d 20 |led..X.X| sum |
|00004590| 3a 3d 20 30 0a 58 20 20 | 20 20 72 2e 63 68 6b 73 |:= 0.X | r.chks|
|000045a0| 75 6d 20 3a 3d 20 22 20 | 20 20 20 20 20 20 20 22 |um := " | "|
|000045b0| 0a 58 20 20 20 20 65 76 | 65 72 79 20 66 69 65 6c |.X ev|ery fiel|
|000045c0| 64 20 3a 3d 20 21 72 0a | 58 20 20 20 20 64 6f 20 |d := !r.|X do |
|000045d0| 65 76 65 72 79 20 73 75 | 6d 20 2b 3a 3d 20 6f 72 |every su|m +:= or|
|000045e0| 64 28 21 66 69 65 6c 64 | 29 0a 58 20 20 20 20 72 |d(!field|).X r|
|000045f0| 65 74 75 72 6e 20 73 75 | 6d 0a 58 0a 58 65 6e 64 |eturn su|m.X.Xend|
|00004600| 0a 58 0a 58 0a 58 0a 58 | 70 72 6f 63 65 64 75 72 |.X.X.X.X|procedur|
|00004610| 65 20 77 72 69 74 65 5f | 72 65 70 6f 72 74 28 29 |e write_|report()|
|00004620| 0a 58 0a 58 20 20 20 20 | 23 20 54 68 69 73 20 70 |.X.X |# This p|
|00004630| 72 6f 63 65 64 75 72 65 | 20 77 72 69 74 65 73 20 |rocedure| writes |
|00004640| 6f 75 74 20 61 20 6c 69 | 73 74 20 6f 66 20 66 69 |out a li|st of fi|
|00004650| 6c 65 6e 61 6d 65 73 20 | 77 68 69 63 68 20 77 65 |lenames |which we|
|00004660| 72 65 0a 58 20 20 20 20 | 23 20 72 65 6d 61 70 70 |re.X |# remapp|
|00004670| 65 64 20 28 62 65 63 61 | 75 73 65 20 74 68 65 79 |ed (beca|use they|
|00004680| 20 65 78 63 65 65 64 65 | 64 20 74 68 65 20 53 79 | exceede|d the Sy|
|00004690| 73 56 20 31 34 2d 63 68 | 61 72 20 6c 69 6d 69 74 |sV 14-ch|ar limit|
|000046a0| 29 2c 0a 58 20 20 20 20 | 23 20 61 6e 64 20 74 68 |),.X |# and th|
|000046b0| 65 6e 20 6e 6f 74 69 66 | 69 65 73 20 74 68 65 20 |en notif|ies the |
|000046c0| 75 73 65 72 20 6f 66 20 | 74 68 65 20 65 78 69 73 |user of |the exis|
|000046d0| 74 65 6e 63 65 20 6f 66 | 20 74 68 69 73 20 66 69 |tence of| this fi|
|000046e0| 6c 65 2e 0a 58 0a 58 20 | 20 20 20 6c 6f 63 61 6c |le..X.X | local|
|000046f0| 20 6f 75 74 74 65 78 74 | 2c 20 73 74 62 6c 2c 20 | outtext|, stbl, |
|00004700| 69 2c 20 6a 2c 20 6d 61 | 70 66 69 6c 65 5f 6e 61 |i, j, ma|pfile_na|
|00004710| 6d 65 0a 58 0a 58 20 20 | 20 20 23 20 47 65 74 20 |me.X.X | # Get |
|00004720| 61 20 75 6e 69 71 75 65 | 20 6e 61 6d 65 20 66 6f |a unique| name fo|
|00004730| 72 20 74 68 65 20 6d 61 | 70 2e 72 65 70 6f 72 74 |r the ma|p.report|
|00004740| 20 28 74 68 65 72 65 62 | 79 20 70 72 65 76 65 6e | (thereb|y preven|
|00004750| 74 69 6e 67 0a 58 20 20 | 20 20 23 20 75 73 20 66 |ting.X | # us f|
|00004760| 72 6f 6d 20 6f 76 65 72 | 77 72 69 74 69 6e 67 20 |rom over|writing |
|00004770| 61 6e 20 6f 6c 64 65 72 | 20 6f 6e 65 29 2e 0a 58 |an older| one)..X|
|00004780| 20 20 20 20 6d 61 70 66 | 69 6c 65 5f 6e 61 6d 65 | mapf|ile_name|
|00004790| 20 3a 3d 20 22 6d 61 70 | 2e 72 65 70 6f 72 74 22 | := "map|.report"|
|000047a0| 3b 20 6a 20 3a 3d 20 31 | 0a 58 20 20 20 20 75 6e |; j := 1|.X un|
|000047b0| 74 69 6c 20 6e 6f 74 20 | 63 6c 6f 73 65 28 6f 70 |til not |close(op|
|000047c0| 65 6e 28 6d 61 70 66 69 | 6c 65 5f 6e 61 6d 65 2c |en(mapfi|le_name,|
|000047d0| 22 72 22 29 29 0a 58 20 | 20 20 20 64 6f 20 6d 61 |"r")).X | do ma|
|000047e0| 70 66 69 6c 65 5f 6e 61 | 6d 65 20 3a 3d 20 28 6d |pfile_na|me := (m|
|000047f0| 61 70 66 69 6c 65 5f 6e | 61 6d 65 5b 31 3a 31 31 |apfile_n|ame[1:11|
|00004800| 5d 20 7c 7c 20 73 74 72 | 69 6e 67 28 6a 2b 3a 3d |] || str|ing(j+:=|
|00004810| 31 29 29 0a 58 0a 58 20 | 20 20 20 28 6f 75 74 74 |1)).X.X | (outt|
|00004820| 65 78 74 20 3a 3d 20 6f | 70 65 6e 28 6d 61 70 66 |ext := o|pen(mapf|
|00004830| 69 6c 65 5f 6e 61 6d 65 | 2c 22 77 22 29 29 20 7c |ile_name|,"w")) ||
|00004840| 0a 58 09 6f 70 65 6e 28 | 6d 61 70 66 69 6c 65 5f |.X.open(|mapfile_|
|00004850| 6e 61 6d 65 20 3a 3d 20 | 22 2f 74 6d 70 2f 6d 61 |name := |"/tmp/ma|
|00004860| 70 2e 72 65 70 6f 72 74 | 22 2c 22 77 22 29 20 7c |p.report|","w") ||
|00004870| 0a 58 09 20 20 20 20 20 | 73 74 6f 70 28 22 6d 74 |.X. |stop("mt|
|00004880| 66 3a 20 20 43 61 6e 27 | 74 20 66 69 6e 64 20 61 |f: Can'|t find a|
|00004890| 20 70 6c 61 63 65 20 74 | 6f 20 70 75 74 20 6d 61 | place t|o put ma|
|000048a0| 70 2e 72 65 70 6f 72 74 | 21 22 29 0a 58 20 20 20 |p.report|!").X |
|000048b0| 20 73 74 62 6c 20 3a 3d | 20 73 6f 72 74 28 66 69 | stbl :=| sort(fi|
|000048c0| 6c 65 6e 61 6d 65 74 62 | 6c 2c 33 29 0a 58 20 20 |lenametb|l,3).X |
|000048d0| 20 20 65 76 65 72 79 20 | 69 20 3a 3d 20 31 20 74 | every |i := 1 t|
|000048e0| 6f 20 2a 73 74 62 6c 20 | 2d 31 20 62 79 20 32 20 |o *stbl |-1 by 2 |
|000048f0| 64 6f 20 7b 0a 58 09 6d | 61 74 63 68 28 21 6e 6f |do {.X.m|atch(!no|
|00004900| 5f 6e 6f 73 2c 73 74 62 | 6c 5b 69 5d 29 20 7c 0a |_nos,stb|l[i]) |.|
|00004910| 58 09 20 20 20 20 77 72 | 69 74 65 28 6f 75 74 74 |X. wr|ite(outt|
|00004920| 65 78 74 2c 6c 65 66 74 | 28 73 74 62 6c 5b 69 5d |ext,left|(stbl[i]|
|00004930| 2c 33 35 2c 22 20 22 29 | 2c 22 20 22 2c 73 74 62 |,35," ")|," ",stb|
|00004940| 6c 5b 69 2b 31 5d 29 0a | 58 20 20 20 20 7d 0a 58 |l[i+1]).|X }.X|
|00004950| 20 20 20 20 77 72 69 74 | 65 28 26 65 72 72 6f 75 | writ|e(&errou|
|00004960| 74 2c 22 5c 6e 6d 74 66 | 3a 20 20 22 2c 6d 61 70 |t,"\nmtf|: ",map|
|00004970| 66 69 6c 65 5f 6e 61 6d | 65 2c 22 20 63 6f 6e 74 |file_nam|e," cont|
|00004980| 61 69 6e 73 20 74 68 65 | 20 6c 69 73 74 20 6f 66 |ains the| list of|
|00004990| 20 63 68 61 6e 67 65 73 | 2e 22 29 0a 58 20 20 20 | changes|.").X |
|000049a0| 20 77 72 69 74 65 28 26 | 65 72 72 6f 75 74 2c 22 | write(&|errout,"|
|000049b0| 20 20 20 20 20 20 50 6c | 65 61 73 65 20 73 61 76 | Pl|ease sav|
|000049c0| 65 20 74 68 69 73 20 6c | 69 73 74 21 22 29 0a 58 |e this l|ist!").X|
|000049d0| 20 20 20 20 63 6c 6f 73 | 65 28 6f 75 74 74 65 78 | clos|e(outtex|
|000049e0| 74 29 0a 58 20 20 20 20 | 72 65 74 75 72 6e 20 26 |t).X |return &|
|000049f0| 6e 75 6c 6c 0a 58 0a 58 | 65 6e 64 0a 53 48 41 52 |null.X.X|end.SHAR|
|00004a00| 5f 45 4f 46 0a 74 72 75 | 65 20 7c 7c 20 65 63 68 |_EOF.tru|e || ech|
|00004a10| 6f 20 27 72 65 73 74 6f | 72 65 20 6f 66 20 6d 74 |o 'resto|re of mt|
|00004a20| 66 2e 69 63 6e 20 66 61 | 69 6c 65 64 27 0a 72 6d |f.icn fa|iled'.rm|
|00004a30| 20 2d 66 20 5f 73 68 61 | 72 5f 77 6e 74 5f 2e 74 | -f _sha|r_wnt_.t|
|00004a40| 6d 70 0a 66 69 0a 23 20 | 3d 3d 3d 3d 3d 3d 3d 3d |mp.fi.# |========|
|00004a50| 3d 3d 3d 3d 3d 20 52 45 | 41 44 4d 45 20 3d 3d 3d |===== RE|ADME ===|
|00004a60| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 0a 69 66 20 74 |========|===.if t|
|00004a70| 65 73 74 20 2d 66 20 27 | 52 45 41 44 4d 45 27 20 |est -f '|README' |
|00004a80| 2d 61 20 58 22 24 31 22 | 20 21 3d 20 58 22 2d 63 |-a X"$1"| != X"-c|
|00004a90| 22 3b 20 74 68 65 6e 0a | 09 65 63 68 6f 20 27 78 |"; then.|.echo 'x|
|00004aa0| 20 2d 20 73 6b 69 70 70 | 69 6e 67 20 52 45 41 44 | - skipp|ing READ|
|00004ab0| 4d 45 20 28 46 69 6c 65 | 20 61 6c 72 65 61 64 79 |ME (File| already|
|00004ac0| 20 65 78 69 73 74 73 29 | 27 0a 09 72 6d 20 2d 66 | exists)|'..rm -f|
|00004ad0| 20 5f 73 68 61 72 5f 77 | 6e 74 5f 2e 74 6d 70 0a | _shar_w|nt_.tmp.|
|00004ae0| 65 6c 73 65 0a 3e 20 5f | 73 68 61 72 5f 77 6e 74 |else.> _|shar_wnt|
|00004af0| 5f 2e 74 6d 70 0a 65 63 | 68 6f 20 27 78 20 2d 20 |_.tmp.ec|ho 'x - |
|00004b00| 65 78 74 72 61 63 74 69 | 6e 67 20 52 45 41 44 4d |extracti|ng READM|
|00004b10| 45 20 28 54 65 78 74 29 | 27 0a 73 65 64 20 27 73 |E (Text)|'.sed 's|
|00004b20| 2f 5e 58 2f 2f 27 20 3c | 3c 20 27 53 48 41 52 5f |/^X//' <|< 'SHAR_|
|00004b30| 45 4f 46 27 20 3e 20 27 | 52 45 41 44 4d 45 27 20 |EOF' > '|README' |
|00004b40| 26 26 0a 58 4e 41 4d 45 | 3a 20 20 6d 74 66 0a 58 |&&.XNAME|: mtf.X|
|00004b50| 0a 58 4c 41 4e 47 55 41 | 47 45 3a 20 20 49 63 6f |.XLANGUA|GE: Ico|
|00004b60| 6e 0a 58 0a 58 41 55 54 | 48 4f 52 3a 20 20 52 69 |n.X.XAUT|HOR: Ri|
|00004b70| 63 68 61 72 64 20 47 6f | 65 72 77 69 74 7a 20 28 |chard Go|erwitz (|
|00004b80| 67 6f 65 72 40 73 6f 70 | 68 69 73 74 2e 75 63 68 |goer@sop|hist.uch|
|00004b90| 69 63 61 67 6f 2e 65 64 | 75 29 0a 58 0a 58 50 55 |icago.ed|u).X.XPU|
|00004ba0| 52 50 4f 53 45 3a 20 20 | 4d 61 70 73 20 31 35 2b |RPOSE: |Maps 15+|
|00004bb0| 20 63 68 61 72 2e 20 66 | 69 6c 65 6e 61 6d 65 73 | char. f|ilenames|
|00004bc0| 20 69 6e 20 61 20 74 61 | 72 20 61 72 63 68 69 76 | in a ta|r archiv|
|00004bd0| 65 20 74 6f 20 31 34 20 | 63 68 61 72 73 2e 0a 58 |e to 14 |chars..X|
|00004be0| 48 61 6e 64 6c 65 73 20 | 62 6f 74 68 20 68 65 61 |Handles |both hea|
|00004bf0| 64 65 72 20 62 6c 6f 63 | 6b 73 20 61 6e 64 20 74 |der bloc|ks and t|
|00004c00| 68 65 20 61 72 63 68 69 | 76 65 20 69 74 73 65 6c |he archi|ve itsel|
|00004c10| 66 2e 20 20 4d 74 66 20 | 69 73 20 69 6e 74 65 6e |f. Mtf |is inten|
|00004c20| 64 65 64 20 74 6f 0a 58 | 66 61 63 69 6c 69 74 61 |ded to.X|facilita|
|00004c30| 74 65 20 69 6e 73 74 61 | 6c 6c 61 74 69 6f 6e 20 |te insta|llation |
|00004c40| 6f 66 20 74 61 72 27 64 | 20 61 72 63 68 69 76 65 |of tar'd| archive|
|00004c50| 73 20 6f 6e 20 73 79 73 | 74 65 6d 73 20 73 75 62 |s on sys|tems sub|
|00004c60| 6a 65 63 74 20 74 6f 20 | 61 0a 58 31 34 2d 63 68 |ject to |a.X14-ch|
|00004c70| 61 72 61 63 74 65 72 20 | 66 69 6c 65 6e 61 6d 65 |aracter |filename|
|00004c80| 20 6c 69 6d 69 74 2e 0a | 58 0a 58 49 4e 53 54 41 | limit..|X.XINSTA|
|00004c90| 4c 4c 41 54 49 4f 4e 3a | 20 20 43 70 20 4d 61 6b |LLATION:| Cp Mak|
|00004ca0| 65 66 69 6c 65 2e 64 69 | 73 74 20 74 6f 20 4d 61 |efile.di|st to Ma|
|00004cb0| 6b 65 66 69 6c 65 20 61 | 6e 64 20 6d 61 6b 65 2e |kefile a|nd make.|
|00004cc0| 20 20 49 66 20 61 6c 6c | 20 67 6f 65 73 0a 58 77 | If all| goes.Xw|
|00004cd0| 65 6c 6c 2c 20 61 6e 64 | 20 79 6f 75 20 68 61 76 |ell, and| you hav|
|00004ce0| 65 20 72 6f 6f 74 20 70 | 72 69 76 69 6c 65 64 67 |e root p|riviledg|
|00004cf0| 65 73 2c 20 65 64 69 74 | 20 74 68 65 20 4d 61 6b |es, edit| the Mak|
|00004d00| 65 66 69 6c 65 20 74 6f | 20 72 65 66 6c 65 63 74 |efile to| reflect|
|00004d10| 0a 58 79 6f 75 72 20 6c | 6f 63 61 6c 20 66 69 6c |.Xyour l|ocal fil|
|00004d20| 65 20 73 74 72 75 63 74 | 75 72 65 2c 20 61 6e 64 |e struct|ure, and|
|00004d30| 20 6d 61 6b 65 20 69 6e | 73 74 61 6c 6c 2e 0a 58 | make in|stall..X|
|00004d40| 0a 58 55 53 41 47 45 3a | 20 20 6d 74 66 20 69 6e |.XUSAGE:| mtf in|
|00004d50| 70 75 74 66 69 6c 65 20 | 5b 2d 72 20 72 65 70 6f |putfile |[-r repo|
|00004d60| 72 74 66 69 6c 65 5d 20 | 5b 2d 65 20 2e 65 78 74 |rtfile] |[-e .ext|
|00004d70| 65 6e 73 69 6f 6e 73 5d | 20 5b 2d 78 20 65 78 63 |ensions]| [-x exc|
|00004d80| 65 70 74 69 6f 6e 73 5d | 0a 58 0a 58 22 49 6e 70 |eptions]|.X.X"Inp|
|00004d90| 75 74 66 69 6c 65 22 20 | 69 73 20 61 20 74 61 72 |utfile" |is a tar|
|00004da0| 20 61 72 63 68 69 76 65 | 2e 20 20 22 52 65 70 6f | archive|. "Repo|
|00004db0| 72 74 66 69 6c 65 22 20 | 69 73 20 66 69 6c 65 20 |rtfile" |is file |
|00004dc0| 63 6f 6e 74 61 69 6e 69 | 6e 67 20 61 20 6c 69 73 |containi|ng a lis|
|00004dd0| 74 0a 58 6f 66 20 66 69 | 6c 65 73 20 61 6c 72 65 |t.Xof fi|les alre|
|00004de0| 61 64 79 20 6d 61 70 70 | 65 64 20 62 79 20 6d 74 |ady mapp|ed by mt|
|00004df0| 66 20 69 6e 20 61 20 70 | 72 65 76 69 6f 75 73 20 |f in a p|revious |
|00004e00| 72 75 6e 20 28 75 73 65 | 64 20 74 6f 20 61 76 6f |run (use|d to avo|
|00004e10| 69 64 0a 58 63 6c 61 73 | 68 65 73 20 77 69 74 68 |id.Xclas|hes with|
|00004e20| 20 66 69 6c 65 6e 61 6d | 65 73 20 69 6e 20 75 73 | filenam|es in us|
|00004e30| 65 20 6f 75 74 73 69 64 | 65 20 74 68 65 20 63 75 |e outsid|e the cu|
|00004e40| 72 72 65 6e 74 20 61 72 | 63 68 69 76 65 29 2e 20 |rrent ar|chive). |
|00004e50| 20 54 68 65 20 2d 65 0a | 58 73 77 69 74 63 68 20 | The -e.|Xswitch |
|00004e60| 70 72 65 63 65 64 65 73 | 20 61 20 6c 69 73 74 20 |precedes| a list |
|00004e70| 6f 66 20 66 69 6c 65 6e | 61 6d 65 20 2e 65 78 74 |of filen|ame .ext|
|00004e80| 65 6e 73 69 6f 6e 73 20 | 77 68 69 63 68 20 6d 74 |ensions |which mt|
|00004e90| 66 20 69 73 20 73 75 70 | 70 6f 73 65 64 0a 53 48 |f is sup|posed.SH|
|00004ea0| 41 52 5f 45 4f 46 0a 74 | 72 75 65 20 7c 7c 20 65 |AR_EOF.t|rue || e|
|00004eb0| 63 68 6f 20 27 72 65 73 | 74 6f 72 65 20 6f 66 20 |cho 'res|tore of |
|00004ec0| 52 45 41 44 4d 45 20 66 | 61 69 6c 65 64 27 0a 66 |README f|ailed'.f|
|00004ed0| 69 0a 65 63 68 6f 20 27 | 45 6e 64 20 6f 66 20 20 |i.echo '|End of |
|00004ee0| 70 61 72 74 20 31 27 0a | 65 63 68 6f 20 27 46 69 |part 1'.|echo 'Fi|
|00004ef0| 6c 65 20 52 45 41 44 4d | 45 20 69 73 20 63 6f 6e |le READM|E is con|
|00004f00| 74 69 6e 75 65 64 20 69 | 6e 20 70 61 72 74 20 32 |tinued i|n part 2|
|00004f10| 27 0a 65 63 68 6f 20 32 | 20 3e 20 5f 73 68 61 72 |'.echo 2| > _shar|
|00004f20| 5f 73 65 71 5f 2e 74 6d | 70 0a 65 78 69 74 20 30 |_seq_.tm|p.exit 0|
|00004f30| 0a | |. | |
+--------+-------------------------+-------------------------+--------+--------+