home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / compress / part1 < prev    next >
SHell self-extracting ARchive  |  1989-06-26  |  48.9 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: SHell self-extracting ARchive (archive/shar).

ConfidenceProgramDetectionMatch TypeSupport
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 text default
99% file C source text default
98% file C source, 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 76 61 | 78 31 33 35 21 70 65 74 |From: va|x135!pet|
|00000010| 73 64 21 6a 6f 65 20 28 | 4a 6f 65 20 4f 72 6f 73 |sd!joe (|Joe Oros|
|00000020| 74 29 0a 53 75 62 6a 65 | 63 74 3a 20 43 6f 6d 70 |t).Subje|ct: Comp|
|00000030| 72 65 73 73 20 34 2e 30 | 20 28 70 61 72 74 20 31 |ress 4.0| (part 1|
|00000040| 20 6f 66 20 32 29 0a 4e | 65 77 73 67 72 6f 75 70 | of 2).N|ewsgroup|
|00000050| 73 3a 20 6d 6f 64 2e 73 | 6f 75 72 63 65 73 0a 41 |s: mod.s|ources.A|
|00000060| 70 70 72 6f 76 65 64 3a | 20 6a 6f 68 6e 40 67 65 |pproved:| john@ge|
|00000070| 6e 72 61 64 2e 55 55 43 | 50 0a 0a 4d 6f 64 2e 73 |nrad.UUC|P..Mod.s|
|00000080| 6f 75 72 63 65 73 3a 20 | 20 56 6f 6c 75 6d 65 20 |ources: | Volume |
|00000090| 32 2c 20 49 73 73 75 65 | 20 32 38 0a 53 75 62 6d |2, Issue| 28.Subm|
|000000a0| 69 74 74 65 64 20 62 79 | 3a 20 76 61 78 31 33 35 |itted by|: vax135|
|000000b0| 21 70 65 74 73 64 21 6a | 6f 65 20 28 4a 6f 65 20 |!petsd!j|oe (Joe |
|000000c0| 4f 72 6f 73 74 29 0a 0a | 23 21 20 2f 62 69 6e 2f |Orost)..|#! /bin/|
|000000d0| 73 68 0a 23 20 54 68 69 | 73 20 69 73 20 61 20 73 |sh.# Thi|s is a s|
|000000e0| 68 65 6c 6c 20 61 72 63 | 68 69 76 65 2c 20 6d 65 |hell arc|hive, me|
|000000f0| 61 6e 69 6e 67 3a 0a 23 | 20 31 2e 20 52 65 6d 6f |aning:.#| 1. Remo|
|00000100| 76 65 20 65 76 65 72 79 | 74 68 69 6e 67 20 61 62 |ve every|thing ab|
|00000110| 6f 76 65 20 74 68 65 20 | 23 21 20 2f 62 69 6e 2f |ove the |#! /bin/|
|00000120| 73 68 20 6c 69 6e 65 2e | 0a 23 20 32 2e 20 53 61 |sh line.|.# 2. Sa|
|00000130| 76 65 20 74 68 65 20 72 | 65 73 75 6c 74 69 6e 67 |ve the r|esulting|
|00000140| 20 74 65 78 74 20 69 6e | 20 61 20 66 69 6c 65 2e | text in| a file.|
|00000150| 0a 23 20 33 2e 20 45 78 | 65 63 75 74 65 20 74 68 |.# 3. Ex|ecute th|
|00000160| 65 20 66 69 6c 65 20 77 | 69 74 68 20 2f 62 69 6e |e file w|ith /bin|
|00000170| 2f 73 68 20 28 6e 6f 74 | 20 63 73 68 29 20 74 6f |/sh (not| csh) to|
|00000180| 20 63 72 65 61 74 65 20 | 74 68 65 20 66 69 6c 65 | create |the file|
|00000190| 73 3a 0a 23 09 63 6f 6d | 70 72 65 73 73 2e 31 0a |s:.#.com|press.1.|
|000001a0| 23 09 63 6f 6d 70 72 65 | 73 73 2e 63 0a 23 09 4d |#.compre|ss.c.#.M|
|000001b0| 61 6b 65 66 69 6c 65 0a | 23 09 75 73 65 72 6d 65 |akefile.|#.userme|
|000001c0| 6d 0a 23 20 54 68 69 73 | 20 61 72 63 68 69 76 65 |m.# This| archive|
|000001d0| 20 63 72 65 61 74 65 64 | 3a 20 54 68 75 20 41 75 | created|: Thu Au|
|000001e0| 67 20 20 31 20 31 31 3a | 35 31 3a 32 33 20 31 39 |g 1 11:|51:23 19|
|000001f0| 38 35 0a 65 78 70 6f 72 | 74 20 50 41 54 48 3b 20 |85.expor|t PATH; |
|00000200| 50 41 54 48 3d 2f 62 69 | 6e 3a 24 50 41 54 48 0a |PATH=/bi|n:$PATH.|
|00000210| 65 63 68 6f 20 73 68 61 | 72 3a 20 65 78 74 72 61 |echo sha|r: extra|
|00000220| 63 74 69 6e 67 20 22 27 | 63 6f 6d 70 72 65 73 73 |cting "'|compress|
|00000230| 2e 31 27 22 20 27 28 35 | 31 34 37 20 63 68 61 72 |.1'" '(5|147 char|
|00000240| 61 63 74 65 72 73 29 27 | 0a 69 66 20 74 65 73 74 |acters)'|.if test|
|00000250| 20 2d 66 20 27 63 6f 6d | 70 72 65 73 73 2e 31 27 | -f 'com|press.1'|
|00000260| 0a 74 68 65 6e 0a 09 65 | 63 68 6f 20 73 68 61 72 |.then..e|cho shar|
|00000270| 3a 20 77 69 6c 6c 20 6e | 6f 74 20 6f 76 65 72 2d |: will n|ot over-|
|00000280| 77 72 69 74 65 20 65 78 | 69 73 74 69 6e 67 20 66 |write ex|isting f|
|00000290| 69 6c 65 20 22 27 63 6f | 6d 70 72 65 73 73 2e 31 |ile "'co|mpress.1|
|000002a0| 27 22 0a 65 6c 73 65 0a | 73 65 64 20 27 73 2f 5e |'".else.|sed 's/^|
|000002b0| 58 2f 2f 27 20 3c 3c 20 | 5c 53 48 41 52 5f 45 4f |X//' << |\SHAR_EO|
|000002c0| 46 20 3e 20 27 63 6f 6d | 70 72 65 73 73 2e 31 27 |F > 'com|press.1'|
|000002d0| 0a 58 2e 50 55 0a 58 2e | 54 48 20 43 4f 4d 50 52 |.X.PU.X.|TH COMPR|
|000002e0| 45 53 53 20 31 20 6c 6f | 63 61 6c 0a 58 2e 53 48 |ESS 1 lo|cal.X.SH|
|000002f0| 20 4e 41 4d 45 0a 63 6f | 6d 70 72 65 73 73 2c 20 | NAME.co|mpress, |
|00000300| 75 6e 63 6f 6d 70 72 65 | 73 73 2c 20 7a 63 61 74 |uncompre|ss, zcat|
|00000310| 20 5c 2d 20 63 6f 6d 70 | 72 65 73 73 20 61 6e 64 | \- comp|ress and|
|00000320| 20 65 78 70 61 6e 64 20 | 64 61 74 61 0a 58 2e 53 | expand |data.X.S|
|00000330| 48 20 53 59 4e 4f 50 53 | 49 53 0a 58 2e 6c 6c 20 |H SYNOPS|IS.X.ll |
|00000340| 2b 38 0a 58 2e 42 20 63 | 6f 6d 70 72 65 73 73 0a |+8.X.B c|ompress.|
|00000350| 5b 0a 58 2e 42 20 5c 2d | 66 0a 5d 20 5b 0a 58 2e |[.X.B \-|f.] [.X.|
|00000360| 42 20 5c 2d 76 0a 5d 20 | 5b 0a 58 2e 42 20 5c 2d |B \-v.] |[.X.B \-|
|00000370| 63 0a 5d 20 5b 0a 58 2e | 42 20 5c 2d 56 0a 5d 20 |c.] [.X.|B \-V.] |
|00000380| 5b 0a 58 2e 42 20 5c 2d | 62 0a 58 2e 49 20 62 69 |[.X.B \-|b.X.I bi|
|00000390| 74 73 0a 5d 20 5b 0a 58 | 2e 49 20 22 6e 61 6d 65 |ts.] [.X|.I "name|
|000003a0| 20 5c 26 2e 2e 2e 22 0a | 5d 0a 58 2e 6c 6c 20 2d | \&...".|].X.ll -|
|000003b0| 38 0a 58 2e 62 72 0a 58 | 2e 42 20 75 6e 63 6f 6d |8.X.br.X|.B uncom|
|000003c0| 70 72 65 73 73 0a 5b 0a | 58 2e 42 20 5c 2d 66 0a |press.[.|X.B \-f.|
|000003d0| 5d 20 5b 0a 58 2e 42 20 | 5c 2d 76 0a 5d 20 5b 0a |] [.X.B |\-v.] [.|
|000003e0| 58 2e 42 20 5c 2d 63 0a | 5d 20 5b 0a 58 2e 42 20 |X.B \-c.|] [.X.B |
|000003f0| 5c 2d 56 0a 5d 20 5b 0a | 58 2e 49 20 22 6e 61 6d |\-V.] [.|X.I "nam|
|00000400| 65 20 5c 26 2e 2e 2e 22 | 0a 5d 0a 58 2e 62 72 0a |e \&..."|.].X.br.|
|00000410| 58 2e 42 20 7a 63 61 74 | 0a 5b 0a 58 2e 42 20 5c |X.B zcat|.[.X.B \|
|00000420| 2d 56 0a 5d 20 5b 0a 58 | 2e 49 20 22 6e 61 6d 65 |-V.] [.X|.I "name|
|00000430| 20 5c 26 2e 2e 2e 22 0a | 5d 0a 58 2e 53 48 20 44 | \&...".|].X.SH D|
|00000440| 45 53 43 52 49 50 54 49 | 4f 4e 0a 58 2e 49 20 43 |ESCRIPTI|ON.X.I C|
|00000450| 6f 6d 70 72 65 73 73 0a | 72 65 64 75 63 65 73 20 |ompress.|reduces |
|00000460| 74 68 65 20 73 69 7a 65 | 20 6f 66 20 74 68 65 20 |the size| of the |
|00000470| 6e 61 6d 65 64 20 66 69 | 6c 65 73 20 75 73 69 6e |named fi|les usin|
|00000480| 67 20 61 64 61 70 74 69 | 76 65 20 4c 65 6d 70 65 |g adapti|ve Lempe|
|00000490| 6c 2d 5a 69 76 20 63 6f | 64 69 6e 67 2e 0a 57 68 |l-Ziv co|ding..Wh|
|000004a0| 65 6e 65 76 65 72 20 70 | 6f 73 73 69 62 6c 65 2c |enever p|ossible,|
|000004b0| 0a 65 61 63 68 20 66 69 | 6c 65 20 69 73 20 72 65 |.each fi|le is re|
|000004c0| 70 6c 61 63 65 64 20 62 | 79 20 6f 6e 65 20 77 69 |placed b|y one wi|
|000004d0| 74 68 20 74 68 65 20 65 | 78 74 65 6e 73 69 6f 6e |th the e|xtension|
|000004e0| 0a 58 2e 42 20 22 5c 26 | 2e 5a 2c 22 0a 77 68 69 |.X.B "\&|.Z,".whi|
|000004f0| 6c 65 20 6b 65 65 70 69 | 6e 67 20 74 68 65 20 73 |le keepi|ng the s|
|00000500| 61 6d 65 20 6f 77 6e 65 | 72 73 68 69 70 20 6d 6f |ame owne|rship mo|
|00000510| 64 65 73 2c 20 61 63 63 | 65 73 73 20 61 6e 64 20 |des, acc|ess and |
|00000520| 6d 6f 64 69 66 69 63 61 | 74 69 6f 6e 20 74 69 6d |modifica|tion tim|
|00000530| 65 73 2e 0a 49 66 20 6e | 6f 20 66 69 6c 65 73 20 |es..If n|o files |
|00000540| 61 72 65 20 73 70 65 63 | 69 66 69 65 64 2c 20 74 |are spec|ified, t|
|00000550| 68 65 20 73 74 61 6e 64 | 61 72 64 20 69 6e 70 75 |he stand|ard inpu|
|00000560| 74 20 69 73 20 63 6f 6d | 70 72 65 73 73 65 64 20 |t is com|pressed |
|00000570| 74 6f 20 74 68 65 0a 73 | 74 61 6e 64 61 72 64 20 |to the.s|tandard |
|00000580| 6f 75 74 70 75 74 2e 0a | 43 6f 6d 70 72 65 73 73 |output..|Compress|
|00000590| 65 64 20 66 69 6c 65 73 | 20 63 61 6e 20 62 65 20 |ed files| can be |
|000005a0| 72 65 73 74 6f 72 65 64 | 20 74 6f 20 74 68 65 69 |restored| to thei|
|000005b0| 72 20 6f 72 69 67 69 6e | 61 6c 20 66 6f 72 6d 20 |r origin|al form |
|000005c0| 75 73 69 6e 67 0a 58 2e | 49 20 75 6e 63 6f 6d 70 |using.X.|I uncomp|
|000005d0| 72 65 73 73 0a 6f 72 0a | 58 2e 49 20 7a 63 61 74 |ress.or.|X.I zcat|
|000005e0| 2e 0a 58 2e 50 50 0a 54 | 68 65 0a 58 2e 42 20 5c |..X.PP.T|he.X.B \|
|000005f0| 2d 66 0a 6f 70 74 69 6f | 6e 20 77 69 6c 6c 20 66 |-f.optio|n will f|
|00000600| 6f 72 63 65 20 63 6f 6d | 70 72 65 73 73 69 6f 6e |orce com|pression|
|00000610| 20 6f 66 0a 58 2e 49 20 | 6e 61 6d 65 2e 0a 54 68 | of.X.I |name..Th|
|00000620| 69 73 20 69 73 20 75 73 | 65 66 75 6c 20 66 6f 72 |is is us|eful for|
|00000630| 20 63 6f 6d 70 72 65 73 | 73 69 6e 67 20 61 6e 20 | compres|sing an |
|00000640| 65 6e 74 69 72 65 20 64 | 69 72 65 63 74 6f 72 79 |entire d|irectory|
|00000650| 2c 0a 65 76 65 6e 20 69 | 66 20 73 6f 6d 65 20 6f |,.even i|f some o|
|00000660| 66 20 74 68 65 20 66 69 | 6c 65 73 20 64 6f 20 6e |f the fi|les do n|
|00000670| 6f 74 20 61 63 74 75 61 | 6c 6c 79 20 73 68 72 69 |ot actua|lly shri|
|00000680| 6e 6b 2e 0a 49 66 0a 58 | 2e 42 20 5c 2d 66 0a 69 |nk..If.X|.B \-f.i|
|00000690| 73 20 6e 6f 74 20 67 69 | 76 65 6e 20 61 6e 64 0a |s not gi|ven and.|
|000006a0| 58 2e 49 20 63 6f 6d 70 | 72 65 73 73 0a 69 73 20 |X.I comp|ress.is |
|000006b0| 72 75 6e 20 69 6e 20 74 | 68 65 20 66 6f 72 65 67 |run in t|he foreg|
|000006c0| 72 6f 75 6e 64 2c 0a 74 | 68 65 20 75 73 65 72 20 |round,.t|he user |
|000006d0| 69 73 20 70 72 6f 6d 70 | 74 65 64 20 61 73 20 74 |is promp|ted as t|
|000006e0| 6f 20 77 68 65 74 68 65 | 72 20 61 6e 20 65 78 69 |o whethe|r an exi|
|000006f0| 73 74 69 6e 67 20 66 69 | 6c 65 20 73 68 6f 75 6c |sting fi|le shoul|
|00000700| 64 20 62 65 20 6f 76 65 | 72 77 72 69 74 74 65 6e |d be ove|rwritten|
|00000710| 2e 0a 58 2e 50 50 0a 54 | 68 65 0a 58 2e 42 20 5c |..X.PP.T|he.X.B \|
|00000720| 2d 63 0a 6f 70 74 69 6f | 6e 20 6d 61 6b 65 73 0a |-c.optio|n makes.|
|00000730| 58 2e 49 20 63 6f 6d 70 | 72 65 73 73 2f 75 6e 63 |X.I comp|ress/unc|
|00000740| 6f 6d 70 72 65 73 73 0a | 77 72 69 74 65 20 74 6f |ompress.|write to|
|00000750| 20 74 68 65 20 73 74 61 | 6e 64 61 72 64 20 6f 75 | the sta|ndard ou|
|00000760| 74 70 75 74 3b 20 6e 6f | 20 66 69 6c 65 73 20 61 |tput; no| files a|
|00000770| 72 65 20 63 68 61 6e 67 | 65 64 2e 0a 54 68 65 20 |re chang|ed..The |
|00000780| 6e 6f 6e 64 65 73 74 72 | 75 63 74 69 76 65 20 62 |nondestr|uctive b|
|00000790| 65 68 61 76 69 6f 72 20 | 6f 66 0a 58 2e 49 20 7a |ehavior |of.X.I z|
|000007a0| 63 61 74 0a 69 73 20 69 | 64 65 6e 74 69 63 61 6c |cat.is i|dentical|
|000007b0| 20 74 6f 20 74 68 61 74 | 20 6f 66 0a 58 2e 49 20 | to that| of.X.I |
|000007c0| 75 6e 63 6f 6d 70 72 65 | 73 73 0a 58 2e 42 20 5c |uncompre|ss.X.B \|
|000007d0| 2d 63 2e 0a 58 2e 50 50 | 0a 58 2e 49 20 43 6f 6d |-c..X.PP|.X.I Com|
|000007e0| 70 72 65 73 73 0a 75 73 | 65 73 20 74 68 65 20 6d |press.us|es the m|
|000007f0| 6f 64 69 66 69 65 64 20 | 4c 65 6d 70 65 6c 2d 5a |odified |Lempel-Z|
|00000800| 69 76 20 61 6c 67 6f 72 | 69 74 68 6d 20 70 6f 70 |iv algor|ithm pop|
|00000810| 75 6c 61 72 69 7a 65 64 | 20 69 6e 0a 22 41 20 54 |ularized| in."A T|
|00000820| 65 63 68 6e 69 71 75 65 | 20 66 6f 72 20 48 69 67 |echnique| for Hig|
|00000830| 68 20 50 65 72 66 6f 72 | 6d 61 6e 63 65 20 44 61 |h Perfor|mance Da|
|00000840| 74 61 20 43 6f 6d 70 72 | 65 73 73 69 6f 6e 22 2c |ta Compr|ession",|
|00000850| 0a 54 65 72 72 79 20 41 | 2e 20 57 65 6c 63 68 2c |.Terry A|. Welch,|
|00000860| 0a 58 2e 49 20 22 49 45 | 45 45 20 43 6f 6d 70 75 |.X.I "IE|EE Compu|
|00000870| 74 65 72 2c 22 0a 76 6f | 6c 2e 20 31 37 2c 20 6e |ter,".vo|l. 17, n|
|00000880| 6f 2e 20 36 20 28 4a 75 | 6e 65 20 31 39 38 34 29 |o. 6 (Ju|ne 1984)|
|00000890| 2c 20 70 70 2e 20 38 2d | 31 39 2e 0a 43 6f 6d 6d |, pp. 8-|19..Comm|
|000008a0| 6f 6e 20 73 75 62 73 74 | 72 69 6e 67 73 20 69 6e |on subst|rings in|
|000008b0| 20 74 68 65 20 66 69 6c | 65 20 61 72 65 20 66 69 | the fil|e are fi|
|000008c0| 72 73 74 20 72 65 70 6c | 61 63 65 64 20 62 79 20 |rst repl|aced by |
|000008d0| 39 2d 62 69 74 20 63 6f | 64 65 73 20 32 35 37 20 |9-bit co|des 257 |
|000008e0| 61 6e 64 20 75 70 2e 0a | 57 68 65 6e 20 63 6f 64 |and up..|When cod|
|000008f0| 65 20 35 31 32 20 69 73 | 20 72 65 61 63 68 65 64 |e 512 is| reached|
|00000900| 2c 20 74 68 65 20 61 6c | 67 6f 72 69 74 68 6d 20 |, the al|gorithm |
|00000910| 73 77 69 74 63 68 65 73 | 20 74 6f 20 31 30 2d 62 |switches| to 10-b|
|00000920| 69 74 20 63 6f 64 65 73 | 20 61 6e 64 0a 63 6f 6e |it codes| and.con|
|00000930| 74 69 6e 75 65 73 20 74 | 6f 20 75 73 65 20 6d 6f |tinues t|o use mo|
|00000940| 72 65 20 62 69 74 73 20 | 75 6e 74 69 6c 20 74 68 |re bits |until th|
|00000950| 65 0a 6c 69 6d 69 74 20 | 73 70 65 63 69 66 69 65 |e.limit |specifie|
|00000960| 64 20 62 79 20 74 68 65 | 0a 58 2e 42 20 5c 2d 62 |d by the|.X.B \-b|
|00000970| 0a 66 6c 61 67 20 69 73 | 20 72 65 61 63 68 65 64 |.flag is| reached|
|00000980| 20 28 64 65 66 61 75 6c | 74 20 31 36 29 2e 0a 58 | (defaul|t 16)..X|
|00000990| 2e 49 20 42 69 74 73 0a | 6d 75 73 74 20 62 65 20 |.I Bits.|must be |
|000009a0| 62 65 74 77 65 65 6e 20 | 39 20 61 6e 64 20 31 36 |between |9 and 16|
|000009b0| 2e 20 20 54 68 65 20 64 | 65 66 61 75 6c 74 20 63 |. The d|efault c|
|000009c0| 61 6e 20 62 65 20 63 68 | 61 6e 67 65 64 20 69 6e |an be ch|anged in|
|000009d0| 20 74 68 65 20 73 6f 75 | 72 63 65 20 74 6f 20 61 | the sou|rce to a|
|000009e0| 6c 6c 6f 77 0a 58 2e 49 | 20 63 6f 6d 70 72 65 73 |llow.X.I| compres|
|000009f0| 73 0a 74 6f 20 62 65 20 | 72 75 6e 20 6f 6e 20 61 |s.to be |run on a|
|00000a00| 20 73 6d 61 6c 6c 65 72 | 20 6d 61 63 68 69 6e 65 | smaller| machine|
|00000a10| 2e 0a 58 2e 50 50 0a 41 | 66 74 65 72 20 74 68 65 |..X.PP.A|fter the|
|00000a20| 0a 58 2e 49 20 62 69 74 | 73 0a 6c 69 6d 69 74 20 |.X.I bit|s.limit |
|00000a30| 69 73 20 61 74 74 61 69 | 6e 65 64 2c 0a 58 2e 49 |is attai|ned,.X.I|
|00000a40| 20 63 6f 6d 70 72 65 73 | 73 0a 70 65 72 69 6f 64 | compres|s.period|
|00000a50| 69 63 61 6c 6c 79 20 63 | 68 65 63 6b 73 20 74 68 |ically c|hecks th|
|00000a60| 65 20 63 6f 6d 70 72 65 | 73 73 69 6f 6e 20 72 61 |e compre|ssion ra|
|00000a70| 74 69 6f 2e 20 20 49 66 | 20 69 74 20 69 73 20 69 |tio. If| it is i|
|00000a80| 6e 63 72 65 61 73 69 6e | 67 2c 0a 58 2e 49 20 63 |ncreasin|g,.X.I c|
|00000a90| 6f 6d 70 72 65 73 73 0a | 63 6f 6e 74 69 6e 75 65 |ompress.|continue|
|00000aa0| 73 20 74 6f 20 75 73 65 | 20 74 68 65 20 65 78 69 |s to use| the exi|
|00000ab0| 73 74 69 6e 67 20 63 6f | 64 65 20 64 69 63 74 69 |sting co|de dicti|
|00000ac0| 6f 6e 61 72 79 2e 20 20 | 48 6f 77 65 76 65 72 2c |onary. |However,|
|00000ad0| 0a 69 66 20 74 68 65 20 | 63 6f 6d 70 72 65 73 73 |.if the |compress|
|00000ae0| 69 6f 6e 20 72 61 74 69 | 6f 20 64 65 63 72 65 61 |ion rati|o decrea|
|00000af0| 73 65 73 2c 0a 58 2e 49 | 20 63 6f 6d 70 72 65 73 |ses,.X.I| compres|
|00000b00| 73 0a 64 69 73 63 61 72 | 64 73 20 74 68 65 20 74 |s.discar|ds the t|
|00000b10| 61 62 6c 65 20 6f 66 20 | 73 75 62 73 74 72 69 6e |able of |substrin|
|00000b20| 67 73 20 61 6e 64 20 72 | 65 62 75 69 6c 64 73 20 |gs and r|ebuilds |
|00000b30| 69 74 20 66 72 6f 6d 20 | 73 63 72 61 74 63 68 2e |it from |scratch.|
|00000b40| 20 20 54 68 69 73 20 61 | 6c 6c 6f 77 73 0a 74 68 | This a|llows.th|
|00000b50| 65 20 61 6c 67 6f 72 69 | 74 68 6d 20 74 6f 20 61 |e algori|thm to a|
|00000b60| 64 61 70 74 20 74 6f 20 | 74 68 65 20 6e 65 78 74 |dapt to |the next|
|00000b70| 20 22 62 6c 6f 63 6b 22 | 20 6f 66 20 74 68 65 20 | "block"| of the |
|00000b80| 66 69 6c 65 2e 0a 58 2e | 50 50 0a 4e 6f 74 65 20 |file..X.|PP.Note |
|00000b90| 74 68 61 74 20 74 68 65 | 0a 58 2e 42 20 5c 2d 62 |that the|.X.B \-b|
|00000ba0| 0a 66 6c 61 67 20 69 73 | 20 6f 6d 69 74 74 65 64 |.flag is| omitted|
|00000bb0| 20 66 6f 72 0a 58 2e 49 | 20 75 6e 63 6f 6d 70 72 | for.X.I| uncompr|
|00000bc0| 65 73 73 2c 0a 73 69 6e | 63 65 20 74 68 65 20 0a |ess,.sin|ce the .|
|00000bd0| 58 2e 49 20 62 69 74 73 | 0a 70 61 72 61 6d 65 74 |X.I bits|.paramet|
|00000be0| 65 72 20 73 70 65 63 69 | 66 69 65 64 20 64 75 72 |er speci|fied dur|
|00000bf0| 69 6e 67 20 63 6f 6d 70 | 72 65 73 73 69 6f 6e 0a |ing comp|ression.|
|00000c00| 69 73 20 65 6e 63 6f 64 | 65 64 20 77 69 74 68 69 |is encod|ed withi|
|00000c10| 6e 20 74 68 65 20 6f 75 | 74 70 75 74 2c 20 61 6c |n the ou|tput, al|
|00000c20| 6f 6e 67 20 77 69 74 68 | 0a 61 20 6d 61 67 69 63 |ong with|.a magic|
|00000c30| 20 6e 75 6d 62 65 72 20 | 74 6f 20 65 6e 73 75 72 | number |to ensur|
|00000c40| 65 20 74 68 61 74 20 6e | 65 69 74 68 65 72 20 64 |e that n|either d|
|00000c50| 65 63 6f 6d 70 72 65 73 | 73 69 6f 6e 20 6f 66 20 |ecompres|sion of |
|00000c60| 72 61 6e 64 6f 6d 20 64 | 61 74 61 20 6e 6f 72 0a |random d|ata nor.|
|00000c70| 72 65 63 6f 6d 70 72 65 | 73 73 69 6f 6e 20 6f 66 |recompre|ssion of|
|00000c80| 20 63 6f 6d 70 72 65 73 | 73 65 64 20 64 61 74 61 | compres|sed data|
|00000c90| 20 69 73 20 61 74 74 65 | 6d 70 74 65 64 2e 20 0a | is atte|mpted. .|
|00000ca0| 58 2e 50 50 0a 58 2e 6e | 65 20 38 0a 54 68 65 20 |X.PP.X.n|e 8.The |
|00000cb0| 61 6d 6f 75 6e 74 20 6f | 66 20 63 6f 6d 70 72 65 |amount o|f compre|
|00000cc0| 73 73 69 6f 6e 20 6f 62 | 74 61 69 6e 65 64 20 64 |ssion ob|tained d|
|00000cd0| 65 70 65 6e 64 73 20 6f | 6e 20 74 68 65 20 73 69 |epends o|n the si|
|00000ce0| 7a 65 20 6f 66 20 74 68 | 65 0a 69 6e 70 75 74 2c |ze of th|e.input,|
|00000cf0| 20 74 68 65 20 6e 75 6d | 62 65 72 20 6f 66 0a 58 | the num|ber of.X|
|00000d00| 2e 49 20 62 69 74 73 0a | 70 65 72 20 63 6f 64 65 |.I bits.|per code|
|00000d10| 2c 20 61 6e 64 20 74 68 | 65 20 64 69 73 74 72 69 |, and th|e distri|
|00000d20| 62 75 74 69 6f 6e 20 6f | 66 20 63 6f 6d 6d 6f 6e |bution o|f common|
|00000d30| 20 73 75 62 73 74 72 69 | 6e 67 73 2e 0a 54 79 70 | substri|ngs..Typ|
|00000d40| 69 63 61 6c 6c 79 2c 20 | 74 65 78 74 20 73 75 63 |ically, |text suc|
|00000d50| 68 20 61 73 20 73 6f 75 | 72 63 65 20 63 6f 64 65 |h as sou|rce code|
|00000d60| 20 6f 72 20 45 6e 67 6c | 69 73 68 0a 69 73 20 72 | or Engl|ish.is r|
|00000d70| 65 64 75 63 65 64 20 62 | 79 20 35 30 5c 2d 36 30 |educed b|y 50\-60|
|00000d80| 25 2e 0a 43 6f 6d 70 72 | 65 73 73 69 6f 6e 20 69 |%..Compr|ession i|
|00000d90| 73 20 67 65 6e 65 72 61 | 6c 6c 79 20 6d 75 63 68 |s genera|lly much|
|00000da0| 20 62 65 74 74 65 72 20 | 74 68 61 6e 20 74 68 61 | better |than tha|
|00000db0| 74 20 61 63 68 69 65 76 | 65 64 20 62 79 0a 48 75 |t achiev|ed by.Hu|
|00000dc0| 66 66 6d 61 6e 20 63 6f | 64 69 6e 67 20 28 61 73 |ffman co|ding (as|
|00000dd0| 20 75 73 65 64 20 69 6e | 0a 58 2e 49 52 20 70 61 | used in|.X.IR pa|
|00000de0| 63 6b 20 29 2c 0a 6f 72 | 20 61 64 61 70 74 69 76 |ck ),.or| adaptiv|
|00000df0| 65 20 48 75 66 66 6d 61 | 6e 20 63 6f 64 69 6e 67 |e Huffma|n coding|
|00000e00| 0a 58 2e 52 49 20 28 20 | 63 6f 6d 70 61 63 74 20 |.X.RI ( |compact |
|00000e10| 29 2c 0a 61 6e 64 20 74 | 61 6b 65 73 20 6c 65 73 |),.and t|akes les|
|00000e20| 73 20 74 69 6d 65 20 74 | 6f 20 63 6f 6d 70 75 74 |s time t|o comput|
|00000e30| 65 2e 0a 58 2e 50 50 0a | 55 6e 64 65 72 20 74 68 |e..X.PP.|Under th|
|00000e40| 65 0a 58 2e 42 20 5c 2d | 76 0a 6f 70 74 69 6f 6e |e.X.B \-|v.option|
|00000e50| 2c 0a 61 20 6d 65 73 73 | 61 67 65 20 69 73 20 70 |,.a mess|age is p|
|00000e60| 72 69 6e 74 65 64 20 79 | 69 65 6c 64 69 6e 67 20 |rinted y|ielding |
|00000e70| 74 68 65 20 70 65 72 63 | 65 6e 74 61 67 65 20 6f |the perc|entage o|
|00000e80| 66 0a 72 65 64 75 63 74 | 69 6f 6e 20 66 6f 72 20 |f.reduct|ion for |
|00000e90| 65 61 63 68 20 66 69 6c | 65 20 63 6f 6d 70 72 65 |each fil|e compre|
|00000ea0| 73 73 65 64 2e 0a 58 2e | 50 50 0a 49 66 20 74 68 |ssed..X.|PP.If th|
|00000eb0| 65 0a 58 2e 42 20 5c 2d | 56 0a 6f 70 74 69 6f 6e |e.X.B \-|V.option|
|00000ec0| 20 69 73 20 73 70 65 63 | 69 66 69 65 64 2c 20 74 | is spec|ified, t|
|00000ed0| 68 65 20 63 75 72 72 65 | 6e 74 20 76 65 72 73 69 |he curre|nt versi|
|00000ee0| 6f 6e 20 61 6e 64 20 63 | 6f 6d 70 69 6c 65 20 6f |on and c|ompile o|
|00000ef0| 70 74 69 6f 6e 73 20 61 | 72 65 20 70 72 69 6e 74 |ptions a|re print|
|00000f00| 65 64 20 6f 6e 0a 73 74 | 64 65 72 72 2e 0a 58 2e |ed on.st|derr..X.|
|00000f10| 50 50 0a 45 78 69 74 20 | 73 74 61 74 75 73 20 69 |PP.Exit |status i|
|00000f20| 73 20 6e 6f 72 6d 61 6c | 6c 79 20 30 3b 0a 69 66 |s normal|ly 0;.if|
|00000f30| 20 74 68 65 20 6c 61 73 | 74 20 66 69 6c 65 20 69 | the las|t file i|
|00000f40| 73 20 6c 61 72 67 65 72 | 20 61 66 74 65 72 20 28 |s larger| after (|
|00000f50| 61 74 74 65 6d 70 74 65 | 64 29 20 63 6f 6d 70 72 |attempte|d) compr|
|00000f60| 65 73 73 69 6f 6e 2c 20 | 74 68 65 20 73 74 61 74 |ession, |the stat|
|00000f70| 75 73 20 69 73 20 32 3b | 0a 69 66 20 61 6e 20 65 |us is 2;|.if an e|
|00000f80| 72 72 6f 72 20 6f 63 63 | 75 72 73 2c 20 65 78 69 |rror occ|urs, exi|
|00000f90| 74 20 73 74 61 74 75 73 | 20 69 73 20 31 2e 0a 58 |t status| is 1..X|
|00000fa0| 2e 53 48 20 22 53 45 45 | 20 41 4c 53 4f 22 0a 70 |.SH "SEE| ALSO".p|
|00000fb0| 61 63 6b 28 31 29 2c 20 | 63 6f 6d 70 61 63 74 28 |ack(1), |compact(|
|00000fc0| 31 29 0a 58 2e 53 48 20 | 22 44 49 41 47 4e 4f 53 |1).X.SH |"DIAGNOS|
|00000fd0| 54 49 43 53 22 0a 55 73 | 61 67 65 3a 20 63 6f 6d |TICS".Us|age: com|
|00000fe0| 70 72 65 73 73 20 5b 5c | 2d 64 66 76 63 56 5d 20 |press [\|-dfvcV] |
|00000ff0| 5b 5c 2d 62 20 6d 61 78 | 62 69 74 73 5d 20 5b 66 |[\-b max|bits] [f|
|00001000| 69 6c 65 20 2e 2e 2e 5d | 0a 58 2e 69 6e 20 2b 38 |ile ...]|.X.in +8|
|00001010| 0a 49 6e 76 61 6c 69 64 | 20 6f 70 74 69 6f 6e 73 |.Invalid| options|
|00001020| 20 77 65 72 65 20 73 70 | 65 63 69 66 69 65 64 20 | were sp|ecified |
|00001030| 6f 6e 20 74 68 65 20 63 | 6f 6d 6d 61 6e 64 20 6c |on the c|ommand l|
|00001040| 69 6e 65 2e 0a 58 2e 69 | 6e 20 2d 38 0a 4d 69 73 |ine..X.i|n -8.Mis|
|00001050| 73 69 6e 67 20 6d 61 78 | 62 69 74 73 0a 58 2e 69 |sing max|bits.X.i|
|00001060| 6e 20 2b 38 0a 4d 61 78 | 62 69 74 73 20 6d 75 73 |n +8.Max|bits mus|
|00001070| 74 20 66 6f 6c 6c 6f 77 | 0a 58 2e 42 52 20 5c 2d |t follow|.X.BR \-|
|00001080| 62 20 5c 2e 0a 58 2e 69 | 6e 20 2d 38 0a 58 2e 49 |b \..X.i|n -8.X.I|
|00001090| 52 20 66 69 6c 65 20 3a | 0a 6e 6f 74 20 69 6e 20 |R file :|.not in |
|000010a0| 63 6f 6d 70 72 65 73 73 | 65 64 20 66 6f 72 6d 61 |compress|ed forma|
|000010b0| 74 0a 58 2e 69 6e 20 2b | 38 0a 54 68 65 20 66 69 |t.X.in +|8.The fi|
|000010c0| 6c 65 20 73 70 65 63 69 | 66 69 65 64 20 74 6f 0a |le speci|fied to.|
|000010d0| 58 2e 49 20 75 6e 63 6f | 6d 70 72 65 73 73 0a 68 |X.I unco|mpress.h|
|000010e0| 61 73 20 6e 6f 74 20 62 | 65 65 6e 20 63 6f 6d 70 |as not b|een comp|
|000010f0| 72 65 73 73 65 64 2e 0a | 58 2e 69 6e 20 2d 38 0a |ressed..|X.in -8.|
|00001100| 58 2e 49 52 20 66 69 6c | 65 20 3a 0a 63 6f 6d 70 |X.IR fil|e :.comp|
|00001110| 72 65 73 73 65 64 20 77 | 69 74 68 20 0a 58 2e 49 |ressed w|ith .X.I|
|00001120| 20 78 78 0a 62 69 74 73 | 2c 20 63 61 6e 20 6f 6e | xx.bits|, can on|
|00001130| 6c 79 20 68 61 6e 64 6c | 65 20 0a 58 2e 49 20 79 |ly handl|e .X.I y|
|00001140| 79 0a 62 69 74 73 0a 58 | 2e 69 6e 20 2b 38 0a 58 |y.bits.X|.in +8.X|
|00001150| 2e 49 20 46 69 6c 65 0a | 77 61 73 20 63 6f 6d 70 |.I File.|was comp|
|00001160| 72 65 73 73 65 64 20 62 | 79 20 61 20 70 72 6f 67 |ressed b|y a prog|
|00001170| 72 61 6d 20 74 68 61 74 | 20 63 6f 75 6c 64 20 64 |ram that| could d|
|00001180| 65 61 6c 20 77 69 74 68 | 0a 6d 6f 72 65 20 0a 58 |eal with|.more .X|
|00001190| 2e 49 20 62 69 74 73 0a | 74 68 61 6e 20 74 68 65 |.I bits.|than the|
|000011a0| 20 63 6f 6d 70 72 65 73 | 73 20 63 6f 64 65 20 6f | compres|s code o|
|000011b0| 6e 20 74 68 69 73 20 6d | 61 63 68 69 6e 65 2e 0a |n this m|achine..|
|000011c0| 52 65 63 6f 6d 70 72 65 | 73 73 20 74 68 65 20 66 |Recompre|ss the f|
|000011d0| 69 6c 65 20 77 69 74 68 | 20 73 6d 61 6c 6c 65 72 |ile with| smaller|
|000011e0| 0a 58 2e 49 52 20 62 69 | 74 73 20 5c 2e 0a 58 2e |.X.IR bi|ts \..X.|
|000011f0| 69 6e 20 2d 38 0a 58 2e | 49 52 20 66 69 6c 65 20 |in -8.X.|IR file |
|00001200| 3a 0a 61 6c 72 65 61 64 | 79 20 68 61 73 20 2e 5a |:.alread|y has .Z|
|00001210| 20 73 75 66 66 69 78 20 | 2d 2d 20 6e 6f 20 63 68 | suffix |-- no ch|
|00001220| 61 6e 67 65 0a 58 2e 69 | 6e 20 2b 38 0a 54 68 65 |ange.X.i|n +8.The|
|00001230| 20 66 69 6c 65 20 69 73 | 20 61 73 73 75 6d 65 64 | file is| assumed|
|00001240| 20 74 6f 20 62 65 20 61 | 6c 72 65 61 64 79 20 63 | to be a|lready c|
|00001250| 6f 6d 70 72 65 73 73 65 | 64 2e 0a 52 65 6e 61 6d |ompresse|d..Renam|
|00001260| 65 20 74 68 65 20 66 69 | 6c 65 20 61 6e 64 20 74 |e the fi|le and t|
|00001270| 72 79 20 61 67 61 69 6e | 2e 0a 58 2e 69 6e 20 2d |ry again|..X.in -|
|00001280| 38 0a 58 2e 49 52 20 66 | 69 6c 65 20 3a 0a 66 69 |8.X.IR f|ile :.fi|
|00001290| 6c 65 6e 61 6d 65 20 74 | 6f 6f 20 6c 6f 6e 67 20 |lename t|oo long |
|000012a0| 74 6f 20 74 61 63 6b 20 | 6f 6e 20 2e 5a 0a 58 2e |to tack |on .Z.X.|
|000012b0| 69 6e 20 2b 38 0a 54 68 | 65 20 66 69 6c 65 20 63 |in +8.Th|e file c|
|000012c0| 61 6e 6e 6f 74 20 62 65 | 20 63 6f 6d 70 72 65 73 |annot be| compres|
|000012d0| 73 65 64 20 62 65 63 61 | 75 73 65 20 69 74 73 20 |sed beca|use its |
|000012e0| 6e 61 6d 65 20 69 73 20 | 6c 6f 6e 67 65 72 20 74 |name is |longer t|
|000012f0| 68 61 6e 0a 31 32 20 63 | 68 61 72 61 63 74 65 72 |han.12 c|haracter|
|00001300| 73 2e 0a 52 65 6e 61 6d | 65 20 61 6e 64 20 74 72 |s..Renam|e and tr|
|00001310| 79 20 61 67 61 69 6e 2e | 0a 54 68 69 73 20 6d 65 |y again.|.This me|
|00001320| 73 73 61 67 65 20 64 6f | 65 73 20 6e 6f 74 20 6f |ssage do|es not o|
|00001330| 63 63 75 72 20 6f 6e 20 | 42 53 44 20 73 79 73 74 |ccur on |BSD syst|
|00001340| 65 6d 73 2e 0a 58 2e 69 | 6e 20 2d 38 0a 58 2e 49 |ems..X.i|n -8.X.I|
|00001350| 20 66 69 6c 65 0a 61 6c | 72 65 61 64 79 20 65 78 | file.al|ready ex|
|00001360| 69 73 74 73 3b 20 64 6f | 20 79 6f 75 20 77 69 73 |ists; do| you wis|
|00001370| 68 20 74 6f 20 6f 76 65 | 72 77 72 69 74 65 20 28 |h to ove|rwrite (|
|00001380| 79 20 6f 72 20 6e 29 3f | 0a 58 2e 69 6e 20 2b 38 |y or n)?|.X.in +8|
|00001390| 0a 52 65 73 70 6f 6e 64 | 20 22 79 22 20 69 66 20 |.Respond| "y" if |
|000013a0| 79 6f 75 20 77 61 6e 74 | 20 74 68 65 20 6f 75 74 |you want| the out|
|000013b0| 70 75 74 20 66 69 6c 65 | 20 74 6f 20 62 65 20 72 |put file| to be r|
|000013c0| 65 70 6c 61 63 65 64 3b | 20 22 6e 22 20 69 66 20 |eplaced;| "n" if |
|000013d0| 6e 6f 74 2e 0a 58 2e 69 | 6e 20 2d 38 0a 75 6e 63 |not..X.i|n -8.unc|
|000013e0| 6f 6d 70 72 65 73 73 3a | 20 63 6f 72 72 75 70 74 |ompress:| corrupt|
|000013f0| 20 69 6e 70 75 74 0a 58 | 2e 69 6e 20 2b 38 0a 41 | input.X|.in +8.A|
|00001400| 20 53 49 47 53 45 47 56 | 20 76 69 6f 6c 61 74 69 | SIGSEGV| violati|
|00001410| 6f 6e 20 77 61 73 20 64 | 65 74 65 63 74 65 64 20 |on was d|etected |
|00001420| 77 68 69 63 68 20 75 73 | 75 61 6c 6c 79 20 6d 65 |which us|ually me|
|00001430| 61 6e 73 20 74 68 61 74 | 20 74 68 65 20 69 6e 70 |ans that| the inp|
|00001440| 75 74 20 66 69 6c 65 20 | 68 61 73 0a 62 65 65 6e |ut file |has.been|
|00001450| 20 63 6f 72 72 75 70 74 | 65 64 2e 0a 58 2e 69 6e | corrupt|ed..X.in|
|00001460| 20 2d 38 0a 43 6f 6d 70 | 72 65 73 73 69 6f 6e 3a | -8.Comp|ression:|
|00001470| 20 0a 58 2e 49 20 22 78 | 78 2e 78 78 25 22 0a 58 | .X.I "x|x.xx%".X|
|00001480| 2e 69 6e 20 2b 38 0a 50 | 65 72 63 65 6e 74 61 67 |.in +8.P|ercentag|
|00001490| 65 20 6f 66 20 74 68 65 | 20 69 6e 70 75 74 20 73 |e of the| input s|
|000014a0| 61 76 65 64 20 62 79 20 | 63 6f 6d 70 72 65 73 73 |aved by |compress|
|000014b0| 69 6f 6e 2e 0a 28 52 65 | 6c 65 76 61 6e 74 20 6f |ion..(Re|levant o|
|000014c0| 6e 6c 79 20 66 6f 72 0a | 58 2e 42 52 20 5c 2d 76 |nly for.|X.BR \-v|
|000014d0| 20 5c 2e 29 0a 58 2e 69 | 6e 20 2d 38 0a 2d 2d 20 | \.).X.i|n -8.-- |
|000014e0| 6e 6f 74 20 61 20 72 65 | 67 75 6c 61 72 20 66 69 |not a re|gular fi|
|000014f0| 6c 65 3a 20 75 6e 63 68 | 61 6e 67 65 64 0a 58 2e |le: unch|anged.X.|
|00001500| 69 6e 20 2b 38 0a 57 68 | 65 6e 20 74 68 65 20 69 |in +8.Wh|en the i|
|00001510| 6e 70 75 74 20 66 69 6c | 65 20 69 73 20 6e 6f 74 |nput fil|e is not|
|00001520| 20 61 20 72 65 67 75 6c | 61 72 20 66 69 6c 65 2c | a regul|ar file,|
|00001530| 0a 28 65 2e 67 2e 20 61 | 20 64 69 72 65 63 74 6f |.(e.g. a| directo|
|00001540| 72 79 29 2c 20 69 74 20 | 69 73 0a 6c 65 66 74 20 |ry), it |is.left |
|00001550| 75 6e 61 6c 74 65 72 65 | 64 2e 0a 58 2e 69 6e 20 |unaltere|d..X.in |
|00001560| 2d 38 0a 2d 2d 20 68 61 | 73 20 0a 58 2e 49 20 78 |-8.-- ha|s .X.I x|
|00001570| 78 20 0a 6f 74 68 65 72 | 20 6c 69 6e 6b 73 3a 20 |x .other| links: |
|00001580| 75 6e 63 68 61 6e 67 65 | 64 0a 58 2e 69 6e 20 2b |unchange|d.X.in +|
|00001590| 38 0a 54 68 65 20 69 6e | 70 75 74 20 66 69 6c 65 |8.The in|put file|
|000015a0| 20 68 61 73 20 6c 69 6e | 6b 73 3b 20 69 74 20 69 | has lin|ks; it i|
|000015b0| 73 20 6c 65 66 74 20 75 | 6e 63 68 61 6e 67 65 64 |s left u|nchanged|
|000015c0| 2e 20 20 53 65 65 0a 58 | 2e 49 52 20 6c 6e 20 22 |. See.X|.IR ln "|
|000015d0| 28 31 29 22 0a 66 6f 72 | 20 6d 6f 72 65 20 69 6e |(1)".for| more in|
|000015e0| 66 6f 72 6d 61 74 69 6f | 6e 2e 0a 58 2e 69 6e 20 |formatio|n..X.in |
|000015f0| 2d 38 0a 2d 2d 20 66 69 | 6c 65 20 75 6e 63 68 61 |-8.-- fi|le uncha|
|00001600| 6e 67 65 64 0a 58 2e 69 | 6e 20 2b 38 0a 4e 6f 20 |nged.X.i|n +8.No |
|00001610| 73 61 76 69 6e 67 73 20 | 69 73 20 61 63 68 69 65 |savings |is achie|
|00001620| 76 65 64 20 62 79 0a 63 | 6f 6d 70 72 65 73 73 69 |ved by.c|ompressi|
|00001630| 6f 6e 2e 20 20 54 68 65 | 20 69 6e 70 75 74 20 72 |on. The| input r|
|00001640| 65 6d 61 69 6e 73 20 76 | 69 72 67 69 6e 2e 0a 58 |emains v|irgin..X|
|00001650| 2e 69 6e 20 2d 38 0a 58 | 2e 53 48 20 22 42 55 47 |.in -8.X|.SH "BUG|
|00001660| 53 22 0a 41 6c 74 68 6f | 75 67 68 20 63 6f 6d 70 |S".Altho|ugh comp|
|00001670| 72 65 73 73 65 64 20 66 | 69 6c 65 73 20 61 72 65 |ressed f|iles are|
|00001680| 20 63 6f 6d 70 61 74 69 | 62 6c 65 20 62 65 74 77 | compati|ble betw|
|00001690| 65 65 6e 20 6d 61 63 68 | 69 6e 65 73 20 77 69 74 |een mach|ines wit|
|000016a0| 68 20 6c 61 72 67 65 20 | 6d 65 6d 6f 72 79 2c 0a |h large |memory,.|
|000016b0| 58 2e 42 52 20 5c 2d 62 | 20 5c 31 32 0a 73 68 6f |X.BR \-b| \12.sho|
|000016c0| 75 6c 64 20 62 65 20 75 | 73 65 64 20 66 6f 72 20 |uld be u|sed for |
|000016d0| 66 69 6c 65 20 74 72 61 | 6e 73 66 65 72 20 74 6f |file tra|nsfer to|
|000016e0| 20 61 72 63 68 69 74 65 | 63 74 75 72 65 73 20 77 | archite|ctures w|
|000016f0| 69 74 68 20 0a 61 20 73 | 6d 61 6c 6c 20 70 72 6f |ith .a s|mall pro|
|00001700| 63 65 73 73 20 64 61 74 | 61 20 73 70 61 63 65 20 |cess dat|a space |
|00001710| 28 36 34 4b 42 20 6f 72 | 20 6c 65 73 73 2c 20 61 |(64KB or| less, a|
|00001720| 73 20 65 78 68 69 62 69 | 74 65 64 20 62 79 20 74 |s exhibi|ted by t|
|00001730| 68 65 20 44 45 43 20 50 | 44 50 0a 73 65 72 69 65 |he DEC P|DP.serie|
|00001740| 73 2c 20 74 68 65 20 49 | 6e 74 65 6c 20 38 30 32 |s, the I|ntel 802|
|00001750| 38 36 2c 20 65 74 63 2e | 29 0a 53 48 41 52 5f 45 |86, etc.|).SHAR_E|
|00001760| 4f 46 0a 69 66 20 74 65 | 73 74 20 35 31 34 37 20 |OF.if te|st 5147 |
|00001770| 2d 6e 65 20 22 60 77 63 | 20 2d 63 20 3c 20 27 63 |-ne "`wc| -c < 'c|
|00001780| 6f 6d 70 72 65 73 73 2e | 31 27 60 22 0a 74 68 65 |ompress.|1'`".the|
|00001790| 6e 0a 09 65 63 68 6f 20 | 73 68 61 72 3a 20 65 72 |n..echo |shar: er|
|000017a0| 72 6f 72 20 74 72 61 6e | 73 6d 69 74 74 69 6e 67 |ror tran|smitting|
|000017b0| 20 22 27 63 6f 6d 70 72 | 65 73 73 2e 31 27 22 20 | "'compr|ess.1'" |
|000017c0| 27 28 73 68 6f 75 6c 64 | 20 68 61 76 65 20 62 65 |'(should| have be|
|000017d0| 65 6e 20 35 31 34 37 20 | 63 68 61 72 61 63 74 65 |en 5147 |characte|
|000017e0| 72 73 29 27 0a 66 69 0a | 66 69 20 23 20 65 6e 64 |rs)'.fi.|fi # end|
|000017f0| 20 6f 66 20 6f 76 65 72 | 77 72 69 74 69 6e 67 20 | of over|writing |
|00001800| 63 68 65 63 6b 0a 65 63 | 68 6f 20 73 68 61 72 3a |check.ec|ho shar:|
|00001810| 20 65 78 74 72 61 63 74 | 69 6e 67 20 22 27 63 6f | extract|ing "'co|
|00001820| 6d 70 72 65 73 73 2e 63 | 27 22 20 27 28 33 39 36 |mpress.c|'" '(396|
|00001830| 31 34 20 63 68 61 72 61 | 63 74 65 72 73 29 27 0a |14 chara|cters)'.|
|00001840| 69 66 20 74 65 73 74 20 | 2d 66 20 27 63 6f 6d 70 |if test |-f 'comp|
|00001850| 72 65 73 73 2e 63 27 0a | 74 68 65 6e 0a 09 65 63 |ress.c'.|then..ec|
|00001860| 68 6f 20 73 68 61 72 3a | 20 77 69 6c 6c 20 6e 6f |ho shar:| will no|
|00001870| 74 20 6f 76 65 72 2d 77 | 72 69 74 65 20 65 78 69 |t over-w|rite exi|
|00001880| 73 74 69 6e 67 20 66 69 | 6c 65 20 22 27 63 6f 6d |sting fi|le "'com|
|00001890| 70 72 65 73 73 2e 63 27 | 22 0a 65 6c 73 65 0a 73 |press.c'|".else.s|
|000018a0| 65 64 20 27 73 2f 5e 58 | 2f 2f 27 20 3c 3c 20 5c |ed 's/^X|//' << \|
|000018b0| 53 48 41 52 5f 45 4f 46 | 20 3e 20 27 63 6f 6d 70 |SHAR_EOF| > 'comp|
|000018c0| 72 65 73 73 2e 63 27 0a | 2f 2a 20 0a 20 2a 20 43 |ress.c'.|/* . * C|
|000018d0| 6f 6d 70 72 65 73 73 20 | 2d 20 64 61 74 61 20 63 |ompress |- data c|
|000018e0| 6f 6d 70 72 65 73 73 69 | 6f 6e 20 70 72 6f 67 72 |ompressi|on progr|
|000018f0| 61 6d 20 0a 20 2a 2f 0a | 23 64 65 66 69 6e 65 09 |am . */.|#define.|
|00001900| 6d 69 6e 28 61 2c 62 29 | 09 28 28 61 3e 62 29 20 |min(a,b)|.((a>b) |
|00001910| 3f 20 62 20 3a 20 61 29 | 0a 0a 2f 2a 0a 20 2a 20 |? b : a)|../*. * |
|00001920| 6d 61 63 68 69 6e 65 20 | 76 61 72 69 61 6e 74 73 |machine |variants|
|00001930| 20 77 68 69 63 68 20 72 | 65 71 75 69 72 65 20 63 | which r|equire c|
|00001940| 63 20 2d 44 6d 61 63 68 | 69 6e 65 3a 20 20 70 64 |c -Dmach|ine: pd|
|00001950| 70 31 31 2c 20 7a 38 30 | 30 30 2c 20 70 63 78 74 |p11, z80|00, pcxt|
|00001960| 0a 20 2a 2f 0a 0a 2f 2a | 0a 20 2a 20 53 65 74 20 |. */../*|. * Set |
|00001970| 55 53 45 52 4d 45 4d 20 | 74 6f 20 74 68 65 20 6d |USERMEM |to the m|
|00001980| 61 78 69 6d 75 6d 20 61 | 6d 6f 75 6e 74 20 6f 66 |aximum a|mount of|
|00001990| 20 70 68 79 73 69 63 61 | 6c 20 75 73 65 72 20 6d | physica|l user m|
|000019a0| 65 6d 6f 72 79 20 61 76 | 61 69 6c 61 62 6c 65 0a |emory av|ailable.|
|000019b0| 20 2a 20 69 6e 20 62 79 | 74 65 73 2e 20 20 55 53 | * in by|tes. US|
|000019c0| 45 52 4d 45 4d 20 69 73 | 20 75 73 65 64 20 74 6f |ERMEM is| used to|
|000019d0| 20 64 65 74 65 72 6d 69 | 6e 65 20 74 68 65 20 6d | determi|ne the m|
|000019e0| 61 78 69 6d 75 6d 20 42 | 49 54 53 20 74 68 61 74 |aximum B|ITS that|
|000019f0| 20 63 61 6e 20 62 65 20 | 75 73 65 64 0a 20 2a 20 | can be |used. * |
|00001a00| 66 6f 72 20 63 6f 6d 70 | 72 65 73 73 69 6f 6e 2e |for comp|ression.|
|00001a10| 0a 20 2a 0a 20 2a 20 53 | 41 43 52 45 44 4d 45 4d |. *. * S|ACREDMEM|
|00001a20| 20 69 73 20 74 68 65 20 | 61 6d 6f 75 6e 74 20 6f | is the |amount o|
|00001a30| 66 20 70 68 79 73 69 63 | 61 6c 20 6d 65 6d 6f 72 |f physic|al memor|
|00001a40| 79 20 73 61 76 65 64 20 | 66 6f 72 20 6f 74 68 65 |y saved |for othe|
|00001a50| 72 73 3b 20 63 6f 6d 70 | 72 65 73 73 0a 20 2a 20 |rs; comp|ress. * |
|00001a60| 77 69 6c 6c 20 68 6f 67 | 20 74 68 65 20 72 65 73 |will hog| the res|
|00001a70| 74 2e 0a 20 2a 2f 0a 23 | 69 66 6e 64 65 66 20 53 |t.. */.#|ifndef S|
|00001a80| 41 43 52 45 44 4d 45 4d | 0a 23 64 65 66 69 6e 65 |ACREDMEM|.#define|
|00001a90| 20 53 41 43 52 45 44 4d | 45 4d 09 30 0a 23 65 6e | SACREDM|EM.0.#en|
|00001aa0| 64 69 66 0a 0a 23 69 66 | 6e 64 65 66 20 55 53 45 |dif..#if|ndef USE|
|00001ab0| 52 4d 45 4d 0a 23 20 64 | 65 66 69 6e 65 20 55 53 |RMEM.# d|efine US|
|00001ac0| 45 52 4d 45 4d 20 09 34 | 35 30 30 30 30 09 2f 2a |ERMEM .4|50000./*|
|00001ad0| 20 64 65 66 61 75 6c 74 | 20 75 73 65 72 20 6d 65 | default| user me|
|00001ae0| 6d 6f 72 79 20 2a 2f 0a | 23 65 6e 64 69 66 0a 0a |mory */.|#endif..|
|00001af0| 23 69 66 64 65 66 20 69 | 6e 74 65 72 64 61 74 61 |#ifdef i|nterdata|
|00001b00| 09 09 2f 2a 20 28 50 65 | 72 6b 69 6e 2d 45 6c 6d |../* (Pe|rkin-Elm|
|00001b10| 65 72 29 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 53 |er) */.#|define S|
|00001b20| 49 47 4e 45 44 5f 43 4f | 4d 50 41 52 45 5f 53 4c |IGNED_CO|MPARE_SL|
|00001b30| 4f 57 09 2f 2a 20 73 69 | 67 6e 65 64 20 63 6f 6d |OW./* si|gned com|
|00001b40| 70 61 72 65 20 69 73 20 | 73 6c 6f 77 65 72 20 74 |pare is |slower t|
|00001b50| 68 61 6e 20 75 6e 73 69 | 67 6e 65 64 20 2a 2f 0a |han unsi|gned */.|
|00001b60| 23 65 6e 64 69 66 0a 0a | 23 69 66 64 65 66 20 70 |#endif..|#ifdef p|
|00001b70| 64 70 31 31 0a 23 20 64 | 65 66 69 6e 65 20 42 49 |dp11.# d|efine BI|
|00001b80| 54 53 20 09 31 32 09 2f | 2a 20 6d 61 78 20 62 69 |TS .12./|* max bi|
|00001b90| 74 73 2f 63 6f 64 65 20 | 66 6f 72 20 31 36 2d 62 |ts/code |for 16-b|
|00001ba0| 69 74 20 6d 61 63 68 69 | 6e 65 20 2a 2f 0a 23 20 |it machi|ne */.# |
|00001bb0| 64 65 66 69 6e 65 20 4e | 4f 5f 55 43 48 41 52 09 |define N|O_UCHAR.|
|00001bc0| 2f 2a 20 61 6c 73 6f 20 | 69 66 20 22 75 6e 73 69 |/* also |if "unsi|
|00001bd0| 67 6e 65 64 20 63 68 61 | 72 22 20 66 75 6e 63 74 |gned cha|r" funct|
|00001be0| 69 6f 6e 73 20 61 73 20 | 73 69 67 6e 65 64 20 63 |ions as |signed c|
|00001bf0| 68 61 72 20 2a 2f 0a 23 | 20 75 6e 64 65 66 20 55 |har */.#| undef U|
|00001c00| 53 45 52 4d 45 4d 20 0a | 23 65 6e 64 69 66 20 2f |SERMEM .|#endif /|
|00001c10| 2a 20 70 64 70 31 31 20 | 2a 2f 09 2f 2a 20 64 6f |* pdp11 |*/./* do|
|00001c20| 6e 27 74 20 66 6f 72 67 | 65 74 20 74 6f 20 63 6f |n't forg|et to co|
|00001c30| 6d 70 69 6c 65 20 77 69 | 74 68 20 2d 69 20 2a 2f |mpile wi|th -i */|
|00001c40| 0a 0a 23 69 66 64 65 66 | 20 7a 38 30 30 30 0a 23 |..#ifdef| z8000.#|
|00001c50| 20 64 65 66 69 6e 65 20 | 42 49 54 53 20 09 31 32 | define |BITS .12|
|00001c60| 0a 23 20 75 6e 64 65 66 | 20 76 61 78 09 09 2f 2a |.# undef| vax../*|
|00001c70| 20 77 65 69 72 64 20 70 | 72 65 70 72 6f 63 65 73 | weird p|reproces|
|00001c80| 73 6f 72 20 2a 2f 0a 23 | 20 75 6e 64 65 66 20 55 |sor */.#| undef U|
|00001c90| 53 45 52 4d 45 4d 20 0a | 23 65 6e 64 69 66 20 2f |SERMEM .|#endif /|
|00001ca0| 2a 20 7a 38 30 30 30 20 | 2a 2f 0a 0a 23 69 66 64 |* z8000 |*/..#ifd|
|00001cb0| 65 66 20 70 63 78 74 0a | 23 20 64 65 66 69 6e 65 |ef pcxt.|# define|
|00001cc0| 20 42 49 54 53 20 20 20 | 31 32 0a 23 20 75 6e 64 | BITS |12.# und|
|00001cd0| 65 66 20 55 53 45 52 4d | 45 4d 0a 23 65 6e 64 69 |ef USERM|EM.#endi|
|00001ce0| 66 20 2f 2a 20 70 63 78 | 74 20 2a 2f 0a 0a 23 69 |f /* pcx|t */..#i|
|00001cf0| 66 64 65 66 20 55 53 45 | 52 4d 45 4d 0a 23 20 69 |fdef USE|RMEM.# i|
|00001d00| 66 20 55 53 45 52 4d 45 | 4d 20 3e 3d 20 28 34 33 |f USERME|M >= (43|
|00001d10| 33 34 38 34 2b 53 41 43 | 52 45 44 4d 45 4d 29 0a |3484+SAC|REDMEM).|
|00001d20| 23 20 20 64 65 66 69 6e | 65 20 50 42 49 54 53 09 |# defin|e PBITS.|
|00001d30| 31 36 0a 23 20 65 6c 73 | 65 0a 23 20 20 69 66 20 |16.# els|e.# if |
|00001d40| 55 53 45 52 4d 45 4d 20 | 3e 3d 20 28 32 32 39 36 |USERMEM |>= (2296|
|00001d50| 30 30 2b 53 41 43 52 45 | 44 4d 45 4d 29 0a 23 20 |00+SACRE|DMEM).# |
|00001d60| 20 20 64 65 66 69 6e 65 | 20 50 42 49 54 53 09 31 | define| PBITS.1|
|00001d70| 35 0a 23 20 20 65 6c 73 | 65 0a 23 20 20 20 69 66 |5.# els|e.# if|
|00001d80| 20 55 53 45 52 4d 45 4d | 20 3e 3d 20 28 31 32 37 | USERMEM| >= (127|
|00001d90| 35 33 36 2b 53 41 43 52 | 45 44 4d 45 4d 29 0a 23 |536+SACR|EDMEM).#|
|00001da0| 20 20 20 20 64 65 66 69 | 6e 65 20 50 42 49 54 53 | defi|ne PBITS|
|00001db0| 09 31 34 0a 23 20 20 20 | 65 6c 73 65 0a 23 20 20 |.14.# |else.# |
|00001dc0| 20 20 69 66 20 55 53 45 | 52 4d 45 4d 20 3e 3d 20 | if USE|RMEM >= |
|00001dd0| 28 37 33 34 36 34 2b 53 | 41 43 52 45 44 4d 45 4d |(73464+S|ACREDMEM|
|00001de0| 29 0a 23 20 20 20 20 20 | 64 65 66 69 6e 65 20 50 |).# |define P|
|00001df0| 42 49 54 53 09 31 33 0a | 23 20 20 20 20 65 6c 73 |BITS.13.|# els|
|00001e00| 65 0a 23 20 20 20 20 20 | 64 65 66 69 6e 65 20 50 |e.# |define P|
|00001e10| 42 49 54 53 09 31 32 0a | 23 20 20 20 20 65 6e 64 |BITS.12.|# end|
|00001e20| 69 66 0a 23 20 20 20 65 | 6e 64 69 66 0a 23 20 20 |if.# e|ndif.# |
|00001e30| 65 6e 64 69 66 0a 23 20 | 65 6e 64 69 66 0a 23 20 |endif.# |endif.# |
|00001e40| 75 6e 64 65 66 20 55 53 | 45 52 4d 45 4d 0a 23 65 |undef US|ERMEM.#e|
|00001e50| 6e 64 69 66 20 2f 2a 20 | 55 53 45 52 4d 45 4d 20 |ndif /* |USERMEM |
|00001e60| 2a 2f 0a 0a 23 69 66 64 | 65 66 20 50 42 49 54 53 |*/..#ifd|ef PBITS|
|00001e70| 09 09 2f 2a 20 50 72 65 | 66 65 72 72 65 64 20 42 |../* Pre|ferred B|
|00001e80| 49 54 53 20 66 6f 72 20 | 74 68 69 73 20 6d 65 6d |ITS for |this mem|
|00001e90| 6f 72 79 20 73 69 7a 65 | 20 2a 2f 0a 23 20 69 66 |ory size| */.# if|
|00001ea0| 6e 64 65 66 20 42 49 54 | 53 0a 23 20 20 64 65 66 |ndef BIT|S.# def|
|00001eb0| 69 6e 65 20 42 49 54 53 | 20 50 42 49 54 53 0a 23 |ine BITS| PBITS.#|
|00001ec0| 20 65 6e 64 69 66 20 42 | 49 54 53 0a 23 65 6e 64 | endif B|ITS.#end|
|00001ed0| 69 66 20 2f 2a 20 50 42 | 49 54 53 20 2a 2f 0a 0a |if /* PB|ITS */..|
|00001ee0| 23 69 66 20 42 49 54 53 | 20 3d 3d 20 31 36 0a 23 |#if BITS| == 16.#|
|00001ef0| 20 64 65 66 69 6e 65 20 | 48 53 49 5a 45 09 36 39 | define |HSIZE.69|
|00001f00| 30 30 31 09 09 2f 2a 20 | 39 35 25 20 6f 63 63 75 |001../* |95% occu|
|00001f10| 70 61 6e 63 79 20 2a 2f | 0a 23 65 6e 64 69 66 0a |pancy */|.#endif.|
|00001f20| 23 69 66 20 42 49 54 53 | 20 3d 3d 20 31 35 0a 23 |#if BITS| == 15.#|
|00001f30| 20 64 65 66 69 6e 65 20 | 48 53 49 5a 45 09 33 35 | define |HSIZE.35|
|00001f40| 30 32 33 09 09 2f 2a 20 | 39 34 25 20 6f 63 63 75 |023../* |94% occu|
|00001f50| 70 61 6e 63 79 20 2a 2f | 0a 23 65 6e 64 69 66 0a |pancy */|.#endif.|
|00001f60| 23 69 66 20 42 49 54 53 | 20 3d 3d 20 31 34 0a 23 |#if BITS| == 14.#|
|00001f70| 20 64 65 66 69 6e 65 20 | 48 53 49 5a 45 09 31 38 | define |HSIZE.18|
|00001f80| 30 31 33 09 09 2f 2a 20 | 39 31 25 20 6f 63 63 75 |013../* |91% occu|
|00001f90| 70 61 6e 63 79 20 2a 2f | 0a 23 65 6e 64 69 66 0a |pancy */|.#endif.|
|00001fa0| 23 69 66 20 42 49 54 53 | 20 3d 3d 20 31 33 0a 23 |#if BITS| == 13.#|
|00001fb0| 20 64 65 66 69 6e 65 20 | 48 53 49 5a 45 09 39 30 | define |HSIZE.90|
|00001fc0| 30 31 09 09 2f 2a 20 39 | 31 25 20 6f 63 63 75 70 |01../* 9|1% occup|
|00001fd0| 61 6e 63 79 20 2a 2f 0a | 23 65 6e 64 69 66 0a 23 |ancy */.|#endif.#|
|00001fe0| 69 66 20 42 49 54 53 20 | 3c 3d 20 31 32 0a 23 20 |if BITS |<= 12.# |
|00001ff0| 64 65 66 69 6e 65 20 48 | 53 49 5a 45 09 35 30 30 |define H|SIZE.500|
|00002000| 33 09 09 2f 2a 20 38 30 | 25 20 6f 63 63 75 70 61 |3../* 80|% occupa|
|00002010| 6e 63 79 20 2a 2f 0a 23 | 65 6e 64 69 66 0a 0a 23 |ncy */.#|endif..#|
|00002020| 69 66 64 65 66 20 4d 5f | 58 45 4e 49 58 09 09 09 |ifdef M_|XENIX...|
|00002030| 2f 2a 20 53 74 75 70 69 | 64 20 63 6f 6d 70 69 6c |/* Stupi|d compil|
|00002040| 65 72 20 63 61 6e 27 74 | 20 68 61 6e 64 6c 65 20 |er can't| handle |
|00002050| 61 72 72 61 79 73 20 77 | 69 74 68 20 2a 2f 0a 23 |arrays w|ith */.#|
|00002060| 20 69 66 20 42 49 54 53 | 20 3d 3d 20 31 36 09 09 | if BITS| == 16..|
|00002070| 09 2f 2a 20 6d 6f 72 65 | 20 74 68 61 6e 20 36 35 |./* more| than 65|
|00002080| 35 33 35 20 62 79 74 65 | 73 20 2d 20 73 6f 20 77 |535 byte|s - so w|
|00002090| 65 20 66 61 6b 65 20 69 | 74 20 2a 2f 0a 23 20 20 |e fake i|t */.# |
|000020a0| 64 65 66 69 6e 65 20 58 | 45 4e 49 58 5f 31 36 0a |define X|ENIX_16.|
|000020b0| 23 20 65 6c 73 65 0a 23 | 20 20 69 66 20 42 49 54 |# else.#| if BIT|
|000020c0| 53 20 3e 20 31 33 09 09 | 09 2f 2a 20 43 6f 64 65 |S > 13..|./* Code|
|000020d0| 20 6f 6e 6c 79 20 68 61 | 6e 64 6c 65 73 20 42 49 | only ha|ndles BI|
|000020e0| 54 53 20 3d 20 31 32 2c | 20 31 33 2c 20 6f 72 20 |TS = 12,| 13, or |
|000020f0| 31 36 20 2a 2f 0a 23 20 | 20 20 64 65 66 69 6e 65 |16 */.# | define|
|00002100| 20 42 49 54 53 09 31 33 | 0a 23 20 20 65 6e 64 69 | BITS.13|.# endi|
|00002110| 66 0a 23 20 65 6e 64 69 | 66 0a 23 65 6e 64 69 66 |f.# endi|f.#endif|
|00002120| 0a 0a 2f 2a 0a 20 2a 20 | 61 20 63 6f 64 65 5f 69 |../*. * |a code_i|
|00002130| 6e 74 20 6d 75 73 74 20 | 62 65 20 61 62 6c 65 20 |nt must |be able |
|00002140| 74 6f 20 68 6f 6c 64 20 | 32 2a 2a 42 49 54 53 20 |to hold |2**BITS |
|00002150| 76 61 6c 75 65 73 20 6f | 66 20 74 79 70 65 20 69 |values o|f type i|
|00002160| 6e 74 2c 20 61 6e 64 20 | 61 6c 73 6f 20 2d 31 0a |nt, and |also -1.|
|00002170| 20 2a 2f 0a 23 69 66 20 | 42 49 54 53 20 3e 20 31 | */.#if |BITS > 1|
|00002180| 35 0a 74 79 70 65 64 65 | 66 20 6c 6f 6e 67 20 69 |5.typede|f long i|
|00002190| 6e 74 09 63 6f 64 65 5f | 69 6e 74 3b 0a 23 65 6c |nt.code_|int;.#el|
|000021a0| 73 65 0a 74 79 70 65 64 | 65 66 20 69 6e 74 09 09 |se.typed|ef int..|
|000021b0| 63 6f 64 65 5f 69 6e 74 | 3b 0a 23 65 6e 64 69 66 |code_int|;.#endif|
|000021c0| 0a 0a 23 69 66 64 65 66 | 20 53 49 47 4e 45 44 5f |..#ifdef| SIGNED_|
|000021d0| 43 4f 4d 50 41 52 45 5f | 53 4c 4f 57 0a 74 79 70 |COMPARE_|SLOW.typ|
|000021e0| 65 64 65 66 20 75 6e 73 | 69 67 6e 65 64 20 6c 6f |edef uns|igned lo|
|000021f0| 6e 67 20 69 6e 74 20 63 | 6f 75 6e 74 5f 69 6e 74 |ng int c|ount_int|
|00002200| 3b 0a 74 79 70 65 64 65 | 66 20 75 6e 73 69 67 6e |;.typede|f unsign|
|00002210| 65 64 20 73 68 6f 72 74 | 20 69 6e 74 20 63 6f 75 |ed short| int cou|
|00002220| 6e 74 5f 73 68 6f 72 74 | 3b 0a 23 65 6c 73 65 0a |nt_short|;.#else.|
|00002230| 74 79 70 65 64 65 66 20 | 6c 6f 6e 67 20 69 6e 74 |typedef |long int|
|00002240| 09 20 20 63 6f 75 6e 74 | 5f 69 6e 74 3b 0a 23 65 |. count|_int;.#e|
|00002250| 6e 64 69 66 0a 0a 23 69 | 66 64 65 66 20 4e 4f 5f |ndif..#i|fdef NO_|
|00002260| 55 43 48 41 52 0a 20 74 | 79 70 65 64 65 66 20 63 |UCHAR. t|ypedef c|
|00002270| 68 61 72 09 63 68 61 72 | 5f 74 79 70 65 3b 0a 23 |har.char|_type;.#|
|00002280| 65 6c 73 65 0a 20 74 79 | 70 65 64 65 66 09 75 6e |else. ty|pedef.un|
|00002290| 73 69 67 6e 65 64 20 63 | 68 61 72 09 63 68 61 72 |signed c|har.char|
|000022a0| 5f 74 79 70 65 3b 0a 23 | 65 6e 64 69 66 20 2f 2a |_type;.#|endif /*|
|000022b0| 20 55 43 48 41 52 20 2a | 2f 0a 63 68 61 72 5f 74 | UCHAR *|/.char_t|
|000022c0| 79 70 65 20 6d 61 67 69 | 63 5f 68 65 61 64 65 72 |ype magi|c_header|
|000022d0| 5b 5d 20 3d 20 7b 20 22 | 5c 30 33 37 5c 32 33 35 |[] = { "|\037\235|
|000022e0| 22 20 7d 3b 09 2f 2a 20 | 31 46 20 39 44 20 2a 2f |" };./* |1F 9D */|
|000022f0| 0a 0a 2f 2a 20 44 65 66 | 69 6e 65 73 20 66 6f 72 |../* Def|ines for|
|00002300| 20 74 68 69 72 64 20 62 | 79 74 65 20 6f 66 20 68 | third b|yte of h|
|00002310| 65 61 64 65 72 20 2a 2f | 0a 23 64 65 66 69 6e 65 |eader */|.#define|
|00002320| 20 42 49 54 5f 4d 41 53 | 4b 09 30 78 31 66 0a 23 | BIT_MAS|K.0x1f.#|
|00002330| 64 65 66 69 6e 65 20 42 | 4c 4f 43 4b 5f 4d 41 53 |define B|LOCK_MAS|
|00002340| 4b 09 30 78 38 30 0a 2f | 2a 20 4d 61 73 6b 73 20 |K.0x80./|* Masks |
|00002350| 30 78 34 30 20 61 6e 64 | 20 30 78 32 30 20 61 72 |0x40 and| 0x20 ar|
|00002360| 65 20 66 72 65 65 2e 20 | 20 49 20 74 68 69 6e 6b |e free. | I think|
|00002370| 20 30 78 32 30 20 73 68 | 6f 75 6c 64 20 6d 65 61 | 0x20 sh|ould mea|
|00002380| 6e 20 74 68 61 74 20 74 | 68 65 72 65 20 69 73 0a |n that t|here is.|
|00002390| 20 20 20 61 20 66 6f 75 | 72 74 68 20 68 65 61 64 | a fou|rth head|
|000023a0| 65 72 20 62 79 74 65 20 | 28 66 6f 72 20 65 78 70 |er byte |(for exp|
|000023b0| 61 6e 73 69 6f 6e 29 2e | 0a 2a 2f 0a 23 64 65 66 |ansion).|.*/.#def|
|000023c0| 69 6e 65 20 49 4e 49 54 | 5f 42 49 54 53 20 39 09 |ine INIT|_BITS 9.|
|000023d0| 09 09 2f 2a 20 69 6e 69 | 74 69 61 6c 20 6e 75 6d |../* ini|tial num|
|000023e0| 62 65 72 20 6f 66 20 62 | 69 74 73 2f 63 6f 64 65 |ber of b|its/code|
|000023f0| 20 2a 2f 0a 0a 2f 2a 0a | 20 2a 20 63 6f 6d 70 72 | */../*.| * compr|
|00002400| 65 73 73 2e 63 20 2d 20 | 46 69 6c 65 20 63 6f 6d |ess.c - |File com|
|00002410| 70 72 65 73 73 69 6f 6e | 20 61 6c 61 20 49 45 45 |pression| ala IEE|
|00002420| 45 20 43 6f 6d 70 75 74 | 65 72 2c 20 4a 75 6e 65 |E Comput|er, June|
|00002430| 20 31 39 38 34 2e 0a 20 | 2a 0a 20 2a 20 41 75 74 | 1984.. |*. * Aut|
|00002440| 68 6f 72 73 3a 09 53 70 | 65 6e 63 65 72 20 57 2e |hors:.Sp|encer W.|
|00002450| 20 54 68 6f 6d 61 73 09 | 28 64 65 63 76 61 78 21 | Thomas.|(decvax!|
|00002460| 68 61 72 70 6f 21 75 74 | 61 68 2d 63 73 21 75 74 |harpo!ut|ah-cs!ut|
|00002470| 61 68 2d 67 72 21 74 68 | 6f 6d 61 73 29 0a 20 2a |ah-gr!th|omas). *|
|00002480| 09 09 4a 69 6d 20 4d 63 | 4b 69 65 09 09 28 64 65 |..Jim Mc|Kie..(de|
|00002490| 63 76 61 78 21 6d 63 76 | 61 78 21 6a 69 6d 29 0a |cvax!mcv|ax!jim).|
|000024a0| 20 2a 09 09 53 74 65 76 | 65 20 44 61 76 69 65 73 | *..Stev|e Davies|
|000024b0| 09 09 28 64 65 63 76 61 | 78 21 76 61 78 31 33 35 |..(decva|x!vax135|
|000024c0| 21 70 65 74 73 64 21 70 | 65 6f 72 61 21 73 72 64 |!petsd!p|eora!srd|
|000024d0| 29 0a 20 2a 09 09 4b 65 | 6e 20 54 75 72 6b 6f 77 |). *..Ke|n Turkow|
|000024e0| 73 6b 69 09 09 28 64 65 | 63 76 61 78 21 64 65 63 |ski..(de|cvax!dec|
|000024f0| 77 72 6c 21 74 75 72 74 | 6c 65 76 61 78 21 6b 65 |wrl!turt|levax!ke|
|00002500| 6e 29 0a 20 2a 09 09 4a | 61 6d 65 73 20 41 2e 20 |n). *..J|ames A. |
|00002510| 57 6f 6f 64 73 09 09 28 | 64 65 63 76 61 78 21 69 |Woods..(|decvax!i|
|00002520| 68 6e 70 34 21 61 6d 65 | 73 21 6a 61 77 29 0a 20 |hnp4!ame|s!jaw). |
|00002530| 2a 09 09 4a 6f 65 20 4f | 72 6f 73 74 09 09 28 64 |*..Joe O|rost..(d|
|00002540| 65 63 76 61 78 21 76 61 | 78 31 33 35 21 70 65 74 |ecvax!va|x135!pet|
|00002550| 73 64 21 6a 6f 65 29 0a | 20 2a 0a 20 2a 20 24 48 |sd!joe).| *. * $H|
|00002560| 65 61 64 65 72 3a 20 63 | 6f 6d 70 72 65 73 73 2e |eader: c|ompress.|
|00002570| 63 2c 76 20 34 2e 30 20 | 38 35 2f 30 37 2f 33 30 |c,v 4.0 |85/07/30|
|00002580| 20 31 32 3a 35 30 3a 30 | 30 20 6a 6f 65 20 52 65 | 12:50:0|0 joe Re|
|00002590| 6c 65 61 73 65 20 24 0a | 20 2a 20 24 4c 6f 67 3a |lease $.| * $Log:|
|000025a0| 09 63 6f 6d 70 72 65 73 | 73 2e 63 2c 76 20 24 0a |.compres|s.c,v $.|
|000025b0| 20 2a 20 52 65 76 69 73 | 69 6f 6e 20 34 2e 30 20 | * Revis|ion 4.0 |
|000025c0| 20 38 35 2f 30 37 2f 33 | 30 20 20 31 32 3a 35 30 | 85/07/3|0 12:50|
|000025d0| 3a 30 30 20 20 6a 6f 65 | 0a 20 2a 20 52 65 6d 6f |:00 joe|. * Remo|
|000025e0| 76 65 64 20 66 65 72 72 | 6f 72 28 29 20 63 61 6c |ved ferr|or() cal|
|000025f0| 6c 73 20 69 6e 20 6f 75 | 74 70 75 74 20 72 6f 75 |ls in ou|tput rou|
|00002600| 74 69 6e 65 20 6f 6e 20 | 65 76 65 72 79 20 6f 75 |tine on |every ou|
|00002610| 74 70 75 74 20 65 78 63 | 65 70 74 20 66 69 72 73 |tput exc|ept firs|
|00002620| 74 2e 0a 20 2a 20 50 72 | 65 70 61 72 65 64 20 66 |t.. * Pr|epared f|
|00002630| 6f 72 20 72 65 6c 65 61 | 73 65 20 74 6f 20 74 68 |or relea|se to th|
|00002640| 65 20 77 6f 72 6c 64 2e | 0a 20 2a 20 0a 20 2a 20 |e world.|. * . * |
|00002650| 52 65 76 69 73 69 6f 6e | 20 33 2e 36 20 20 38 35 |Revision| 3.6 85|
|00002660| 2f 30 37 2f 30 34 20 20 | 30 31 3a 32 32 3a 32 31 |/07/04 |01:22:21|
|00002670| 20 20 6a 6f 65 0a 20 2a | 20 52 65 6d 6f 76 65 20 | joe. *| Remove |
|00002680| 6d 75 63 68 20 77 61 73 | 74 65 64 20 73 74 6f 72 |much was|ted stor|
|00002690| 61 67 65 20 62 79 20 6f | 76 65 72 6c 61 79 69 6e |age by o|verlayin|
|000026a0| 67 20 68 61 73 68 20 74 | 61 62 6c 65 20 77 69 74 |g hash t|able wit|
|000026b0| 68 20 74 68 65 20 74 61 | 62 6c 65 73 0a 20 2a 20 |h the ta|bles. * |
|000026c0| 75 73 65 64 20 62 79 20 | 64 65 63 6f 6d 70 72 65 |used by |decompre|
|000026d0| 73 73 3a 20 74 61 62 5f | 73 75 66 66 69 78 5b 31 |ss: tab_|suffix[1|
|000026e0| 3c 3c 42 49 54 53 5d 2c | 20 73 74 61 63 6b 5b 38 |<<BITS],| stack[8|
|000026f0| 30 30 30 5d 2e 20 20 55 | 70 64 61 74 65 64 20 55 |000]. U|pdated U|
|00002700| 53 45 52 4d 45 4d 0a 20 | 2a 20 63 6f 6d 70 75 74 |SERMEM. |* comput|
|00002710| 61 74 69 6f 6e 73 2e 20 | 20 46 69 78 65 64 20 64 |ations. | Fixed d|
|00002720| 75 6d 70 5f 74 61 62 28 | 29 20 44 45 42 55 47 20 |ump_tab(|) DEBUG |
|00002730| 72 6f 75 74 69 6e 65 2e | 0a 20 2a 0a 20 2a 20 52 |routine.|. *. * R|
|00002740| 65 76 69 73 69 6f 6e 20 | 33 2e 35 20 20 38 35 2f |evision |3.5 85/|
|00002750| 30 36 2f 33 30 20 20 32 | 30 3a 34 37 3a 32 31 20 |06/30 2|0:47:21 |
|00002760| 20 6a 61 77 0a 20 2a 20 | 43 68 61 6e 67 65 20 68 | jaw. * |Change h|
|00002770| 61 73 68 20 66 75 6e 63 | 74 69 6f 6e 20 74 6f 20 |ash func|tion to |
|00002780| 75 73 65 20 65 78 63 6c | 75 73 69 76 65 2d 6f 72 |use excl|usive-or|
|00002790| 2e 20 20 52 69 70 20 6f | 75 74 20 68 61 73 68 20 |. Rip o|ut hash |
|000027a0| 63 61 63 68 65 2e 20 20 | 54 68 65 73 65 0a 20 2a |cache. |These. *|
|000027b0| 20 73 70 65 65 64 75 70 | 73 20 72 65 6e 64 65 72 | speedup|s render|
|000027c0| 20 74 68 65 20 6d 65 67 | 61 6d 65 6d 6f 72 79 20 | the meg|amemory |
|000027d0| 76 65 72 73 69 6f 6e 20 | 64 65 66 75 6e 63 74 2c |version |defunct,|
|000027e0| 20 66 6f 72 20 6e 6f 77 | 2e 20 20 4d 61 6b 65 20 | for now|. Make |
|000027f0| 64 65 63 6f 64 65 72 0a | 20 2a 20 73 74 61 63 6b |decoder.| * stack|
|00002800| 20 67 6c 6f 62 61 6c 2e | 20 20 50 61 72 74 73 20 | global.| Parts |
|00002810| 6f 66 20 74 68 65 20 52 | 43 53 20 74 72 75 6e 6b |of the R|CS trunk|
|00002820| 73 20 32 2e 37 2c 20 32 | 2e 36 2c 20 61 6e 64 20 |s 2.7, 2|.6, and |
|00002830| 32 2e 31 20 6e 6f 20 6c | 6f 6e 67 65 72 20 61 70 |2.1 no l|onger ap|
|00002840| 70 6c 79 2e 0a 20 2a 0a | 20 2a 20 52 65 76 69 73 |ply.. *.| * Revis|
|00002850| 69 6f 6e 20 33 2e 34 20 | 20 38 35 2f 30 36 2f 32 |ion 3.4 | 85/06/2|
|00002860| 37 20 20 31 32 3a 30 30 | 3a 30 30 20 20 6b 65 6e |7 12:00|:00 ken|
|00002870| 0a 20 2a 20 47 65 74 20 | 72 69 64 20 6f 66 20 61 |. * Get |rid of a|
|00002880| 6c 6c 20 66 6c 6f 61 74 | 69 6e 67 2d 70 6f 69 6e |ll float|ing-poin|
|00002890| 74 20 63 61 6c 63 75 6c | 61 74 69 6f 6e 73 20 62 |t calcul|ations b|
|000028a0| 79 20 64 6f 69 6e 67 20 | 61 6c 6c 20 63 6f 6d 70 |y doing |all comp|
|000028b0| 72 65 73 73 69 6f 6e 20 | 72 61 74 69 6f 0a 20 2a |ression |ratio. *|
|000028c0| 20 63 61 6c 63 75 6c 61 | 74 69 6f 6e 73 20 69 6e | calcula|tions in|
|000028d0| 20 66 69 78 65 64 20 70 | 6f 69 6e 74 2e 0a 20 2a | fixed p|oint.. *|
|000028e0| 0a 20 2a 20 52 65 76 69 | 73 69 6f 6e 20 33 2e 33 |. * Revi|sion 3.3|
|000028f0| 20 20 38 35 2f 30 36 2f | 32 34 20 20 32 31 3a 35 | 85/06/|24 21:5|
|00002900| 33 3a 32 34 20 20 6a 6f | 65 0a 20 2a 20 49 6e 63 |3:24 jo|e. * Inc|
|00002910| 6f 72 70 6f 72 61 74 65 | 20 70 6f 72 74 61 62 69 |orporate| portabi|
|00002920| 6c 69 74 79 20 73 75 67 | 67 65 73 74 69 6f 6e 20 |lity sug|gestion |
|00002930| 66 6f 72 20 4d 5f 58 45 | 4e 49 58 2e 20 20 47 6f |for M_XE|NIX. Go|
|00002940| 74 20 72 69 64 20 6f 66 | 20 74 65 78 74 20 6f 6e |t rid of| text on|
|00002950| 20 23 65 6c 73 65 0a 20 | 2a 20 61 6e 64 20 23 65 | #else. |* and #e|
|00002960| 6e 64 69 66 20 6c 69 6e | 65 73 2e 20 20 43 6c 65 |ndif lin|es. Cle|
|00002970| 61 6e 65 64 20 75 70 20 | 23 69 66 64 65 66 73 20 |aned up |#ifdefs |
|00002980| 66 6f 72 20 76 61 78 20 | 61 6e 64 20 69 6e 74 65 |for vax |and inte|
|00002990| 72 64 61 74 61 2e 0a 20 | 2a 0a 20 2a 20 52 65 76 |rdata.. |*. * Rev|
|000029a0| 69 73 69 6f 6e 20 33 2e | 32 20 20 38 35 2f 30 36 |ision 3.|2 85/06|
|000029b0| 2f 30 36 20 20 32 31 3a | 35 33 3a 32 34 20 20 6a |/06 21:|53:24 j|
|000029c0| 61 77 0a 20 2a 20 49 6e | 63 6f 72 70 6f 72 61 74 |aw. * In|corporat|
|000029d0| 65 20 70 6f 72 74 61 62 | 69 6c 69 74 79 20 73 75 |e portab|ility su|
|000029e0| 67 67 65 73 74 69 6f 6e | 73 20 66 6f 72 20 5a 38 |ggestion|s for Z8|
|000029f0| 30 30 30 2c 20 49 42 4d | 20 50 43 2f 58 54 20 66 |000, IBM| PC/XT f|
|00002a00| 72 6f 6d 20 6d 61 69 6c | 69 6e 67 20 6c 69 73 74 |rom mail|ing list|
|00002a10| 2e 0a 20 2a 20 44 65 66 | 61 75 6c 74 20 74 6f 20 |.. * Def|ault to |
|00002a20| 22 71 75 69 65 74 22 20 | 6f 75 74 70 75 74 20 28 |"quiet" |output (|
|00002a30| 6e 6f 20 63 6f 6d 70 72 | 65 73 73 69 6f 6e 20 73 |no compr|ession s|
|00002a40| 74 61 74 69 73 74 69 63 | 73 29 2e 0a 20 2a 0a 20 |tatistic|s).. *. |
|00002a50| 2a 20 52 65 76 69 73 69 | 6f 6e 20 33 2e 31 20 20 |* Revisi|on 3.1 |
|00002a60| 38 35 2f 30 35 2f 31 32 | 20 20 31 38 3a 35 36 3a |85/05/12| 18:56:|
|00002a70| 31 33 20 20 6a 61 77 0a | 20 2a 20 49 6e 74 65 67 |13 jaw.| * Integ|
|00002a80| 72 61 74 65 20 64 65 63 | 6f 6d 70 72 65 73 73 28 |rate dec|ompress(|
|00002a90| 29 20 73 74 61 63 6b 20 | 73 70 65 65 64 75 70 73 |) stack |speedups|
|00002aa0| 20 28 66 72 6f 6d 20 65 | 61 72 6c 79 20 70 6f 69 | (from e|arly poi|
|00002ab0| 6e 74 65 72 20 6d 6f 64 | 73 20 62 79 20 4d 63 4b |nter mod|s by McK|
|00002ac0| 69 65 29 2e 0a 20 2a 20 | 52 65 70 61 69 72 20 6d |ie).. * |Repair m|
|00002ad0| 75 6c 74 69 2d 66 69 6c | 65 20 55 53 45 52 4d 45 |ulti-fil|e USERME|
|00002ae0| 4d 20 67 61 66 66 65 2e | 20 20 55 6e 69 66 79 20 |M gaffe.| Unify |
|00002af0| 27 66 6f 72 63 65 27 20 | 66 6c 61 67 73 20 74 6f |'force' |flags to|
|00002b00| 20 6d 69 6d 69 63 20 73 | 65 6d 61 6e 74 69 63 73 | mimic s|emantics|
|00002b10| 0a 20 2a 20 6f 66 20 53 | 56 52 32 20 27 70 61 63 |. * of S|VR2 'pac|
|00002b20| 6b 27 2e 20 20 53 74 72 | 65 61 6d 6c 69 6e 65 20 |k'. Str|eamline |
|00002b30| 62 6c 6f 63 6b 2d 63 6f | 6d 70 72 65 73 73 20 74 |block-co|mpress t|
|00002b40| 61 62 6c 65 20 63 6c 65 | 61 72 20 6c 6f 67 69 63 |able cle|ar logic|
|00002b50| 2e 20 20 49 6e 63 72 65 | 61 73 65 20 0a 20 2a 20 |. Incre|ase . * |
|00002b60| 6f 75 74 70 75 74 20 62 | 79 74 65 20 63 6f 75 6e |output b|yte coun|
|00002b70| 74 20 62 79 20 6d 61 67 | 69 63 20 6e 75 6d 62 65 |t by mag|ic numbe|
|00002b80| 72 20 73 69 7a 65 2e 0a | 20 2a 20 0a 20 2a 20 52 |r size..| * . * R|
|00002b90| 65 76 69 73 69 6f 6e 20 | 33 2e 30 20 20 20 38 34 |evision |3.0 84|
|00002ba0| 2f 31 31 2f 32 37 20 20 | 31 31 3a 35 30 3a 30 30 |/11/27 |11:50:00|
|00002bb0| 20 20 70 65 74 73 64 21 | 6a 6f 65 0a 20 2a 20 53 | petsd!|joe. * S|
|00002bc0| 65 74 20 48 53 49 5a 45 | 20 64 65 70 65 6e 64 69 |et HSIZE| dependi|
|00002bd0| 6e 67 20 6f 6e 20 42 49 | 54 53 2e 20 20 53 65 74 |ng on BI|TS. Set|
|00002be0| 20 42 49 54 53 20 64 65 | 70 65 6e 64 69 6e 67 20 | BITS de|pending |
|00002bf0| 6f 6e 20 55 53 45 52 4d | 45 4d 2e 20 20 55 6e 72 |on USERM|EM. Unr|
|00002c00| 6f 6c 6c 65 64 0a 20 2a | 20 6c 6f 6f 70 73 20 69 |olled. *| loops i|
|00002c10| 6e 20 63 6c 65 61 72 20 | 72 6f 75 74 69 6e 65 73 |n clear |routines|
|00002c20| 2e 20 20 41 64 64 65 64 | 20 22 2d 43 22 20 66 6c |. Added| "-C" fl|
|00002c30| 61 67 20 66 6f 72 20 32 | 2e 30 20 63 6f 6d 70 61 |ag for 2|.0 compa|
|00002c40| 74 69 62 69 6c 69 74 79 | 2e 20 20 55 73 65 64 0a |tibility|. Used.|
|00002c50| 20 2a 20 75 6e 73 69 67 | 6e 65 64 20 63 6f 6d 70 | * unsig|ned comp|
|00002c60| 61 72 65 73 20 6f 6e 20 | 50 65 72 6b 69 6e 2d 45 |ares on |Perkin-E|
|00002c70| 6c 6d 65 72 2e 20 20 46 | 69 78 65 64 20 66 6f 72 |lmer. F|ixed for|
|00002c80| 65 67 72 6f 75 6e 64 20 | 63 68 65 63 6b 2e 0a 20 |eground |check.. |
|00002c90| 2a 0a 20 2a 20 52 65 76 | 69 73 69 6f 6e 20 32 2e |*. * Rev|ision 2.|
|00002ca0| 37 20 20 20 38 34 2f 31 | 31 2f 31 36 20 20 31 39 |7 84/1|1/16 19|
|00002cb0| 3a 33 35 3a 33 39 20 20 | 61 6d 65 73 21 6a 61 77 |:35:39 |ames!jaw|
|00002cc0| 0a 20 2a 20 43 61 63 68 | 65 20 63 6f 6d 6d 6f 6e |. * Cach|e common|
|00002cd0| 20 68 61 73 68 20 63 6f | 64 65 73 20 62 61 73 65 | hash co|des base|
|00002ce0| 64 20 6f 6e 20 69 6e 70 | 75 74 20 73 74 61 74 69 |d on inp|ut stati|
|00002cf0| 73 74 69 63 73 3b 20 74 | 68 69 73 20 69 6d 70 72 |stics; t|his impr|
|00002d00| 6f 76 65 73 0a 20 2a 20 | 70 65 72 66 6f 72 6d 61 |oves. * |performa|
|00002d10| 6e 63 65 20 66 6f 72 20 | 6c 6f 77 2d 64 65 6e 73 |nce for |low-dens|
|00002d20| 69 74 79 20 72 61 73 74 | 65 72 20 69 6d 61 67 65 |ity rast|er image|
|00002d30| 73 2e 20 20 50 61 73 73 | 20 6f 6e 20 23 69 66 64 |s. Pass| on #ifd|
|00002d40| 65 66 20 62 75 6e 64 6c | 65 0a 20 2a 20 66 72 6f |ef bundl|e. * fro|
|00002d50| 6d 20 54 75 72 6b 6f 77 | 73 6b 69 2e 0a 20 2a 0a |m Turkow|ski.. *.|
|00002d60| 20 2a 20 52 65 76 69 73 | 69 6f 6e 20 32 2e 36 20 | * Revis|ion 2.6 |
|00002d70| 20 20 38 34 2f 31 31 2f | 30 35 20 20 31 39 3a 31 | 84/11/|05 19:1|
|00002d80| 38 3a 32 31 20 20 61 6d | 65 73 21 6a 61 77 0a 20 |8:21 am|es!jaw. |
|00002d90| 2a 20 56 61 72 79 20 73 | 69 7a 65 20 6f 66 20 68 |* Vary s|ize of h|
|00002da0| 61 73 68 20 74 61 62 6c | 65 73 20 74 6f 20 72 65 |ash tabl|es to re|
|00002db0| 64 75 63 65 20 74 69 6d | 65 20 66 6f 72 20 73 6d |duce tim|e for sm|
|00002dc0| 61 6c 6c 20 66 69 6c 65 | 73 2e 0a 20 2a 20 54 75 |all file|s.. * Tu|
|00002dd0| 6e 65 20 50 44 50 2d 31 | 31 20 68 61 73 68 20 66 |ne PDP-1|1 hash f|
|00002de0| 75 6e 63 74 69 6f 6e 2e | 0a 20 2a 0a 20 2a 20 52 |unction.|. *. * R|
|00002df0| 65 76 69 73 69 6f 6e 20 | 32 2e 35 20 20 20 38 34 |evision |2.5 84|
|00002e00| 2f 31 30 2f 33 30 20 20 | 32 30 3a 31 35 3a 31 34 |/10/30 |20:15:14|
|00002e10| 20 20 61 6d 65 73 21 6a | 61 77 0a 20 2a 20 4a 75 | ames!j|aw. * Ju|
|00002e20| 6e 6b 20 63 68 61 69 6e | 69 6e 67 3b 20 72 65 70 |nk chain|ing; rep|
|00002e30| 6c 61 63 65 20 77 69 74 | 68 20 74 68 65 20 73 69 |lace wit|h the si|
|00002e40| 6d 70 6c 65 72 20 28 61 | 6e 64 2c 20 6f 6e 20 74 |mpler (a|nd, on t|
|00002e50| 68 65 20 56 41 58 2c 20 | 66 61 73 74 65 72 29 0a |he VAX, |faster).|
|00002e60| 20 2a 20 64 6f 75 62 6c | 65 20 68 61 73 68 69 6e | * doubl|e hashin|
|00002e70| 67 2c 20 64 69 73 63 75 | 73 73 65 64 20 77 69 74 |g, discu|ssed wit|
|00002e80| 68 69 6e 2e 20 20 4d 61 | 6b 65 20 62 6c 6f 63 6b |hin. Ma|ke block|
|00002e90| 20 63 6f 6d 70 72 65 73 | 73 69 6f 6e 20 73 74 61 | compres|sion sta|
|00002ea0| 6e 64 61 72 64 2e 0a 20 | 2a 0a 20 2a 20 52 65 76 |ndard.. |*. * Rev|
|00002eb0| 69 73 69 6f 6e 20 32 2e | 34 20 20 20 38 34 2f 31 |ision 2.|4 84/1|
|00002ec0| 30 2f 31 36 20 20 31 31 | 3a 31 31 3a 31 31 20 20 |0/16 11|:11:11 |
|00002ed0| 61 6d 65 73 21 6a 61 77 | 0a 20 2a 20 49 6e 74 72 |ames!jaw|. * Intr|
|00002ee0| 6f 64 75 63 65 20 61 64 | 61 70 74 69 76 65 20 72 |oduce ad|aptive r|
|00002ef0| 65 73 65 74 20 66 6f 72 | 20 62 6c 6f 63 6b 20 63 |eset for| block c|
|00002f00| 6f 6d 70 72 65 73 73 69 | 6f 6e 2c 20 74 6f 20 62 |ompressi|on, to b|
|00002f10| 6f 6f 73 74 20 74 68 65 | 20 72 61 74 65 0a 20 2a |oost the| rate. *|
|00002f20| 20 61 6e 6f 74 68 65 72 | 20 73 65 76 65 72 61 6c | another| several|
|00002f30| 20 70 65 72 63 65 6e 74 | 2e 20 20 28 53 65 65 20 | percent|. (See |
|00002f40| 6d 61 69 6c 69 6e 67 20 | 6c 69 73 74 20 6e 6f 74 |mailing |list not|
|00002f50| 65 73 2e 29 0a 20 2a 0a | 20 2a 20 52 65 76 69 73 |es.). *.| * Revis|
|00002f60| 69 6f 6e 20 32 2e 33 20 | 20 20 38 34 2f 30 39 2f |ion 2.3 | 84/09/|
|00002f70| 32 32 20 20 32 32 3a 30 | 30 3a 30 30 20 20 70 65 |22 22:0|0:00 pe|
|00002f80| 74 73 64 21 6a 6f 65 0a | 20 2a 20 49 6d 70 6c 65 |tsd!joe.| * Imple|
|00002f90| 6d 65 6e 74 65 64 20 22 | 2d 42 22 20 62 6c 6f 63 |mented "|-B" bloc|
|00002fa0| 6b 20 63 6f 6d 70 72 65 | 73 73 2e 20 20 49 6d 70 |k compre|ss. Imp|
|00002fb0| 6c 65 6d 65 6e 74 65 64 | 20 52 45 56 45 52 53 45 |lemented| REVERSE|
|00002fc0| 20 73 6f 72 74 69 6e 67 | 20 6f 66 20 74 61 62 5f | sorting| of tab_|
|00002fd0| 6e 65 78 74 2e 0a 20 2a | 20 42 75 67 20 66 69 78 |next.. *| Bug fix|
|00002fe0| 20 66 6f 72 20 6c 61 73 | 74 20 62 69 74 73 2e 20 | for las|t bits. |
|00002ff0| 20 43 68 61 6e 67 65 64 | 20 66 77 72 69 74 65 20 | Changed| fwrite |
|00003000| 74 6f 20 70 75 74 63 68 | 61 72 20 6c 6f 6f 70 20 |to putch|ar loop |
|00003010| 65 76 65 72 79 77 68 65 | 72 65 2e 0a 20 2a 0a 20 |everywhe|re.. *. |
|00003020| 2a 20 52 65 76 69 73 69 | 6f 6e 20 32 2e 32 20 20 |* Revisi|on 2.2 |
|00003030| 20 38 34 2f 30 39 2f 31 | 38 20 20 31 34 3a 31 32 | 84/09/1|8 14:12|
|00003040| 3a 32 31 20 20 61 6d 65 | 73 21 6a 61 77 0a 20 2a |:21 ame|s!jaw. *|
|00003050| 20 46 6f 6c 64 20 69 6e | 20 6e 65 77 73 20 63 68 | Fold in| news ch|
|00003060| 61 6e 67 65 73 2c 20 73 | 6d 61 6c 6c 20 6d 61 63 |anges, s|mall mac|
|00003070| 68 69 6e 65 20 74 79 70 | 65 64 65 66 20 66 72 6f |hine typ|edef fro|
|00003080| 6d 20 74 68 6f 6d 61 73 | 2c 0a 20 2a 20 23 69 66 |m thomas|,. * #if|
|00003090| 64 65 66 20 69 6e 74 65 | 72 64 61 74 61 20 66 72 |def inte|rdata fr|
|000030a0| 6f 6d 20 6a 6f 65 2e 0a | 20 2a 0a 20 2a 20 52 65 |om joe..| *. * Re|
|000030b0| 76 69 73 69 6f 6e 20 32 | 2e 31 20 20 20 38 34 2f |vision 2|.1 84/|
|000030c0| 30 39 2f 31 30 20 20 31 | 32 3a 33 34 3a 35 36 20 |09/10 1|2:34:56 |
|000030d0| 20 61 6d 65 73 21 6a 61 | 77 0a 20 2a 20 43 6f 6e | ames!ja|w. * Con|
|000030e0| 66 69 67 75 72 65 64 20 | 66 61 73 74 20 74 61 62 |figured |fast tab|
|000030f0| 6c 65 20 6c 6f 6f 6b 75 | 70 20 66 6f 72 20 33 32 |le looku|p for 32|
|00003100| 2d 62 69 74 20 6d 61 63 | 68 69 6e 65 73 2e 0a 20 |-bit mac|hines.. |
|00003110| 2a 20 54 68 69 73 20 63 | 75 74 73 20 75 73 65 72 |* This c|uts user|
|00003120| 20 74 69 6d 65 20 69 6e | 20 68 61 6c 66 20 66 6f | time in| half fo|
|00003130| 72 20 62 20 3c 3d 20 46 | 42 49 54 53 2c 20 61 6e |r b <= F|BITS, an|
|00003140| 64 20 69 73 20 75 73 65 | 66 75 6c 20 66 6f 72 20 |d is use|ful for |
|00003150| 6e 65 77 73 20 62 61 74 | 63 68 69 6e 67 0a 20 2a |news bat|ching. *|
|00003160| 20 66 72 6f 6d 20 56 41 | 58 20 74 6f 20 50 44 50 | from VA|X to PDP|
|00003170| 20 73 69 74 65 73 2e 20 | 20 41 6c 73 6f 20 73 70 | sites. | Also sp|
|00003180| 65 64 20 75 70 20 64 65 | 63 6f 6d 70 72 65 73 73 |ed up de|compress|
|00003190| 28 29 20 5b 66 77 72 69 | 74 65 2d 3e 70 75 74 63 |() [fwri|te->putc|
|000031a0| 5d 20 61 6e 64 0a 20 2a | 20 61 64 64 65 64 20 73 |] and. *| added s|
|000031b0| 69 67 6e 61 6c 20 63 61 | 74 63 68 65 72 20 5b 70 |ignal ca|tcher [p|
|000031c0| 6c 75 73 20 62 65 65 66 | 20 69 6e 20 77 72 69 74 |lus beef| in writ|
|000031d0| 65 65 72 72 28 29 5d 20 | 74 6f 20 64 65 6c 65 74 |eerr()] |to delet|
|000031e0| 65 20 65 66 66 6c 75 76 | 69 61 2e 0a 20 2a 0a 20 |e effluv|ia.. *. |
|000031f0| 2a 20 52 65 76 69 73 69 | 6f 6e 20 32 2e 30 20 20 |* Revisi|on 2.0 |
|00003200| 20 38 34 2f 30 38 2f 32 | 38 20 20 32 32 3a 30 30 | 84/08/2|8 22:00|
|00003210| 3a 30 30 20 20 70 65 74 | 73 64 21 6a 6f 65 0a 20 |:00 pet|sd!joe. |
|00003220| 2a 20 41 64 64 20 63 68 | 65 63 6b 20 66 6f 72 20 |* Add ch|eck for |
|00003230| 66 6f 72 65 67 72 6f 75 | 6e 64 20 62 65 66 6f 72 |foregrou|nd befor|
|00003240| 65 20 70 72 6f 6d 70 74 | 69 6e 67 20 75 73 65 72 |e prompt|ing user|
|00003250| 2e 20 20 49 6e 73 65 72 | 74 20 6d 61 78 62 69 74 |. Inser|t maxbit|
|00003260| 73 20 69 6e 74 6f 0a 20 | 2a 20 63 6f 6d 70 72 65 |s into. |* compre|
|00003270| 73 73 65 64 20 66 69 6c | 65 2e 20 20 46 6f 72 63 |ssed fil|e. Forc|
|00003280| 65 20 66 69 6c 65 20 62 | 65 69 6e 67 20 75 6e 63 |e file b|eing unc|
|00003290| 6f 6d 70 72 65 73 73 65 | 64 20 74 6f 20 65 6e 64 |ompresse|d to end|
|000032a0| 20 77 69 74 68 20 22 2e | 5a 22 2e 0a 20 2a 20 41 | with ".|Z".. * A|
|000032b0| 64 64 65 64 20 22 2d 63 | 22 20 66 6c 61 67 20 61 |dded "-c|" flag a|
|000032c0| 6e 64 20 22 7a 63 61 74 | 22 2e 20 20 50 72 65 70 |nd "zcat|". Prep|
|000032d0| 61 72 65 64 20 66 6f 72 | 20 72 65 6c 65 61 73 65 |ared for| release|
|000032e0| 2e 0a 20 2a 0a 20 2a 20 | 52 65 76 69 73 69 6f 6e |.. *. * |Revision|
|000032f0| 20 31 2e 31 30 20 20 38 | 34 2f 30 38 2f 32 34 20 | 1.10 8|4/08/24 |
|00003300| 20 31 38 3a 32 38 3a 30 | 30 20 20 74 75 72 74 6c | 18:28:0|0 turtl|
|00003310| 65 76 61 78 21 6b 65 6e | 0a 20 2a 20 57 69 6c 6c |evax!ken|. * Will|
|00003320| 20 6f 6e 6c 79 20 63 6f | 6d 70 72 65 73 73 20 72 | only co|mpress r|
|00003330| 65 67 75 6c 61 72 20 66 | 69 6c 65 73 20 28 6e 6f |egular f|iles (no|
|00003340| 20 64 69 72 65 63 74 6f | 72 69 65 73 29 2c 20 61 | directo|ries), a|
|00003350| 64 64 65 64 20 61 20 6d | 61 67 69 63 20 6e 75 6d |dded a m|agic num|
|00003360| 62 65 72 0a 20 2a 20 68 | 65 61 64 65 72 20 28 70 |ber. * h|eader (p|
|00003370| 6c 75 73 20 61 6e 20 75 | 6e 64 6f 63 75 6d 65 6e |lus an u|ndocumen|
|00003380| 74 65 64 20 2d 6e 20 66 | 6c 61 67 20 74 6f 20 68 |ted -n f|lag to h|
|00003390| 61 6e 64 6c 65 20 6f 6c | 64 20 66 69 6c 65 73 20 |andle ol|d files |
|000033a0| 77 69 74 68 6f 75 74 20 | 68 65 61 64 65 72 73 29 |without |headers)|
|000033b0| 2c 0a 20 2a 20 61 64 64 | 65 64 20 2d 66 20 66 6c |,. * add|ed -f fl|
|000033c0| 61 67 20 74 6f 20 66 6f | 72 63 65 20 6f 76 65 72 |ag to fo|rce over|
|000033d0| 77 72 69 74 69 6e 67 20 | 6f 66 20 70 6f 73 73 69 |writing |of possi|
|000033e0| 62 6c 79 20 65 78 69 73 | 74 69 6e 67 20 64 65 73 |bly exis|ting des|
|000033f0| 74 69 6e 61 74 69 6f 6e | 20 66 69 6c 65 2c 0a 20 |tination| file,. |
|00003400| 2a 20 6f 74 68 65 72 77 | 69 73 65 20 74 68 65 20 |* otherw|ise the |
|00003410| 75 73 65 72 20 69 73 20 | 70 72 6f 6d 70 74 65 64 |user is |prompted|
|00003420| 20 66 6f 72 20 61 20 72 | 65 73 70 6f 6e 73 65 2e | for a r|esponse.|
|00003430| 20 20 57 69 6c 6c 20 74 | 61 63 6b 20 6f 6e 20 61 | Will t|ack on a|
|00003440| 20 2e 5a 20 74 6f 20 61 | 0a 20 2a 20 66 69 6c 65 | .Z to a|. * file|
|00003450| 6e 61 6d 65 20 69 66 20 | 69 74 20 64 6f 65 73 6e |name if |it doesn|
|00003460| 27 74 20 68 61 76 65 20 | 6f 6e 65 20 77 68 65 6e |'t have |one when|
|00003470| 20 64 65 63 6f 6d 70 72 | 65 73 73 69 6e 67 2e 20 | decompr|essing. |
|00003480| 20 57 69 6c 6c 20 6f 6e | 6c 79 20 72 65 70 6c 61 | Will on|ly repla|
|00003490| 63 65 0a 20 2a 20 66 69 | 6c 65 20 69 66 20 69 74 |ce. * fi|le if it|
|000034a0| 20 77 61 73 20 63 6f 6d | 70 72 65 73 73 65 64 2e | was com|pressed.|
|000034b0| 0a 20 2a 0a 20 2a 20 52 | 65 76 69 73 69 6f 6e 20 |. *. * R|evision |
|000034c0| 31 2e 39 20 20 38 34 2f | 30 38 2f 31 36 20 20 31 |1.9 84/|08/16 1|
|000034d0| 37 3a 32 38 3a 30 30 20 | 20 74 75 72 74 6c 65 76 |7:28:00 | turtlev|
|000034e0| 61 78 21 6b 65 6e 0a 20 | 2a 20 52 65 6d 6f 76 65 |ax!ken. |* Remove|
|000034f0| 64 20 73 63 61 6e 61 72 | 67 73 28 29 2c 20 67 65 |d scanar|gs(), ge|
|00003500| 74 6f 70 74 28 29 2c 20 | 61 64 64 65 64 20 2e 5a |topt(), |added .Z|
|00003510| 20 65 78 74 65 6e 73 69 | 6f 6e 20 61 6e 64 20 75 | extensi|on and u|
|00003520| 6e 6c 69 6d 69 74 65 64 | 20 6e 75 6d 62 65 72 20 |nlimited| number |
|00003530| 6f 66 0a 20 2a 20 66 69 | 6c 65 6e 61 6d 65 73 20 |of. * fi|lenames |
|00003540| 74 6f 20 63 6f 6d 70 72 | 65 73 73 2e 20 20 46 6c |to compr|ess. Fl|
|00003550| 61 67 73 20 6d 61 79 20 | 62 65 20 63 6c 75 73 74 |ags may |be clust|
|00003560| 65 72 65 64 20 28 2d 44 | 64 76 62 31 32 29 20 6f |ered (-D|dvb12) o|
|00003570| 72 20 73 65 70 61 72 61 | 74 65 64 0a 20 2a 20 28 |r separa|ted. * (|
|00003580| 2d 44 20 2d 64 20 2d 76 | 20 2d 62 20 31 32 29 2c |-D -d -v| -b 12),|
|00003590| 20 6f 72 20 63 6f 6d 62 | 69 6e 61 74 69 6f 6e 20 | or comb|ination |
|000035a0| 74 68 65 72 65 6f 66 2e | 20 20 4d 6f 64 65 73 20 |thereof.| Modes |
|000035b0| 61 6e 64 20 6f 74 68 65 | 72 20 73 74 61 74 75 73 |and othe|r status|
|000035c0| 20 69 73 0a 20 2a 20 63 | 6f 70 69 65 64 20 77 69 | is. * c|opied wi|
|000035d0| 74 68 20 63 6f 70 79 73 | 74 61 74 28 29 2e 20 20 |th copys|tat(). |
|000035e0| 2d 4f 20 62 75 67 20 66 | 6f 72 20 34 2e 32 20 73 |-O bug f|or 4.2 s|
|000035f0| 65 65 6d 73 20 74 6f 20 | 68 61 76 65 20 64 69 73 |eems to |have dis|
|00003600| 61 70 70 65 61 72 65 64 | 20 77 69 74 68 0a 20 2a |appeared| with. *|
|00003610| 20 31 2e 38 2e 0a 20 2a | 0a 20 2a 20 52 65 76 69 | 1.8.. *|. * Revi|
|00003620| 73 69 6f 6e 20 31 2e 38 | 20 20 38 34 2f 30 38 2f |sion 1.8| 84/08/|
|00003630| 30 39 20 20 32 33 3a 31 | 35 3a 30 30 20 20 6a 6f |09 23:1|5:00 jo|
|00003640| 65 0a 20 2a 20 4d 61 64 | 65 20 69 74 20 63 6f 6d |e. * Mad|e it com|
|00003650| 70 61 74 69 62 6c 65 20 | 77 69 74 68 20 76 61 78 |patible |with vax|
|00003660| 20 76 65 72 73 69 6f 6e | 2c 20 69 6e 73 74 61 6c | version|, instal|
|00003670| 6c 65 64 20 6a 69 6d 27 | 73 20 66 69 78 65 73 2f |led jim'|s fixes/|
|00003680| 65 6e 68 61 6e 63 65 6d | 65 6e 74 73 0a 20 2a 0a |enhancem|ents. *.|
|00003690| 20 2a 20 52 65 76 69 73 | 69 6f 6e 20 31 2e 36 20 | * Revis|ion 1.6 |
|000036a0| 20 38 34 2f 30 38 2f 30 | 31 20 20 32 32 3a 30 38 | 84/08/0|1 22:08|
|000036b0| 3a 30 30 20 20 6a 6f 65 | 0a 20 2a 20 53 70 65 64 |:00 joe|. * Sped|
|000036c0| 20 75 70 20 61 6c 67 6f | 72 69 74 68 6d 20 73 69 | up algo|rithm si|
|000036d0| 67 6e 69 66 69 63 61 6e | 74 6c 79 20 62 79 20 73 |gnifican|tly by s|
|000036e0| 6f 72 74 69 6e 67 20 74 | 68 65 20 63 6f 6d 70 72 |orting t|he compr|
|000036f0| 65 73 73 20 63 68 61 69 | 6e 2e 0a 20 2a 0a 20 2a |ess chai|n.. *. *|
|00003700| 20 52 65 76 69 73 69 6f | 6e 20 31 2e 35 20 20 38 | Revisio|n 1.5 8|
|00003710| 34 2f 30 37 2f 31 33 20 | 20 31 33 3a 31 31 3a 30 |4/07/13 | 13:11:0|
|00003720| 30 20 20 73 72 64 0a 20 | 2a 20 41 64 64 65 64 20 |0 srd. |* Added |
|00003730| 43 20 76 65 72 73 69 6f | 6e 20 6f 66 20 76 61 78 |C versio|n of vax|
|00003740| 20 61 73 6d 20 72 6f 75 | 74 69 6e 65 73 2e 20 20 | asm rou|tines. |
|00003750| 43 68 61 6e 67 65 64 20 | 73 74 72 75 63 74 75 72 |Changed |structur|
|00003760| 65 20 74 6f 20 61 72 72 | 61 79 73 20 74 6f 0a 20 |e to arr|ays to. |
|00003770| 2a 20 73 61 76 65 20 6d | 75 63 68 20 6d 65 6d 6f |* save m|uch memo|
|00003780| 72 79 2e 20 20 44 6f 20 | 75 6e 73 69 67 6e 65 64 |ry. Do |unsigned|
|00003790| 20 63 6f 6d 70 61 72 65 | 73 20 77 68 65 72 65 20 | compare|s where |
|000037a0| 70 6f 73 73 69 62 6c 65 | 20 28 66 61 73 74 65 72 |possible| (faster|
|000037b0| 20 6f 6e 0a 20 2a 20 50 | 65 72 6b 69 6e 2d 45 6c | on. * P|erkin-El|
|000037c0| 6d 65 72 29 0a 20 2a 0a | 20 2a 20 52 65 76 69 73 |mer). *.| * Revis|
|000037d0| 69 6f 6e 20 31 2e 34 20 | 20 38 34 2f 30 37 2f 30 |ion 1.4 | 84/07/0|
|000037e0| 35 20 20 30 33 3a 31 31 | 3a 31 31 20 20 74 68 6f |5 03:11|:11 tho|
|000037f0| 6d 61 73 0a 20 2a 20 43 | 6c 65 61 6e 20 75 70 20 |mas. * C|lean up |
|00003800| 74 68 65 20 63 6f 64 65 | 20 61 20 6c 69 74 74 6c |the code| a littl|
|00003810| 65 20 61 6e 64 20 6c 69 | 6e 74 20 69 74 2e 20 20 |e and li|nt it. |
|00003820| 28 4c 69 6e 74 20 63 6f | 6d 70 6c 61 69 6e 73 20 |(Lint co|mplains |
|00003830| 61 62 6f 75 74 20 61 6c | 6c 0a 20 2a 20 74 68 65 |about al|l. * the|
|00003840| 20 72 65 67 73 20 75 73 | 65 64 20 69 6e 20 74 68 | regs us|ed in th|
|00003850| 65 20 61 73 6d 2c 20 62 | 75 74 20 49 27 6d 20 6e |e asm, b|ut I'm n|
|00003860| 6f 74 20 67 6f 69 6e 67 | 20 74 6f 20 22 66 69 78 |ot going| to "fix|
|00003870| 22 20 74 68 69 73 2e 29 | 0a 20 2a 0a 20 2a 20 52 |" this.)|. *. * R|
|00003880| 65 76 69 73 69 6f 6e 20 | 31 2e 33 20 20 38 34 2f |evision |1.3 84/|
|00003890| 30 37 2f 30 35 20 20 30 | 32 3a 30 36 3a 35 34 20 |07/05 0|2:06:54 |
|000038a0| 20 74 68 6f 6d 61 73 0a | 20 2a 20 4d 69 6e 6f 72 | thomas.| * Minor|
|000038b0| 20 66 69 78 65 73 2e 0a | 20 2a 0a 20 2a 20 52 65 | fixes..| *. * Re|
|000038c0| 76 69 73 69 6f 6e 20 31 | 2e 32 20 20 38 34 2f 30 |vision 1|.2 84/0|
|000038d0| 37 2f 30 35 20 20 30 30 | 3a 32 37 3a 32 37 20 20 |7/05 00|:27:27 |
|000038e0| 74 68 6f 6d 61 73 0a 20 | 2a 20 41 64 64 20 76 61 |thomas. |* Add va|
|000038f0| 72 69 61 62 6c 65 20 62 | 69 74 20 6c 65 6e 67 74 |riable b|it lengt|
|00003900| 68 20 6f 75 74 70 75 74 | 2e 0a 20 2a 0a 20 2a 2f |h output|.. *. */|
|00003910| 0a 73 74 61 74 69 63 20 | 63 68 61 72 20 72 63 73 |.static |char rcs|
|00003920| 5f 69 64 65 6e 74 5b 5d | 20 3d 20 22 24 48 65 61 |_ident[]| = "$Hea|
|00003930| 64 65 72 3a 20 63 6f 6d | 70 72 65 73 73 2e 63 2c |der: com|press.c,|
|00003940| 76 20 34 2e 30 20 38 35 | 2f 30 37 2f 33 30 20 31 |v 4.0 85|/07/30 1|
|00003950| 32 3a 35 30 3a 30 30 20 | 6a 6f 65 20 52 65 6c 65 |2:50:00 |joe Rele|
|00003960| 61 73 65 20 24 22 3b 0a | 0a 23 69 6e 63 6c 75 64 |ase $";.|.#includ|
|00003970| 65 20 3c 73 74 64 69 6f | 2e 68 3e 0a 23 69 6e 63 |e <stdio|.h>.#inc|
|00003980| 6c 75 64 65 20 3c 63 74 | 79 70 65 2e 68 3e 0a 23 |lude <ct|ype.h>.#|
|00003990| 69 6e 63 6c 75 64 65 20 | 3c 73 69 67 6e 61 6c 2e |include |<signal.|
|000039a0| 68 3e 0a 23 69 6e 63 6c | 75 64 65 20 3c 73 79 73 |h>.#incl|ude <sys|
|000039b0| 2f 74 79 70 65 73 2e 68 | 3e 0a 23 69 6e 63 6c 75 |/types.h|>.#inclu|
|000039c0| 64 65 20 3c 73 79 73 2f | 73 74 61 74 2e 68 3e 0a |de <sys/|stat.h>.|
|000039d0| 0a 23 64 65 66 69 6e 65 | 20 41 52 47 56 41 4c 28 |.#define| ARGVAL(|
|000039e0| 29 20 28 2a 2b 2b 28 2a | 61 72 67 76 29 20 7c 7c |) (*++(*|argv) |||
|000039f0| 20 28 2d 2d 61 72 67 63 | 20 26 26 20 2a 2b 2b 61 | (--argc| && *++a|
|00003a00| 72 67 76 29 29 0a 0a 69 | 6e 74 20 6e 5f 62 69 74 |rgv))..i|nt n_bit|
|00003a10| 73 3b 09 09 09 09 2f 2a | 20 6e 75 6d 62 65 72 20 |s;..../*| number |
|00003a20| 6f 66 20 62 69 74 73 2f | 63 6f 64 65 20 2a 2f 0a |of bits/|code */.|
|00003a30| 69 6e 74 20 6d 61 78 62 | 69 74 73 20 3d 20 42 49 |int maxb|its = BI|
|00003a40| 54 53 3b 09 09 09 2f 2a | 20 75 73 65 72 20 73 65 |TS;.../*| user se|
|00003a50| 74 74 61 62 6c 65 20 6d | 61 78 20 23 20 62 69 74 |ttable m|ax # bit|
|00003a60| 73 2f 63 6f 64 65 20 2a | 2f 0a 63 6f 64 65 5f 69 |s/code *|/.code_i|
|00003a70| 6e 74 20 6d 61 78 63 6f | 64 65 3b 09 09 09 2f 2a |nt maxco|de;.../*|
|00003a80| 20 6d 61 78 69 6d 75 6d | 20 63 6f 64 65 2c 20 67 | maximum| code, g|
|00003a90| 69 76 65 6e 20 6e 5f 62 | 69 74 73 20 2a 2f 0a 63 |iven n_b|its */.c|
|00003aa0| 6f 64 65 5f 69 6e 74 20 | 6d 61 78 6d 61 78 63 6f |ode_int |maxmaxco|
|00003ab0| 64 65 20 3d 20 31 20 3c | 3c 20 42 49 54 53 3b 09 |de = 1 <|< BITS;.|
|00003ac0| 2f 2a 20 73 68 6f 75 6c | 64 20 4e 45 56 45 52 20 |/* shoul|d NEVER |
|00003ad0| 67 65 6e 65 72 61 74 65 | 20 74 68 69 73 20 63 6f |generate| this co|
|00003ae0| 64 65 20 2a 2f 0a 23 69 | 66 64 65 66 20 43 4f 4d |de */.#i|fdef COM|
|00003af0| 50 41 54 49 42 4c 45 09 | 09 2f 2a 20 42 75 74 20 |PATIBLE.|./* But |
|00003b00| 77 72 6f 6e 67 21 20 2a | 2f 0a 23 20 64 65 66 69 |wrong! *|/.# defi|
|00003b10| 6e 65 20 4d 41 58 43 4f | 44 45 28 6e 5f 62 69 74 |ne MAXCO|DE(n_bit|
|00003b20| 73 29 09 28 31 20 3c 3c | 20 28 6e 5f 62 69 74 73 |s).(1 <<| (n_bits|
|00003b30| 29 20 2d 20 31 29 0a 23 | 65 6c 73 65 0a 23 20 64 |) - 1).#|else.# d|
|00003b40| 65 66 69 6e 65 20 4d 41 | 58 43 4f 44 45 28 6e 5f |efine MA|XCODE(n_|
|00003b50| 62 69 74 73 29 09 28 28 | 31 20 3c 3c 20 28 6e 5f |bits).((|1 << (n_|
|00003b60| 62 69 74 73 29 29 20 2d | 20 31 29 0a 23 65 6e 64 |bits)) -| 1).#end|
|00003b70| 69 66 20 2f 2a 20 43 4f | 4d 50 41 54 49 42 4c 45 |if /* CO|MPATIBLE|
|00003b80| 20 2a 2f 0a 0a 23 69 66 | 64 65 66 20 58 45 4e 49 | */..#if|def XENI|
|00003b90| 58 5f 31 36 0a 63 6f 75 | 6e 74 5f 69 6e 74 20 68 |X_16.cou|nt_int h|
|00003ba0| 74 61 62 30 5b 38 31 39 | 32 5d 3b 0a 63 6f 75 6e |tab0[819|2];.coun|
|00003bb0| 74 5f 69 6e 74 20 68 74 | 61 62 31 5b 38 31 39 32 |t_int ht|ab1[8192|
|00003bc0| 5d 3b 0a 63 6f 75 6e 74 | 5f 69 6e 74 20 68 74 61 |];.count|_int hta|
|00003bd0| 62 32 5b 38 31 39 32 5d | 3b 0a 63 6f 75 6e 74 5f |b2[8192]|;.count_|
|00003be0| 69 6e 74 20 68 74 61 62 | 33 5b 38 31 39 32 5d 3b |int htab|3[8192];|
|00003bf0| 0a 63 6f 75 6e 74 5f 69 | 6e 74 20 68 74 61 62 34 |.count_i|nt htab4|
|00003c00| 5b 38 31 39 32 5d 3b 0a | 63 6f 75 6e 74 5f 69 6e |[8192];.|count_in|
|00003c10| 74 20 68 74 61 62 35 5b | 38 31 39 32 5d 3b 0a 63 |t htab5[|8192];.c|
|00003c20| 6f 75 6e 74 5f 69 6e 74 | 20 68 74 61 62 36 5b 38 |ount_int| htab6[8|
|00003c30| 31 39 32 5d 3b 0a 63 6f | 75 6e 74 5f 69 6e 74 20 |192];.co|unt_int |
|00003c40| 68 74 61 62 37 5b 38 31 | 39 32 5d 3b 0a 63 6f 75 |htab7[81|92];.cou|
|00003c50| 6e 74 5f 69 6e 74 20 68 | 74 61 62 38 5b 48 53 49 |nt_int h|tab8[HSI|
|00003c60| 5a 45 2d 36 35 35 33 36 | 5d 3b 0a 63 6f 75 6e 74 |ZE-65536|];.count|
|00003c70| 5f 69 6e 74 20 2a 20 68 | 74 61 62 5b 39 5d 20 3d |_int * h|tab[9] =|
|00003c80| 20 7b 0a 09 68 74 61 62 | 30 2c 20 68 74 61 62 31 | {..htab|0, htab1|
|00003c90| 2c 20 68 74 61 62 32 2c | 20 68 74 61 62 33 2c 20 |, htab2,| htab3, |
|00003ca0| 68 74 61 62 34 2c 20 68 | 74 61 62 35 2c 20 68 74 |htab4, h|tab5, ht|
|00003cb0| 61 62 36 2c 20 68 74 61 | 62 37 2c 20 68 74 61 62 |ab6, hta|b7, htab|
|00003cc0| 38 20 7d 3b 0a 0a 23 64 | 65 66 69 6e 65 20 68 74 |8 };..#d|efine ht|
|00003cd0| 61 62 6f 66 28 69 29 09 | 28 68 74 61 62 5b 28 69 |abof(i).|(htab[(i|
|00003ce0| 29 20 3e 3e 20 31 33 5d | 5b 28 69 29 20 26 20 30 |) >> 13]|[(i) & 0|
|00003cf0| 78 31 66 66 66 5d 29 0a | 75 6e 73 69 67 6e 65 64 |x1fff]).|unsigned|
|00003d00| 20 73 68 6f 72 74 20 63 | 6f 64 65 30 74 61 62 5b | short c|ode0tab[|
|00003d10| 31 36 33 38 34 5d 3b 0a | 75 6e 73 69 67 6e 65 64 |16384];.|unsigned|
|00003d20| 20 73 68 6f 72 74 20 63 | 6f 64 65 31 74 61 62 5b | short c|ode1tab[|
|00003d30| 31 36 33 38 34 5d 3b 0a | 75 6e 73 69 67 6e 65 64 |16384];.|unsigned|
|00003d40| 20 73 68 6f 72 74 20 63 | 6f 64 65 32 74 61 62 5b | short c|ode2tab[|
|00003d50| 31 36 33 38 34 5d 3b 0a | 75 6e 73 69 67 6e 65 64 |16384];.|unsigned|
|00003d60| 20 73 68 6f 72 74 20 63 | 6f 64 65 33 74 61 62 5b | short c|ode3tab[|
|00003d70| 31 36 33 38 34 5d 3b 0a | 75 6e 73 69 67 6e 65 64 |16384];.|unsigned|
|00003d80| 20 73 68 6f 72 74 20 63 | 6f 64 65 34 74 61 62 5b | short c|ode4tab[|
|00003d90| 31 36 33 38 34 5d 3b 0a | 75 6e 73 69 67 6e 65 64 |16384];.|unsigned|
|00003da0| 20 73 68 6f 72 74 20 2a | 20 63 6f 64 65 74 61 62 | short *| codetab|
|00003db0| 5b 35 5d 20 3d 20 7b 0a | 09 63 6f 64 65 30 74 61 |[5] = {.|.code0ta|
|00003dc0| 62 2c 20 63 6f 64 65 31 | 74 61 62 2c 20 63 6f 64 |b, code1|tab, cod|
|00003dd0| 65 32 74 61 62 2c 20 63 | 6f 64 65 33 74 61 62 2c |e2tab, c|ode3tab,|
|00003de0| 20 63 6f 64 65 34 74 61 | 62 20 7d 3b 0a 0a 23 64 | code4ta|b };..#d|
|00003df0| 65 66 69 6e 65 20 63 6f | 64 65 74 61 62 6f 66 28 |efine co|detabof(|
|00003e00| 69 29 09 28 63 6f 64 65 | 74 61 62 5b 28 69 29 20 |i).(code|tab[(i) |
|00003e10| 3e 3e 20 31 34 5d 5b 28 | 69 29 20 26 20 30 78 33 |>> 14][(|i) & 0x3|
|00003e20| 66 66 66 5d 29 0a 0a 23 | 65 6c 73 65 09 2f 2a 20 |fff])..#|else./* |
|00003e30| 4e 6f 72 6d 61 6c 20 6d | 61 63 68 69 6e 65 20 2a |Normal m|achine *|
|00003e40| 2f 0a 63 6f 75 6e 74 5f | 69 6e 74 20 68 74 61 62 |/.count_|int htab|
|00003e50| 20 5b 48 53 49 5a 45 5d | 3b 0a 75 6e 73 69 67 6e | [HSIZE]|;.unsign|
|00003e60| 65 64 20 73 68 6f 72 74 | 20 63 6f 64 65 74 61 62 |ed short| codetab|
|00003e70| 20 5b 48 53 49 5a 45 5d | 3b 0a 23 64 65 66 69 6e | [HSIZE]|;.#defin|
|00003e80| 65 20 68 74 61 62 6f 66 | 28 69 29 09 68 74 61 62 |e htabof|(i).htab|
|00003e90| 5b 69 5d 0a 23 64 65 66 | 69 6e 65 20 63 6f 64 65 |[i].#def|ine code|
|00003ea0| 74 61 62 6f 66 28 69 29 | 09 63 6f 64 65 74 61 62 |tabof(i)|.codetab|
|00003eb0| 5b 69 5d 0a 23 65 6e 64 | 69 66 09 2f 2a 20 58 45 |[i].#end|if./* XE|
|00003ec0| 4e 49 58 5f 31 36 20 2a | 2f 0a 63 6f 64 65 5f 69 |NIX_16 *|/.code_i|
|00003ed0| 6e 74 20 68 73 69 7a 65 | 20 3d 20 48 53 49 5a 45 |nt hsize| = HSIZE|
|00003ee0| 3b 09 09 09 2f 2a 20 66 | 6f 72 20 64 79 6e 61 6d |;.../* f|or dynam|
|00003ef0| 69 63 20 74 61 62 6c 65 | 20 73 69 7a 69 6e 67 20 |ic table| sizing |
|00003f00| 2a 2f 0a 63 6f 75 6e 74 | 5f 69 6e 74 20 66 73 69 |*/.count|_int fsi|
|00003f10| 7a 65 3b 0a 0a 2f 2a 0a | 20 2a 20 54 6f 20 73 61 |ze;../*.| * To sa|
|00003f20| 76 65 20 6d 75 63 68 20 | 6d 65 6d 6f 72 79 2c 20 |ve much |memory, |
|00003f30| 77 65 20 6f 76 65 72 6c | 61 79 20 74 68 65 20 74 |we overl|ay the t|
|00003f40| 61 62 6c 65 20 75 73 65 | 64 20 62 79 20 63 6f 6d |able use|d by com|
|00003f50| 70 72 65 73 73 28 29 20 | 77 69 74 68 20 74 68 6f |press() |with tho|
|00003f60| 73 65 0a 20 2a 20 75 73 | 65 64 20 62 79 20 64 65 |se. * us|ed by de|
|00003f70| 63 6f 6d 70 72 65 73 73 | 28 29 2e 20 20 54 68 65 |compress|(). The|
|00003f80| 20 74 61 62 5f 70 72 65 | 66 69 78 20 74 61 62 6c | tab_pre|fix tabl|
|00003f90| 65 20 69 73 20 74 68 65 | 20 73 61 6d 65 20 73 69 |e is the| same si|
|00003fa0| 7a 65 20 61 6e 64 20 74 | 79 70 65 0a 20 2a 20 61 |ze and t|ype. * a|
|00003fb0| 73 20 74 68 65 20 63 6f | 64 65 74 61 62 2e 20 20 |s the co|detab. |
|00003fc0| 54 68 65 20 74 61 62 5f | 73 75 66 66 69 78 20 74 |The tab_|suffix t|
|00003fd0| 61 62 6c 65 20 6e 65 65 | 64 73 20 32 2a 2a 42 49 |able nee|ds 2**BI|
|00003fe0| 54 53 20 63 68 61 72 61 | 63 74 65 72 73 2e 20 20 |TS chara|cters. |
|00003ff0| 57 65 0a 20 2a 20 67 65 | 74 20 74 68 69 73 20 66 |We. * ge|t this f|
|00004000| 72 6f 6d 20 74 68 65 20 | 62 65 67 69 6e 6e 69 6e |rom the |beginnin|
|00004010| 67 20 6f 66 20 68 74 61 | 62 2e 20 20 54 68 65 20 |g of hta|b. The |
|00004020| 6f 75 74 70 75 74 20 73 | 74 61 63 6b 20 75 73 65 |output s|tack use|
|00004030| 73 20 74 68 65 20 72 65 | 73 74 0a 20 2a 20 6f 66 |s the re|st. * of|
|00004040| 20 68 74 61 62 2c 20 61 | 6e 64 20 63 6f 6e 74 61 | htab, a|nd conta|
|00004050| 69 6e 73 20 63 68 61 72 | 61 63 74 65 72 73 2e 20 |ins char|acters. |
|00004060| 20 54 68 65 72 65 20 69 | 73 20 70 6c 65 6e 74 79 | There i|s plenty|
|00004070| 20 6f 66 20 72 6f 6f 6d | 20 66 6f 72 20 61 6e 79 | of room| for any|
|00004080| 0a 20 2a 20 70 6f 73 73 | 69 62 6c 65 20 73 74 61 |. * poss|ible sta|
|00004090| 63 6b 20 28 73 74 61 63 | 6b 20 75 73 65 64 20 74 |ck (stac|k used t|
|000040a0| 6f 20 62 65 20 38 30 30 | 30 20 63 68 61 72 61 63 |o be 800|0 charac|
|000040b0| 74 65 72 73 29 2e 0a 20 | 2a 2f 0a 0a 23 64 65 66 |ters).. |*/..#def|
|000040c0| 69 6e 65 20 74 61 62 5f | 70 72 65 66 69 78 6f 66 |ine tab_|prefixof|
|000040d0| 28 69 29 09 63 6f 64 65 | 74 61 62 6f 66 28 69 29 |(i).code|tabof(i)|
|000040e0| 0a 23 69 66 64 65 66 20 | 58 45 4e 49 58 5f 31 36 |.#ifdef |XENIX_16|
|000040f0| 0a 23 20 64 65 66 69 6e | 65 20 74 61 62 5f 73 75 |.# defin|e tab_su|
|00004100| 66 66 69 78 6f 66 28 69 | 29 09 28 28 63 68 61 72 |ffixof(i|).((char|
|00004110| 5f 74 79 70 65 20 2a 29 | 68 74 61 62 5b 28 69 29 |_type *)|htab[(i)|
|00004120| 3e 3e 31 35 5d 29 5b 28 | 69 29 20 26 20 30 78 37 |>>15])[(|i) & 0x7|
|00004130| 66 66 66 5d 0a 23 20 64 | 65 66 69 6e 65 20 64 65 |fff].# d|efine de|
|00004140| 5f 73 74 61 63 6b 09 09 | 28 28 63 68 61 72 5f 74 |_stack..|((char_t|
|00004150| 79 70 65 20 2a 29 28 68 | 74 61 62 32 29 29 0a 23 |ype *)(h|tab2)).#|
|00004160| 65 6c 73 65 09 2f 2a 20 | 4e 6f 72 6d 61 6c 20 6d |else./* |Normal m|
|00004170| 61 63 68 69 6e 65 20 2a | 2f 0a 23 20 64 65 66 69 |achine *|/.# defi|
|00004180| 6e 65 20 74 61 62 5f 73 | 75 66 66 69 78 6f 66 28 |ne tab_s|uffixof(|
|00004190| 69 29 09 28 28 63 68 61 | 72 5f 74 79 70 65 20 2a |i).((cha|r_type *|
|000041a0| 29 28 68 74 61 62 29 29 | 5b 69 5d 0a 23 20 64 65 |)(htab))|[i].# de|
|000041b0| 66 69 6e 65 20 64 65 5f | 73 74 61 63 6b 09 09 28 |fine de_|stack..(|
|000041c0| 28 63 68 61 72 5f 74 79 | 70 65 20 2a 29 26 74 61 |(char_ty|pe *)&ta|
|000041d0| 62 5f 73 75 66 66 69 78 | 6f 66 28 31 3c 3c 42 49 |b_suffix|of(1<<BI|
|000041e0| 54 53 29 29 0a 23 65 6e | 64 69 66 09 2f 2a 20 58 |TS)).#en|dif./* X|
|000041f0| 45 4e 49 58 5f 31 36 20 | 2a 2f 0a 0a 63 6f 64 65 |ENIX_16 |*/..code|
|00004200| 5f 69 6e 74 20 66 72 65 | 65 5f 65 6e 74 20 3d 20 |_int fre|e_ent = |
|00004210| 30 3b 09 09 09 2f 2a 20 | 66 69 72 73 74 20 75 6e |0;.../* |first un|
|00004220| 75 73 65 64 20 65 6e 74 | 72 79 20 2a 2f 0a 69 6e |used ent|ry */.in|
|00004230| 74 20 65 78 69 74 5f 73 | 74 61 74 20 3d 20 30 3b |t exit_s|tat = 0;|
|00004240| 0a 0a 63 6f 64 65 5f 69 | 6e 74 20 67 65 74 63 6f |..code_i|nt getco|
|00004250| 64 65 28 29 3b 0a 0a 55 | 73 61 67 65 28 29 20 7b |de();..U|sage() {|
|00004260| 0a 23 69 66 64 65 66 20 | 44 45 42 55 47 0a 66 70 |.#ifdef |DEBUG.fp|
|00004270| 72 69 6e 74 66 28 73 74 | 64 65 72 72 2c 22 55 73 |rintf(st|derr,"Us|
|00004280| 61 67 65 3a 20 63 6f 6d | 70 72 65 73 73 20 5b 2d |age: com|press [-|
|00004290| 64 44 56 66 63 5d 20 5b | 2d 62 20 6d 61 78 62 69 |dDVfc] [|-b maxbi|
|000042a0| 74 73 5d 20 5b 66 69 6c | 65 20 2e 2e 2e 5d 5c 6e |ts] [fil|e ...]\n|
|000042b0| 22 29 3b 0a 7d 0a 69 6e | 74 20 64 65 62 75 67 20 |");.}.in|t debug |
|000042c0| 3d 20 30 3b 0a 23 65 6c | 73 65 0a 66 70 72 69 6e |= 0;.#el|se.fprin|
|000042d0| 74 66 28 73 74 64 65 72 | 72 2c 22 55 73 61 67 65 |tf(stder|r,"Usage|
|000042e0| 3a 20 63 6f 6d 70 72 65 | 73 73 20 5b 2d 64 66 76 |: compre|ss [-dfv|
|000042f0| 63 56 5d 20 5b 2d 62 20 | 6d 61 78 62 69 74 73 5d |cV] [-b |maxbits]|
|00004300| 20 5b 66 69 6c 65 20 2e | 2e 2e 5d 5c 6e 22 29 3b | [file .|..]\n");|
|00004310| 0a 7d 0a 23 65 6e 64 69 | 66 20 2f 2a 20 44 45 42 |.}.#endi|f /* DEB|
|00004320| 55 47 20 2a 2f 0a 69 6e | 74 20 6e 6f 6d 61 67 69 |UG */.in|t nomagi|
|00004330| 63 20 3d 20 30 3b 09 2f | 2a 20 55 73 65 20 61 20 |c = 0;./|* Use a |
|00004340| 33 2d 62 79 74 65 20 6d | 61 67 69 63 20 6e 75 6d |3-byte m|agic num|
|00004350| 62 65 72 20 68 65 61 64 | 65 72 2c 20 75 6e 6c 65 |ber head|er, unle|
|00004360| 73 73 20 6f 6c 64 20 66 | 69 6c 65 20 2a 2f 0a 69 |ss old f|ile */.i|
|00004370| 6e 74 20 7a 63 61 74 5f | 66 6c 67 20 3d 20 30 3b |nt zcat_|flg = 0;|
|00004380| 09 2f 2a 20 57 72 69 74 | 65 20 6f 75 74 70 75 74 |./* Writ|e output|
|00004390| 20 6f 6e 20 73 74 64 6f | 75 74 2c 20 73 75 70 70 | on stdo|ut, supp|
|000043a0| 72 65 73 73 20 6d 65 73 | 73 61 67 65 73 20 2a 2f |ress mes|sages */|
|000043b0| 0a 69 6e 74 20 71 75 69 | 65 74 20 3d 20 31 3b 09 |.int qui|et = 1;.|
|000043c0| 09 2f 2a 20 64 6f 6e 27 | 74 20 74 65 6c 6c 20 6d |./* don'|t tell m|
|000043d0| 65 20 61 62 6f 75 74 20 | 63 6f 6d 70 72 65 73 73 |e about |compress|
|000043e0| 69 6f 6e 20 2a 2f 0a 0a | 2f 2a 0a 20 2a 20 62 6c |ion */..|/*. * bl|
|000043f0| 6f 63 6b 20 63 6f 6d 70 | 72 65 73 73 69 6f 6e 20 |ock comp|ression |
|00004400| 70 61 72 61 6d 65 74 65 | 72 73 20 2d 2d 20 61 66 |paramete|rs -- af|
|00004410| 74 65 72 20 61 6c 6c 20 | 63 6f 64 65 73 20 61 72 |ter all |codes ar|
|00004420| 65 20 75 73 65 64 20 75 | 70 2c 0a 20 2a 20 61 6e |e used u|p,. * an|
|00004430| 64 20 63 6f 6d 70 72 65 | 73 73 69 6f 6e 20 72 61 |d compre|ssion ra|
|00004440| 74 65 20 63 68 61 6e 67 | 65 73 2c 20 73 74 61 72 |te chang|es, star|
|00004450| 74 20 6f 76 65 72 2e 0a | 20 2a 2f 0a 69 6e 74 20 |t over..| */.int |
|00004460| 62 6c 6f 63 6b 5f 63 6f | 6d 70 72 65 73 73 20 3d |block_co|mpress =|
|00004470| 20 42 4c 4f 43 4b 5f 4d | 41 53 4b 3b 0a 69 6e 74 | BLOCK_M|ASK;.int|
|00004480| 20 63 6c 65 61 72 5f 66 | 6c 67 20 3d 20 30 3b 0a | clear_f|lg = 0;.|
|00004490| 6c 6f 6e 67 20 69 6e 74 | 20 72 61 74 69 6f 20 3d |long int| ratio =|
|000044a0| 20 30 3b 0a 23 64 65 66 | 69 6e 65 20 43 48 45 43 | 0;.#def|ine CHEC|
|000044b0| 4b 5f 47 41 50 20 31 30 | 30 30 30 09 2f 2a 20 72 |K_GAP 10|000./* r|
|000044c0| 61 74 69 6f 20 63 68 65 | 63 6b 20 69 6e 74 65 72 |atio che|ck inter|
|000044d0| 76 61 6c 20 2a 2f 0a 63 | 6f 75 6e 74 5f 69 6e 74 |val */.c|ount_int|
|000044e0| 20 63 68 65 63 6b 70 6f | 69 6e 74 20 3d 20 43 48 | checkpo|int = CH|
|000044f0| 45 43 4b 5f 47 41 50 3b | 0a 2f 2a 0a 20 2a 20 74 |ECK_GAP;|./*. * t|
|00004500| 68 65 20 6e 65 78 74 20 | 74 77 6f 20 63 6f 64 65 |he next |two code|
|00004510| 73 20 73 68 6f 75 6c 64 | 20 6e 6f 74 20 62 65 20 |s should| not be |
|00004520| 63 68 61 6e 67 65 64 20 | 6c 69 67 68 74 6c 79 2c |changed |lightly,|
|00004530| 20 61 73 20 74 68 65 79 | 20 6d 75 73 74 20 6e 6f | as they| must no|
|00004540| 74 0a 20 2a 20 6c 69 65 | 20 77 69 74 68 69 6e 20 |t. * lie| within |
|00004550| 74 68 65 20 63 6f 6e 74 | 69 67 75 6f 75 73 20 67 |the cont|iguous g|
|00004560| 65 6e 65 72 61 6c 20 63 | 6f 64 65 20 73 70 61 63 |eneral c|ode spac|
|00004570| 65 2e 0a 20 2a 2f 20 0a | 23 64 65 66 69 6e 65 20 |e.. */ .|#define |
|00004580| 46 49 52 53 54 09 32 35 | 37 09 2f 2a 20 66 69 72 |FIRST.25|7./* fir|
|00004590| 73 74 20 66 72 65 65 20 | 65 6e 74 72 79 20 2a 2f |st free |entry */|
|000045a0| 0a 23 64 65 66 69 6e 65 | 09 43 4c 45 41 52 09 32 |.#define|.CLEAR.2|
|000045b0| 35 36 09 2f 2a 20 74 61 | 62 6c 65 20 63 6c 65 61 |56./* ta|ble clea|
|000045c0| 72 20 6f 75 74 70 75 74 | 20 63 6f 64 65 20 2a 2f |r output| code */|
|000045d0| 0a 0a 69 6e 74 20 66 6f | 72 63 65 20 3d 20 30 3b |..int fo|rce = 0;|
|000045e0| 0a 63 68 61 72 20 6f 66 | 6e 61 6d 65 20 5b 31 30 |.char of|name [10|
|000045f0| 30 5d 3b 0a 23 69 66 64 | 65 66 20 44 45 42 55 47 |0];.#ifd|ef DEBUG|
|00004600| 0a 69 6e 74 20 76 65 72 | 62 6f 73 65 20 3d 20 30 |.int ver|bose = 0|
|00004610| 3b 0a 23 65 6e 64 69 66 | 20 2f 2a 20 44 45 42 55 |;.#endif| /* DEBU|
|00004620| 47 20 2a 2f 0a 69 6e 74 | 20 28 2a 62 67 6e 64 5f |G */.int| (*bgnd_|
|00004630| 66 6c 61 67 29 28 29 3b | 0a 0a 69 6e 74 20 64 6f |flag)();|..int do|
|00004640| 5f 64 65 63 6f 6d 70 20 | 3d 20 30 3b 0a 0a 2f 2a |_decomp |= 0;../*|
|00004650| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004660| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004670| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004680| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004690| 0a 20 2a 20 54 41 47 28 | 20 6d 61 69 6e 20 29 0a |. * TAG(| main ).|
|000046a0| 20 2a 0a 20 2a 20 41 6c | 67 6f 72 69 74 68 6d 20 | *. * Al|gorithm |
|000046b0| 66 72 6f 6d 20 22 41 20 | 54 65 63 68 6e 69 71 75 |from "A |Techniqu|
|000046c0| 65 20 66 6f 72 20 48 69 | 67 68 20 50 65 72 66 6f |e for Hi|gh Perfo|
|000046d0| 72 6d 61 6e 63 65 20 44 | 61 74 61 20 43 6f 6d 70 |rmance D|ata Comp|
|000046e0| 72 65 73 73 69 6f 6e 22 | 2c 0a 20 2a 20 54 65 72 |ression"|,. * Ter|
|000046f0| 72 79 20 41 2e 20 57 65 | 6c 63 68 2c 20 49 45 45 |ry A. We|lch, IEE|
|00004700| 45 20 43 6f 6d 70 75 74 | 65 72 20 56 6f 6c 20 31 |E Comput|er Vol 1|
|00004710| 37 2c 20 4e 6f 20 36 20 | 28 4a 75 6e 65 20 31 39 |7, No 6 |(June 19|
|00004720| 38 34 29 2c 20 70 70 20 | 38 2d 31 39 2e 0a 20 2a |84), pp |8-19.. *|
|00004730| 0a 20 2a 20 55 73 61 67 | 65 3a 20 63 6f 6d 70 72 |. * Usag|e: compr|
|00004740| 65 73 73 20 5b 2d 64 66 | 76 63 5d 20 5b 2d 62 20 |ess [-df|vc] [-b |
|00004750| 62 69 74 73 5d 20 5b 66 | 69 6c 65 20 2e 2e 2e 5d |bits] [f|ile ...]|
|00004760| 0a 20 2a 20 49 6e 70 75 | 74 73 3a 0a 20 2a 09 2d |. * Inpu|ts:. *.-|
|00004770| 64 3a 09 20 20 20 20 49 | 66 20 67 69 76 65 6e 2c |d:. I|f given,|
|00004780| 20 64 65 63 6f 6d 70 72 | 65 73 73 69 6f 6e 20 69 | decompr|ession i|
|00004790| 73 20 64 6f 6e 65 20 69 | 6e 73 74 65 61 64 2e 0a |s done i|nstead..|
|000047a0| 20 2a 0a 20 2a 20 20 20 | 20 20 20 2d 63 3a 20 20 | *. * | -c: |
|000047b0| 20 20 20 20 20 20 20 57 | 72 69 74 65 20 6f 75 74 | W|rite out|
|000047c0| 70 75 74 20 6f 6e 20 73 | 74 64 6f 75 74 2c 20 64 |put on s|tdout, d|
|000047d0| 6f 6e 27 74 20 72 65 6d | 6f 76 65 20 6f 72 69 67 |on't rem|ove orig|
|000047e0| 69 6e 61 6c 2e 0a 20 2a | 0a 20 2a 20 20 20 20 20 |inal.. *|. * |
|000047f0| 20 2d 62 3a 20 20 20 20 | 20 20 20 20 20 50 61 72 | -b: | Par|
|00004800| 61 6d 65 74 65 72 20 6c | 69 6d 69 74 73 20 74 68 |ameter l|imits th|
|00004810| 65 20 6d 61 78 20 6e 75 | 6d 62 65 72 20 6f 66 20 |e max nu|mber of |
|00004820| 62 69 74 73 2f 63 6f 64 | 65 2e 0a 20 2a 0a 20 2a |bits/cod|e.. *. *|
|00004830| 09 2d 66 3a 09 20 20 20 | 20 46 6f 72 63 65 73 20 |.-f:. | Forces |
|00004840| 6f 75 74 70 75 74 20 66 | 69 6c 65 20 74 6f 20 62 |output f|ile to b|
|00004850| 65 20 67 65 6e 65 72 61 | 74 65 64 2c 20 65 76 65 |e genera|ted, eve|
|00004860| 6e 20 69 66 20 6f 6e 65 | 20 61 6c 72 65 61 64 79 |n if one| already|
|00004870| 0a 20 2a 09 09 20 20 20 | 20 65 78 69 73 74 73 2c |. *.. | exists,|
|00004880| 20 61 6e 64 20 65 76 65 | 6e 20 69 66 20 6e 6f 20 | and eve|n if no |
|00004890| 73 70 61 63 65 20 69 73 | 20 73 61 76 65 64 20 62 |space is| saved b|
|000048a0| 79 20 63 6f 6d 70 72 65 | 73 73 69 6e 67 2e 0a 20 |y compre|ssing.. |
|000048b0| 2a 09 09 20 20 20 20 49 | 66 20 2d 66 20 69 73 20 |*.. I|f -f is |
|000048c0| 6e 6f 74 20 75 73 65 64 | 2c 20 74 68 65 20 75 73 |not used|, the us|
|000048d0| 65 72 20 77 69 6c 6c 20 | 62 65 20 70 72 6f 6d 70 |er will |be promp|
|000048e0| 74 65 64 20 69 66 20 73 | 74 64 69 6e 20 69 73 0a |ted if s|tdin is.|
|000048f0| 20 2a 09 09 20 20 20 20 | 61 20 74 74 79 2c 20 6f | *.. |a tty, o|
|00004900| 74 68 65 72 77 69 73 65 | 2c 20 74 68 65 20 6f 75 |therwise|, the ou|
|00004910| 74 70 75 74 20 66 69 6c | 65 20 77 69 6c 6c 20 6e |tput fil|e will n|
|00004920| 6f 74 20 62 65 20 6f 76 | 65 72 77 72 69 74 74 65 |ot be ov|erwritte|
|00004930| 6e 2e 0a 20 2a 0a 20 2a | 20 20 20 20 20 20 2d 76 |n.. *. *| -v|
|00004940| 3a 09 20 20 20 20 57 72 | 69 74 65 20 63 6f 6d 70 |:. Wr|ite comp|
|00004950| 72 65 73 73 69 6f 6e 20 | 73 74 61 74 69 73 74 69 |ression |statisti|
|00004960| 63 73 0a 20 2a 0a 20 2a | 20 09 66 69 6c 65 20 2e |cs. *. *| .file .|
|00004970| 2e 2e 3a 20 20 20 46 69 | 6c 65 73 20 74 6f 20 62 |..: Fi|les to b|
|00004980| 65 20 63 6f 6d 70 72 65 | 73 73 65 64 2e 20 20 49 |e compre|ssed. I|
|00004990| 66 20 6e 6f 6e 65 20 73 | 70 65 63 69 66 69 65 64 |f none s|pecified|
|000049a0| 2c 20 73 74 64 69 6e 0a | 20 2a 09 09 20 20 20 20 |, stdin.| *.. |
|000049b0| 69 73 20 75 73 65 64 2e | 0a 20 2a 20 4f 75 74 70 |is used.|. * Outp|
|000049c0| 75 74 73 3a 0a 20 2a 09 | 66 69 6c 65 2e 5a 3a 09 |uts:. *.|file.Z:.|
|000049d0| 20 20 20 20 43 6f 6d 70 | 72 65 73 73 65 64 20 66 | Comp|ressed f|
|000049e0| 6f 72 6d 20 6f 66 20 66 | 69 6c 65 20 77 69 74 68 |orm of f|ile with|
|000049f0| 20 73 61 6d 65 20 6d 6f | 64 65 2c 20 6f 77 6e 65 | same mo|de, owne|
|00004a00| 72 2c 20 61 6e 64 20 75 | 74 69 6d 65 73 0a 20 2a |r, and u|times. *|
|00004a10| 20 09 6f 72 20 73 74 64 | 6f 75 74 20 20 20 28 69 | .or std|out (i|
|00004a20| 66 20 73 74 64 69 6e 20 | 75 73 65 64 20 61 73 20 |f stdin |used as |
|00004a30| 69 6e 70 75 74 29 0a 20 | 2a 0a 20 2a 20 41 73 73 |input). |*. * Ass|
|00004a40| 75 6d 70 74 69 6f 6e 73 | 3a 0a 20 2a 09 57 68 65 |umptions|:. *.Whe|
|00004a50| 6e 20 66 69 6c 65 6e 61 | 6d 65 73 20 61 72 65 20 |n filena|mes are |
|00004a60| 67 69 76 65 6e 2c 20 72 | 65 70 6c 61 63 65 73 20 |given, r|eplaces |
|00004a70| 77 69 74 68 20 74 68 65 | 20 63 6f 6d 70 72 65 73 |with the| compres|
|00004a80| 73 65 64 20 76 65 72 73 | 69 6f 6e 0a 20 2a 09 28 |sed vers|ion. *.(|
|00004a90| 2e 5a 20 73 75 66 66 69 | 78 29 20 6f 6e 6c 79 20 |.Z suffi|x) only |
|00004aa0| 69 66 20 74 68 65 20 66 | 69 6c 65 20 64 65 63 72 |if the f|ile decr|
|00004ab0| 65 61 73 65 73 20 69 6e | 20 73 69 7a 65 2e 0a 20 |eases in| size.. |
|00004ac0| 2a 20 41 6c 67 6f 72 69 | 74 68 6d 3a 0a 20 2a 20 |* Algori|thm:. * |
|00004ad0| 09 4d 6f 64 69 66 69 65 | 64 20 4c 65 6d 70 65 6c |.Modifie|d Lempel|
|00004ae0| 2d 5a 69 76 20 6d 65 74 | 68 6f 64 20 28 4c 5a 57 |-Ziv met|hod (LZW|
|00004af0| 29 2e 20 20 42 61 73 69 | 63 61 6c 6c 79 20 66 69 |). Basi|cally fi|
|00004b00| 6e 64 73 20 63 6f 6d 6d | 6f 6e 0a 20 2a 20 73 75 |nds comm|on. * su|
|00004b10| 62 73 74 72 69 6e 67 73 | 20 61 6e 64 20 72 65 70 |bstrings| and rep|
|00004b20| 6c 61 63 65 73 20 74 68 | 65 6d 20 77 69 74 68 20 |laces th|em with |
|00004b30| 61 20 76 61 72 69 61 62 | 6c 65 20 73 69 7a 65 20 |a variab|le size |
|00004b40| 63 6f 64 65 2e 20 20 54 | 68 69 73 20 69 73 0a 20 |code. T|his is. |
|00004b50| 2a 20 64 65 74 65 72 6d | 69 6e 69 73 74 69 63 2c |* determ|inistic,|
|00004b60| 20 61 6e 64 20 63 61 6e | 20 62 65 20 64 6f 6e 65 | and can| be done|
|00004b70| 20 6f 6e 20 74 68 65 20 | 66 6c 79 2e 20 20 54 68 | on the |fly. Th|
|00004b80| 75 73 2c 20 74 68 65 20 | 64 65 63 6f 6d 70 72 65 |us, the |decompre|
|00004b90| 73 73 69 6f 6e 0a 20 2a | 20 70 72 6f 63 65 64 75 |ssion. *| procedu|
|00004ba0| 72 65 20 6e 65 65 64 73 | 20 6e 6f 20 69 6e 70 75 |re needs| no inpu|
|00004bb0| 74 20 74 61 62 6c 65 2c | 20 62 75 74 20 74 72 61 |t table,| but tra|
|00004bc0| 63 6b 73 20 74 68 65 20 | 77 61 79 20 74 68 65 20 |cks the |way the |
|00004bd0| 74 61 62 6c 65 20 77 61 | 73 20 62 75 69 6c 74 2e |table wa|s built.|
|00004be0| 0a 20 2a 2f 0a 0a 6d 61 | 69 6e 28 20 61 72 67 63 |. */..ma|in( argc|
|00004bf0| 2c 20 61 72 67 76 20 29 | 0a 72 65 67 69 73 74 65 |, argv )|.registe|
|00004c00| 72 20 69 6e 74 20 61 72 | 67 63 3b 20 63 68 61 72 |r int ar|gc; char|
|00004c10| 20 2a 2a 61 72 67 76 3b | 0a 7b 0a 20 20 20 20 69 | **argv;|.{. i|
|00004c20| 6e 74 20 6f 76 65 72 77 | 72 69 74 65 20 3d 20 30 |nt overw|rite = 0|
|00004c30| 3b 09 2f 2a 20 44 6f 20 | 6e 6f 74 20 6f 76 65 72 |;./* Do |not over|
|00004c40| 77 72 69 74 65 20 75 6e | 6c 65 73 73 20 67 69 76 |write un|less giv|
|00004c50| 65 6e 20 2d 66 20 66 6c | 61 67 20 2a 2f 0a 20 20 |en -f fl|ag */. |
|00004c60| 20 20 63 68 61 72 20 74 | 65 6d 70 6e 61 6d 65 5b | char t|empname[|
|00004c70| 31 30 30 5d 3b 0a 20 20 | 20 20 63 68 61 72 20 2a |100];. | char *|
|00004c80| 2a 66 69 6c 65 6c 69 73 | 74 2c 20 2a 2a 66 69 6c |*filelis|t, **fil|
|00004c90| 65 70 74 72 3b 0a 20 20 | 20 20 63 68 61 72 20 2a |eptr;. | char *|
|00004ca0| 63 70 2c 20 2a 72 69 6e | 64 65 78 28 29 2c 20 2a |cp, *rin|dex(), *|
|00004cb0| 6d 61 6c 6c 6f 63 28 29 | 3b 0a 20 20 20 20 73 74 |malloc()|;. st|
|00004cc0| 72 75 63 74 20 73 74 61 | 74 20 73 74 61 74 62 75 |ruct sta|t statbu|
|00004cd0| 66 3b 0a 20 20 20 20 65 | 78 74 65 72 6e 20 6f 6e |f;. e|xtern on|
|00004ce0| 69 6e 74 72 28 29 2c 20 | 6f 6f 70 73 28 29 3b 0a |intr(), |oops();.|
|00004cf0| 0a 0a 20 20 20 20 69 66 | 20 28 20 28 62 67 6e 64 |.. if| ( (bgnd|
|00004d00| 5f 66 6c 61 67 20 3d 20 | 73 69 67 6e 61 6c 20 28 |_flag = |signal (|
|00004d10| 20 53 49 47 49 4e 54 2c | 20 53 49 47 5f 49 47 4e | SIGINT,| SIG_IGN|
|00004d20| 20 29 29 20 21 3d 20 53 | 49 47 5f 49 47 4e 20 29 | )) != S|IG_IGN )|
|00004d30| 20 7b 0a 09 73 69 67 6e | 61 6c 20 28 20 53 49 47 | {..sign|al ( SIG|
|00004d40| 49 4e 54 2c 20 6f 6e 69 | 6e 74 72 20 29 3b 0a 09 |INT, oni|ntr );..|
|00004d50| 73 69 67 6e 61 6c 20 28 | 20 53 49 47 53 45 47 56 |signal (| SIGSEGV|
|00004d60| 2c 20 6f 6f 70 73 20 29 | 3b 0a 20 20 20 20 7d 0a |, oops )|;. }.|
|00004d70| 0a 23 69 66 64 65 66 20 | 43 4f 4d 50 41 54 49 42 |.#ifdef |COMPATIB|
|00004d80| 4c 45 0a 20 20 20 20 6e | 6f 6d 61 67 69 63 20 3d |LE. n|omagic =|
|00004d90| 20 31 3b 09 2f 2a 20 4f | 72 69 67 69 6e 61 6c 20 | 1;./* O|riginal |
|00004da0| 64 69 64 6e 27 74 20 68 | 61 76 65 20 61 20 6d 61 |didn't h|ave a ma|
|00004db0| 67 69 63 20 6e 75 6d 62 | 65 72 20 2a 2f 0a 23 65 |gic numb|er */.#e|
|00004dc0| 6e 64 69 66 20 2f 2a 20 | 43 4f 4d 50 41 54 49 42 |ndif /* |COMPATIB|
|00004dd0| 4c 45 20 2a 2f 0a 0a 20 | 20 20 20 66 69 6c 65 6c |LE */.. | filel|
|00004de0| 69 73 74 20 3d 20 66 69 | 6c 65 70 74 72 20 3d 20 |ist = fi|leptr = |
|00004df0| 28 63 68 61 72 20 2a 2a | 29 28 6d 61 6c 6c 6f 63 |(char **|)(malloc|
|00004e00| 28 61 72 67 63 20 2a 20 | 73 69 7a 65 6f 66 28 2a |(argc * |sizeof(*|
|00004e10| 61 72 67 76 29 29 29 3b | 0a 20 20 20 20 2a 66 69 |argv)));|. *fi|
|00004e20| 6c 65 6c 69 73 74 20 3d | 20 4e 55 4c 4c 3b 0a 0a |lelist =| NULL;..|
|00004e30| 20 20 20 20 69 66 28 28 | 63 70 20 3d 20 72 69 6e | if((|cp = rin|
|00004e40| 64 65 78 28 61 72 67 76 | 5b 30 5d 2c 20 27 2f 27 |dex(argv|[0], '/'|
|00004e50| 29 29 20 21 3d 20 30 29 | 20 7b 0a 09 63 70 2b 2b |)) != 0)| {..cp++|
|00004e60| 3b 0a 20 20 20 20 7d 20 | 65 6c 73 65 20 7b 0a 09 |;. } |else {..|
|00004e70| 63 70 20 3d 20 61 72 67 | 76 5b 30 5d 3b 0a 20 20 |cp = arg|v[0];. |
|00004e80| 20 20 7d 0a 20 20 20 20 | 69 66 28 73 74 72 63 6d | }. |if(strcm|
|00004e90| 70 28 63 70 2c 20 22 75 | 6e 63 6f 6d 70 72 65 73 |p(cp, "u|ncompres|
|00004ea0| 73 22 29 20 3d 3d 20 30 | 29 20 7b 0a 09 64 6f 5f |s") == 0|) {..do_|
|00004eb0| 64 65 63 6f 6d 70 20 3d | 20 31 3b 0a 20 20 20 20 |decomp =| 1;. |
|00004ec0| 7d 20 65 6c 73 65 20 69 | 66 28 73 74 72 63 6d 70 |} else i|f(strcmp|
|00004ed0| 28 63 70 2c 20 22 7a 63 | 61 74 22 29 20 3d 3d 20 |(cp, "zc|at") == |
|00004ee0| 30 29 20 7b 0a 09 64 6f | 5f 64 65 63 6f 6d 70 20 |0) {..do|_decomp |
|00004ef0| 3d 20 31 3b 0a 09 7a 63 | 61 74 5f 66 6c 67 20 3d |= 1;..zc|at_flg =|
|00004f00| 20 31 3b 0a 20 20 20 20 | 7d 0a 0a 23 69 66 64 65 | 1;. |}..#ifde|
|00004f10| 66 20 42 53 44 34 5f 32 | 0a 20 20 20 20 2f 2a 20 |f BSD4_2|. /* |
|00004f20| 34 2e 32 42 53 44 20 64 | 65 70 65 6e 64 65 6e 74 |4.2BSD d|ependent|
|00004f30| 20 2d 20 74 61 6b 65 20 | 69 74 20 6f 75 74 20 69 | - take |it out i|
|00004f40| 66 20 6e 6f 74 20 2a 2f | 0a 20 20 20 20 73 65 74 |f not */|. set|
|00004f50| 6c 69 6e 65 62 75 66 28 | 20 73 74 64 65 72 72 20 |linebuf(| stderr |
|00004f60| 29 3b 0a 23 65 6e 64 69 | 66 20 2f 2a 20 42 53 44 |);.#endi|f /* BSD|
|00004f70| 34 5f 32 20 2a 2f 0a 0a | 20 20 20 20 2f 2a 20 41 |4_2 */..| /* A|
|00004f80| 72 67 75 6d 65 6e 74 20 | 50 72 6f 63 65 73 73 69 |rgument |Processi|
|00004f90| 6e 67 0a 20 20 20 20 20 | 2a 20 41 6c 6c 20 66 6c |ng. |* All fl|
|00004fa0| 61 67 73 20 61 72 65 20 | 6f 70 74 69 6f 6e 61 6c |ags are |optional|
|00004fb0| 2e 0a 20 20 20 20 20 2a | 20 2d 44 20 3d 3e 20 64 |.. *| -D => d|
|00004fc0| 65 62 75 67 0a 20 20 20 | 20 20 2a 20 2d 56 20 3d |ebug. | * -V =|
|00004fd0| 3e 20 70 72 69 6e 74 20 | 56 65 72 73 69 6f 6e 3b |> print |Version;|
|00004fe0| 20 64 65 62 75 67 20 76 | 65 72 62 6f 73 65 0a 20 | debug v|erbose. |
|00004ff0| 20 20 20 20 2a 20 2d 64 | 20 3d 3e 20 64 6f 5f 64 | * -d| => do_d|
|00005000| 65 63 6f 6d 70 0a 20 20 | 20 20 20 2a 20 2d 76 20 |ecomp. | * -v |
|00005010| 3d 3e 20 75 6e 71 75 69 | 65 74 0a 20 20 20 20 20 |=> unqui|et. |
|00005020| 2a 20 2d 66 20 3d 3e 20 | 66 6f 72 63 65 20 6f 76 |* -f => |force ov|
|00005030| 65 72 77 72 69 74 65 20 | 6f 66 20 6f 75 74 70 75 |erwrite |of outpu|
|00005040| 74 20 66 69 6c 65 0a 20 | 20 20 20 20 2a 20 2d 6e |t file. | * -n|
|00005050| 20 3d 3e 20 6e 6f 20 68 | 65 61 64 65 72 3a 20 75 | => no h|eader: u|
|00005060| 73 65 66 75 6c 20 74 6f | 20 75 6e 63 6f 6d 70 72 |seful to| uncompr|
|00005070| 65 73 73 20 6f 6c 64 20 | 66 69 6c 65 73 0a 20 20 |ess old |files. |
|00005080| 20 20 20 2a 20 2d 62 20 | 6d 61 78 62 69 74 73 20 | * -b |maxbits |
|00005090| 3d 3e 20 6d 61 78 62 69 | 74 73 2e 20 20 49 66 20 |=> maxbi|ts. If |
|000050a0| 2d 62 20 69 73 20 73 70 | 65 63 69 66 69 65 64 2c |-b is sp|ecified,|
|000050b0| 20 74 68 65 6e 20 6d 61 | 78 62 69 74 73 20 4d 55 | then ma|xbits MU|
|000050c0| 53 54 20 62 65 0a 20 20 | 20 20 20 2a 09 20 20 20 |ST be. | *. |
|000050d0| 20 67 69 76 65 6e 20 61 | 6c 73 6f 2e 0a 20 20 20 | given a|lso.. |
|000050e0| 20 20 2a 20 2d 63 20 3d | 3e 20 63 61 74 20 61 6c | * -c =|> cat al|
|000050f0| 6c 20 6f 75 74 70 75 74 | 20 74 6f 20 73 74 64 6f |l output| to stdo|
|00005100| 75 74 0a 20 20 20 20 20 | 2a 20 2d 43 20 3d 3e 20 |ut. |* -C => |
|00005110| 67 65 6e 65 72 61 74 65 | 20 6f 75 74 70 75 74 20 |generate| output |
|00005120| 63 6f 6d 70 61 74 69 62 | 6c 65 20 77 69 74 68 20 |compatib|le with |
|00005130| 63 6f 6d 70 72 65 73 73 | 20 32 2e 30 2e 0a 20 20 |compress| 2.0.. |
|00005140| 20 20 20 2a 20 69 66 20 | 61 20 73 74 72 69 6e 67 | * if |a string|
|00005150| 20 69 73 20 6c 65 66 74 | 2c 20 6d 75 73 74 20 62 | is left|, must b|
|00005160| 65 20 61 6e 20 69 6e 70 | 75 74 20 66 69 6c 65 6e |e an inp|ut filen|
|00005170| 61 6d 65 2e 0a 20 20 20 | 20 20 2a 2f 0a 20 20 20 |ame.. | */. |
|00005180| 20 66 6f 72 20 28 61 72 | 67 63 2d 2d 2c 20 61 72 | for (ar|gc--, ar|
|00005190| 67 76 2b 2b 3b 20 61 72 | 67 63 20 3e 20 30 3b 20 |gv++; ar|gc > 0; |
|000051a0| 61 72 67 63 2d 2d 2c 20 | 61 72 67 76 2b 2b 29 20 |argc--, |argv++) |
|000051b0| 7b 0a 09 69 66 20 28 2a | 2a 61 72 67 76 20 3d 3d |{..if (*|*argv ==|
|000051c0| 20 27 2d 27 29 20 7b 09 | 2f 2a 20 41 20 66 6c 61 | '-') {.|/* A fla|
|000051d0| 67 20 61 72 67 75 6d 65 | 6e 74 20 2a 2f 0a 09 20 |g argume|nt */.. |
|000051e0| 20 20 20 77 68 69 6c 65 | 20 28 2a 2b 2b 28 2a 61 | while| (*++(*a|
|000051f0| 72 67 76 29 29 20 7b 09 | 2f 2a 20 50 72 6f 63 65 |rgv)) {.|/* Proce|
|00005200| 73 73 20 61 6c 6c 20 66 | 6c 61 67 73 20 69 6e 20 |ss all f|lags in |
|00005210| 74 68 69 73 20 61 72 67 | 20 2a 2f 0a 09 09 73 77 |this arg| */...sw|
|00005220| 69 74 63 68 20 28 2a 2a | 61 72 67 76 29 20 7b 0a |itch (**|argv) {.|
|00005230| 23 69 66 64 65 66 20 44 | 45 42 55 47 0a 09 09 20 |#ifdef D|EBUG... |
|00005240| 20 20 20 63 61 73 65 20 | 27 44 27 3a 0a 09 09 09 | case |'D':....|
|00005250| 64 65 62 75 67 20 3d 20 | 31 3b 0a 09 09 09 62 72 |debug = |1;....br|
|00005260| 65 61 6b 3b 0a 09 09 20 | 20 20 20 63 61 73 65 20 |eak;... | case |
|00005270| 27 56 27 3a 0a 09 09 09 | 76 65 72 62 6f 73 65 20 |'V':....|verbose |
|00005280| 3d 20 31 3b 0a 09 09 09 | 76 65 72 73 69 6f 6e 28 |= 1;....|version(|
|00005290| 29 3b 0a 09 09 09 62 72 | 65 61 6b 3b 0a 23 65 6c |);....br|eak;.#el|
|000052a0| 73 65 0a 09 09 20 20 20 | 20 63 61 73 65 20 27 56 |se... | case 'V|
|000052b0| 27 3a 0a 09 09 09 76 65 | 72 73 69 6f 6e 28 29 3b |':....ve|rsion();|
|000052c0| 0a 09 09 09 62 72 65 61 | 6b 3b 0a 23 65 6e 64 69 |....brea|k;.#endi|
|000052d0| 66 20 2f 2a 20 44 45 42 | 55 47 20 2a 2f 0a 09 09 |f /* DEB|UG */...|
|000052e0| 20 20 20 20 63 61 73 65 | 20 27 76 27 3a 0a 09 09 | case| 'v':...|
|000052f0| 09 71 75 69 65 74 20 3d | 20 30 3b 0a 09 09 09 62 |.quiet =| 0;....b|
|00005300| 72 65 61 6b 3b 0a 09 09 | 20 20 20 20 63 61 73 65 |reak;...| case|
|00005310| 20 27 64 27 3a 0a 09 09 | 09 64 6f 5f 64 65 63 6f | 'd':...|.do_deco|
|00005320| 6d 70 20 3d 20 31 3b 0a | 09 09 09 62 72 65 61 6b |mp = 1;.|...break|
|00005330| 3b 0a 09 09 20 20 20 20 | 63 61 73 65 20 27 66 27 |;... |case 'f'|
|00005340| 3a 0a 09 09 20 20 20 20 | 63 61 73 65 20 27 46 27 |:... |case 'F'|
|00005350| 3a 0a 09 09 09 6f 76 65 | 72 77 72 69 74 65 20 3d |:....ove|rwrite =|
|00005360| 20 31 3b 0a 09 09 09 66 | 6f 72 63 65 20 3d 20 31 | 1;....f|orce = 1|
|00005370| 3b 0a 09 09 09 62 72 65 | 61 6b 3b 0a 09 09 20 20 |;....bre|ak;... |
|00005380| 20 20 63 61 73 65 20 27 | 6e 27 3a 0a 09 09 09 6e | case '|n':....n|
|00005390| 6f 6d 61 67 69 63 20 3d | 20 31 3b 0a 09 09 09 62 |omagic =| 1;....b|
|000053a0| 72 65 61 6b 3b 0a 09 09 | 20 20 20 20 63 61 73 65 |reak;...| case|
|000053b0| 20 27 43 27 3a 0a 09 09 | 09 62 6c 6f 63 6b 5f 63 | 'C':...|.block_c|
|000053c0| 6f 6d 70 72 65 73 73 20 | 3d 20 30 3b 0a 09 09 09 |ompress |= 0;....|
|000053d0| 62 72 65 61 6b 3b 0a 09 | 09 20 20 20 20 63 61 73 |break;..|. cas|
|000053e0| 65 20 27 62 27 3a 0a 09 | 09 09 69 66 20 28 21 41 |e 'b':..|..if (!A|
|000053f0| 52 47 56 41 4c 28 29 29 | 20 7b 0a 09 09 09 20 20 |RGVAL())| {.... |
|00005400| 20 20 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 | fprint|f(stderr|
|00005410| 2c 20 22 4d 69 73 73 69 | 6e 67 20 6d 61 78 62 69 |, "Missi|ng maxbi|
|00005420| 74 73 5c 6e 22 29 3b 0a | 09 09 09 20 20 20 20 55 |ts\n");.|... U|
|00005430| 73 61 67 65 28 29 3b 0a | 09 09 09 20 20 20 20 65 |sage();.|... e|
|00005440| 78 69 74 28 31 29 3b 0a | 09 09 09 7d 0a 09 09 09 |xit(1);.|...}....|
|00005450| 6d 61 78 62 69 74 73 20 | 3d 20 61 74 6f 69 28 2a |maxbits |= atoi(*|
|00005460| 61 72 67 76 29 3b 0a 09 | 09 09 67 6f 74 6f 20 6e |argv);..|..goto n|
|00005470| 65 78 74 61 72 67 3b 0a | 09 09 20 20 20 20 63 61 |extarg;.|.. ca|
|00005480| 73 65 20 27 63 27 3a 0a | 09 09 09 7a 63 61 74 5f |se 'c':.|...zcat_|
|00005490| 66 6c 67 20 3d 20 31 3b | 0a 09 09 09 62 72 65 61 |flg = 1;|....brea|
|000054a0| 6b 3b 0a 09 09 20 20 20 | 20 63 61 73 65 20 27 71 |k;... | case 'q|
|000054b0| 27 3a 0a 09 09 09 71 75 | 69 65 74 20 3d 20 31 3b |':....qu|iet = 1;|
|000054c0| 0a 09 09 09 62 72 65 61 | 6b 3b 0a 09 09 20 20 20 |....brea|k;... |
|000054d0| 20 64 65 66 61 75 6c 74 | 3a 0a 09 09 09 66 70 72 | default|:....fpr|
|000054e0| 69 6e 74 66 28 73 74 64 | 65 72 72 2c 20 22 55 6e |intf(std|err, "Un|
|000054f0| 6b 6e 6f 77 6e 20 66 6c | 61 67 3a 20 27 25 63 27 |known fl|ag: '%c'|
|00005500| 3b 20 22 2c 20 2a 2a 61 | 72 67 76 29 3b 0a 09 09 |; ", **a|rgv);...|
|00005510| 09 55 73 61 67 65 28 29 | 3b 0a 09 09 09 65 78 69 |.Usage()|;....exi|
|00005520| 74 28 31 29 3b 0a 09 09 | 7d 0a 09 20 20 20 20 7d |t(1);...|}.. }|
|00005530| 0a 09 7d 0a 09 65 6c 73 | 65 20 7b 09 09 2f 2a 20 |..}..els|e {../* |
|00005540| 49 6e 70 75 74 20 66 69 | 6c 65 20 6e 61 6d 65 20 |Input fi|le name |
|00005550| 2a 2f 0a 09 20 20 20 20 | 2a 66 69 6c 65 70 74 72 |*/.. |*fileptr|
|00005560| 2b 2b 20 3d 20 2a 61 72 | 67 76 3b 09 2f 2a 20 42 |++ = *ar|gv;./* B|
|00005570| 75 69 6c 64 20 69 6e 70 | 75 74 20 66 69 6c 65 20 |uild inp|ut file |
|00005580| 6c 69 73 74 20 2a 2f 0a | 09 20 20 20 20 2a 66 69 |list */.|. *fi|
|00005590| 6c 65 70 74 72 20 3d 20 | 4e 55 4c 4c 3b 0a 09 20 |leptr = |NULL;.. |
|000055a0| 20 20 20 2f 2a 20 70 72 | 6f 63 65 73 73 20 6e 65 | /* pr|ocess ne|
|000055b0| 78 74 61 72 67 3b 20 2a | 2f 0a 09 7d 0a 09 6e 65 |xtarg; *|/..}..ne|
|000055c0| 78 74 61 72 67 3a 20 63 | 6f 6e 74 69 6e 75 65 3b |xtarg: c|ontinue;|
|000055d0| 0a 20 20 20 20 7d 0a 0a | 20 20 20 20 69 66 28 6d |. }..| if(m|
|000055e0| 61 78 62 69 74 73 20 3c | 20 49 4e 49 54 5f 42 49 |axbits <| INIT_BI|
|000055f0| 54 53 29 20 6d 61 78 62 | 69 74 73 20 3d 20 49 4e |TS) maxb|its = IN|
|00005600| 49 54 5f 42 49 54 53 3b | 0a 20 20 20 20 69 66 20 |IT_BITS;|. if |
|00005610| 28 6d 61 78 62 69 74 73 | 20 3e 20 42 49 54 53 29 |(maxbits| > BITS)|
|00005620| 20 6d 61 78 62 69 74 73 | 20 3d 20 42 49 54 53 3b | maxbits| = BITS;|
|00005630| 0a 20 20 20 20 6d 61 78 | 6d 61 78 63 6f 64 65 20 |. max|maxcode |
|00005640| 3d 20 31 20 3c 3c 20 6d | 61 78 62 69 74 73 3b 0a |= 1 << m|axbits;.|
|00005650| 0a 20 20 20 20 69 66 20 | 28 2a 66 69 6c 65 6c 69 |. if |(*fileli|
|00005660| 73 74 20 21 3d 20 4e 55 | 4c 4c 29 20 7b 0a 09 66 |st != NU|LL) {..f|
|00005670| 6f 72 20 28 66 69 6c 65 | 70 74 72 20 3d 20 66 69 |or (file|ptr = fi|
|00005680| 6c 65 6c 69 73 74 3b 20 | 2a 66 69 6c 65 70 74 72 |lelist; |*fileptr|
|00005690| 3b 20 66 69 6c 65 70 74 | 72 2b 2b 29 20 7b 0a 09 |; filept|r++) {..|
|000056a0| 20 20 20 20 65 78 69 74 | 5f 73 74 61 74 20 3d 20 | exit|_stat = |
|000056b0| 30 3b 0a 09 20 20 20 20 | 69 66 20 28 64 6f 5f 64 |0;.. |if (do_d|
|000056c0| 65 63 6f 6d 70 20 21 3d | 20 30 29 20 7b 09 09 09 |ecomp !=| 0) {...|
|000056d0| 2f 2a 20 44 45 43 4f 4d | 50 52 45 53 53 49 4f 4e |/* DECOM|PRESSION|
|000056e0| 20 2a 2f 0a 09 09 2f 2a | 20 43 68 65 63 6b 20 66 | */.../*| Check f|
|000056f0| 6f 72 20 2e 5a 20 73 75 | 66 66 69 78 20 2a 2f 0a |or .Z su|ffix */.|
|00005700| 09 09 69 66 20 28 73 74 | 72 63 6d 70 28 2a 66 69 |..if (st|rcmp(*fi|
|00005710| 6c 65 70 74 72 20 2b 20 | 73 74 72 6c 65 6e 28 2a |leptr + |strlen(*|
|00005720| 66 69 6c 65 70 74 72 29 | 20 2d 20 32 2c 20 22 2e |fileptr)| - 2, ".|
|00005730| 5a 22 29 20 21 3d 20 30 | 29 20 7b 0a 09 09 20 20 |Z") != 0|) {... |
|00005740| 20 20 2f 2a 20 4e 6f 20 | 2e 5a 3a 20 74 61 63 6b | /* No |.Z: tack|
|00005750| 20 6f 6e 65 20 6f 6e 20 | 2a 2f 0a 09 09 20 20 20 | one on |*/... |
|00005760| 20 73 74 72 63 70 79 28 | 74 65 6d 70 6e 61 6d 65 | strcpy(|tempname|
|00005770| 2c 20 2a 66 69 6c 65 70 | 74 72 29 3b 0a 09 09 20 |, *filep|tr);... |
|00005780| 20 20 20 73 74 72 63 61 | 74 28 74 65 6d 70 6e 61 | strca|t(tempna|
|00005790| 6d 65 2c 20 22 2e 5a 22 | 29 3b 0a 09 09 20 20 20 |me, ".Z"|);... |
|000057a0| 20 2a 66 69 6c 65 70 74 | 72 20 3d 20 74 65 6d 70 | *filept|r = temp|
|000057b0| 6e 61 6d 65 3b 0a 09 09 | 7d 0a 09 09 2f 2a 20 4f |name;...|}.../* O|
|000057c0| 70 65 6e 20 69 6e 70 75 | 74 20 66 69 6c 65 20 2a |pen inpu|t file *|
|000057d0| 2f 0a 09 09 69 66 20 28 | 28 66 72 65 6f 70 65 6e |/...if (|(freopen|
|000057e0| 28 2a 66 69 6c 65 70 74 | 72 2c 20 22 72 22 2c 20 |(*filept|r, "r", |
|000057f0| 73 74 64 69 6e 29 29 20 | 3d 3d 20 4e 55 4c 4c 29 |stdin)) |== NULL)|
|00005800| 20 7b 0a 09 09 09 70 65 | 72 72 6f 72 28 2a 66 69 | {....pe|rror(*fi|
|00005810| 6c 65 70 74 72 29 3b 20 | 63 6f 6e 74 69 6e 75 65 |leptr); |continue|
|00005820| 3b 0a 09 09 7d 0a 09 09 | 2f 2a 20 43 68 65 63 6b |;...}...|/* Check|
|00005830| 20 74 68 65 20 6d 61 67 | 69 63 20 6e 75 6d 62 65 | the mag|ic numbe|
|00005840| 72 20 2a 2f 0a 09 09 69 | 66 20 28 6e 6f 6d 61 67 |r */...i|f (nomag|
|00005850| 69 63 20 3d 3d 20 30 29 | 20 7b 0a 09 09 20 20 20 |ic == 0)| {... |
|00005860| 20 69 66 20 28 28 67 65 | 74 63 68 61 72 28 29 20 | if ((ge|tchar() |
|00005870| 21 3d 20 28 6d 61 67 69 | 63 5f 68 65 61 64 65 72 |!= (magi|c_header|
|00005880| 5b 30 5d 20 26 20 30 78 | 46 46 29 29 0a 09 09 20 |[0] & 0x|FF))... |
|00005890| 20 20 20 20 7c 7c 20 28 | 67 65 74 63 68 61 72 28 | || (|getchar(|
|000058a0| 29 20 21 3d 20 28 6d 61 | 67 69 63 5f 68 65 61 64 |) != (ma|gic_head|
|000058b0| 65 72 5b 31 5d 20 26 20 | 30 78 46 46 29 29 29 20 |er[1] & |0xFF))) |
|000058c0| 7b 0a 09 09 09 66 70 72 | 69 6e 74 66 28 73 74 64 |{....fpr|intf(std|
|000058d0| 65 72 72 2c 20 22 25 73 | 3a 20 6e 6f 74 20 69 6e |err, "%s|: not in|
|000058e0| 20 63 6f 6d 70 72 65 73 | 73 65 64 20 66 6f 72 6d | compres|sed form|
|000058f0| 61 74 5c 6e 22 2c 0a 09 | 09 09 20 20 20 20 2a 66 |at\n",..|.. *f|
|00005900| 69 6c 65 70 74 72 29 3b | 0a 09 09 20 20 20 20 63 |ileptr);|... c|
|00005910| 6f 6e 74 69 6e 75 65 3b | 0a 09 09 20 20 20 20 7d |ontinue;|... }|
|00005920| 0a 09 09 20 20 20 20 6d | 61 78 62 69 74 73 20 3d |... m|axbits =|
|00005930| 20 67 65 74 63 68 61 72 | 28 29 3b 09 2f 2a 20 73 | getchar|();./* s|
|00005940| 65 74 20 2d 62 20 66 72 | 6f 6d 20 66 69 6c 65 20 |et -b fr|om file |
|00005950| 2a 2f 0a 09 09 20 20 20 | 20 62 6c 6f 63 6b 5f 63 |*/... | block_c|
|00005960| 6f 6d 70 72 65 73 73 20 | 3d 20 6d 61 78 62 69 74 |ompress |= maxbit|
|00005970| 73 20 26 20 42 4c 4f 43 | 4b 5f 4d 41 53 4b 3b 0a |s & BLOC|K_MASK;.|
|00005980| 09 09 20 20 20 20 6d 61 | 78 62 69 74 73 20 26 3d |.. ma|xbits &=|
|00005990| 20 42 49 54 5f 4d 41 53 | 4b 3b 0a 09 09 20 20 20 | BIT_MAS|K;... |
|000059a0| 20 6d 61 78 6d 61 78 63 | 6f 64 65 20 3d 20 31 20 | maxmaxc|ode = 1 |
|000059b0| 3c 3c 20 6d 61 78 62 69 | 74 73 3b 0a 09 09 20 20 |<< maxbi|ts;... |
|000059c0| 20 20 69 66 28 6d 61 78 | 62 69 74 73 20 3e 20 42 | if(max|bits > B|
|000059d0| 49 54 53 29 20 7b 0a 09 | 09 09 66 70 72 69 6e 74 |ITS) {..|..fprint|
|000059e0| 66 28 73 74 64 65 72 72 | 2c 0a 09 09 09 22 25 73 |f(stderr|,...."%s|
|000059f0| 3a 20 63 6f 6d 70 72 65 | 73 73 65 64 20 77 69 74 |: compre|ssed wit|
|00005a00| 68 20 25 64 20 62 69 74 | 73 2c 20 63 61 6e 20 6f |h %d bit|s, can o|
|00005a10| 6e 6c 79 20 68 61 6e 64 | 6c 65 20 25 64 20 62 69 |nly hand|le %d bi|
|00005a20| 74 73 5c 6e 22 2c 0a 09 | 09 09 2a 66 69 6c 65 70 |ts\n",..|..*filep|
|00005a30| 74 72 2c 20 6d 61 78 62 | 69 74 73 2c 20 42 49 54 |tr, maxb|its, BIT|
|00005a40| 53 29 3b 0a 09 09 09 63 | 6f 6e 74 69 6e 75 65 3b |S);....c|ontinue;|
|00005a50| 0a 09 09 20 20 20 20 7d | 0a 09 09 7d 0a 09 09 2f |... }|...}.../|
|00005a60| 2a 20 47 65 6e 65 72 61 | 74 65 20 6f 75 74 70 75 |* Genera|te outpu|
|00005a70| 74 20 66 69 6c 65 6e 61 | 6d 65 20 2a 2f 0a 09 09 |t filena|me */...|
|00005a80| 73 74 72 63 70 79 28 6f | 66 6e 61 6d 65 2c 20 2a |strcpy(o|fname, *|
|00005a90| 66 69 6c 65 70 74 72 29 | 3b 0a 09 09 6f 66 6e 61 |fileptr)|;...ofna|
|00005aa0| 6d 65 5b 73 74 72 6c 65 | 6e 28 2a 66 69 6c 65 70 |me[strle|n(*filep|
|00005ab0| 74 72 29 20 2d 20 32 5d | 20 3d 20 27 5c 30 27 3b |tr) - 2]| = '\0';|
|00005ac0| 20 20 2f 2a 20 53 74 72 | 69 70 20 6f 66 66 20 2e | /* Str|ip off .|
|00005ad0| 5a 20 2a 2f 0a 09 20 20 | 20 20 7d 20 65 6c 73 65 |Z */.. | } else|
|00005ae0| 20 7b 09 09 09 09 09 2f | 2a 20 43 4f 4d 50 52 45 | {...../|* COMPRE|
|00005af0| 53 53 49 4f 4e 20 2a 2f | 0a 09 09 69 66 20 28 73 |SSION */|...if (s|
|00005b00| 74 72 63 6d 70 28 2a 66 | 69 6c 65 70 74 72 20 2b |trcmp(*f|ileptr +|
|00005b10| 20 73 74 72 6c 65 6e 28 | 2a 66 69 6c 65 70 74 72 | strlen(|*fileptr|
|00005b20| 29 20 2d 20 32 2c 20 22 | 2e 5a 22 29 20 3d 3d 20 |) - 2, "|.Z") == |
|00005b30| 30 29 20 7b 0a 09 09 20 | 20 20 20 09 66 70 72 69 |0) {... | .fpri|
|00005b40| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 22 25 73 3a |ntf(stde|rr, "%s:|
|00005b50| 20 61 6c 72 65 61 64 79 | 20 68 61 73 20 2e 5a 20 | already| has .Z |
|00005b60| 73 75 66 66 69 78 20 2d | 2d 20 6e 6f 20 63 68 61 |suffix -|- no cha|
|00005b70| 6e 67 65 5c 6e 22 2c 0a | 09 09 09 20 20 20 20 2a |nge\n",.|... *|
|00005b80| 66 69 6c 65 70 74 72 29 | 3b 0a 09 09 20 20 20 20 |fileptr)|;... |
|00005b90| 63 6f 6e 74 69 6e 75 65 | 3b 0a 09 09 7d 0a 09 09 |continue|;...}...|
|00005ba0| 2f 2a 20 4f 70 65 6e 20 | 69 6e 70 75 74 20 66 69 |/* Open |input fi|
|00005bb0| 6c 65 20 2a 2f 0a 09 09 | 69 66 20 28 28 66 72 65 |le */...|if ((fre|
|00005bc0| 6f 70 65 6e 28 2a 66 69 | 6c 65 70 74 72 2c 20 22 |open(*fi|leptr, "|
|00005bd0| 72 22 2c 20 73 74 64 69 | 6e 29 29 20 3d 3d 20 4e |r", stdi|n)) == N|
|00005be0| 55 4c 4c 29 20 7b 0a 09 | 09 20 20 20 20 70 65 72 |ULL) {..|. per|
|00005bf0| 72 6f 72 28 2a 66 69 6c | 65 70 74 72 29 3b 20 63 |ror(*fil|eptr); c|
|00005c00| 6f 6e 74 69 6e 75 65 3b | 0a 09 09 7d 0a 09 09 73 |ontinue;|...}...s|
|00005c10| 74 61 74 20 28 20 2a 66 | 69 6c 65 70 74 72 2c 20 |tat ( *f|ileptr, |
|00005c20| 26 73 74 61 74 62 75 66 | 20 29 3b 0a 09 09 66 73 |&statbuf| );...fs|
|00005c30| 69 7a 65 20 3d 20 28 6c | 6f 6e 67 29 20 73 74 61 |ize = (l|ong) sta|
|00005c40| 74 62 75 66 2e 73 74 5f | 73 69 7a 65 3b 0a 09 09 |tbuf.st_|size;...|
|00005c50| 2f 2a 0a 09 09 20 2a 20 | 74 75 6e 65 20 68 61 73 |/*... * |tune has|
|00005c60| 68 20 74 61 62 6c 65 20 | 73 69 7a 65 20 66 6f 72 |h table |size for|
|00005c70| 20 73 6d 61 6c 6c 20 66 | 69 6c 65 73 20 2d 2d 20 | small f|iles -- |
|00005c80| 61 64 20 68 6f 63 2c 0a | 09 09 20 2a 20 62 75 74 |ad hoc,.|.. * but|
|00005c90| 20 74 68 65 20 73 69 7a | 65 73 20 6d 61 74 63 68 | the siz|es match|
|00005ca0| 20 65 61 72 6c 69 65 72 | 20 23 64 65 66 69 6e 65 | earlier| #define|
|00005cb0| 73 2c 20 77 68 69 63 68 | 0a 09 09 20 2a 20 73 65 |s, which|... * se|
|00005cc0| 72 76 65 20 61 73 20 75 | 70 70 65 72 20 62 6f 75 |rve as u|pper bou|
|00005cd0| 6e 64 73 20 6f 6e 20 74 | 68 65 20 6e 75 6d 62 65 |nds on t|he numbe|
|00005ce0| 72 20 6f 66 20 6f 75 74 | 70 75 74 20 63 6f 64 65 |r of out|put code|
|00005cf0| 73 2e 20 0a 09 09 20 2a | 2f 0a 09 09 68 73 69 7a |s. ... *|/...hsiz|
|00005d00| 65 20 3d 20 48 53 49 5a | 45 3b 0a 09 09 69 66 20 |e = HSIZ|E;...if |
|00005d10| 28 20 66 73 69 7a 65 20 | 3c 20 28 31 20 3c 3c 20 |( fsize |< (1 << |
|00005d20| 31 32 29 20 29 0a 09 09 | 20 20 20 20 68 73 69 7a |12) )...| hsiz|
|00005d30| 65 20 3d 20 6d 69 6e 20 | 28 20 35 30 30 33 2c 20 |e = min |( 5003, |
|00005d40| 48 53 49 5a 45 20 29 3b | 0a 09 09 65 6c 73 65 20 |HSIZE );|...else |
|00005d50| 69 66 20 28 20 66 73 69 | 7a 65 20 3c 20 28 31 20 |if ( fsi|ze < (1 |
|00005d60| 3c 3c 20 31 33 29 20 29 | 0a 09 09 20 20 20 20 68 |<< 13) )|... h|
|00005d70| 73 69 7a 65 20 3d 20 6d | 69 6e 20 28 20 39 30 30 |size = m|in ( 900|
|00005d80| 31 2c 20 48 53 49 5a 45 | 20 29 3b 0a 09 09 65 6c |1, HSIZE| );...el|
|00005d90| 73 65 20 69 66 20 28 20 | 66 73 69 7a 65 20 3c 20 |se if ( |fsize < |
|00005da0| 28 31 20 3c 3c 20 31 34 | 29 20 29 0a 09 09 20 20 |(1 << 14|) )... |
|00005db0| 20 20 68 73 69 7a 65 20 | 3d 20 6d 69 6e 20 28 20 | hsize |= min ( |
|00005dc0| 31 38 30 31 33 2c 20 48 | 53 49 5a 45 20 29 3b 0a |18013, H|SIZE );.|
|00005dd0| 09 09 65 6c 73 65 20 69 | 66 20 28 20 66 73 69 7a |..else i|f ( fsiz|
|00005de0| 65 20 3c 20 28 31 20 3c | 3c 20 31 35 29 20 29 0a |e < (1 <|< 15) ).|
|00005df0| 09 09 20 20 20 20 68 73 | 69 7a 65 20 3d 20 6d 69 |.. hs|ize = mi|
|00005e00| 6e 20 28 20 33 35 30 32 | 33 2c 20 48 53 49 5a 45 |n ( 3502|3, HSIZE|
|00005e10| 20 29 3b 0a 09 09 65 6c | 73 65 20 69 66 20 28 20 | );...el|se if ( |
|00005e20| 66 73 69 7a 65 20 3c 20 | 34 37 30 30 30 20 29 0a |fsize < |47000 ).|
|00005e30| 09 09 20 20 20 20 68 73 | 69 7a 65 20 3d 20 6d 69 |.. hs|ize = mi|
|00005e40| 6e 20 28 20 35 30 30 32 | 31 2c 20 48 53 49 5a 45 |n ( 5002|1, HSIZE|
|00005e50| 20 29 3b 0a 0a 09 09 2f | 2a 20 47 65 6e 65 72 61 | );..../|* Genera|
|00005e60| 74 65 20 6f 75 74 70 75 | 74 20 66 69 6c 65 6e 61 |te outpu|t filena|
|00005e70| 6d 65 20 2a 2f 0a 09 09 | 73 74 72 63 70 79 28 6f |me */...|strcpy(o|
|00005e80| 66 6e 61 6d 65 2c 20 2a | 66 69 6c 65 70 74 72 29 |fname, *|fileptr)|
|00005e90| 3b 0a 23 69 66 6e 64 65 | 66 20 42 53 44 34 5f 32 |;.#ifnde|f BSD4_2|
|00005ea0| 09 09 2f 2a 20 53 68 6f | 72 74 20 66 69 6c 65 6e |../* Sho|rt filen|
|00005eb0| 61 6d 65 73 20 2a 2f 0a | 09 09 69 66 20 28 28 63 |ames */.|..if ((c|
|00005ec0| 70 3d 72 69 6e 64 65 78 | 28 6f 66 6e 61 6d 65 2c |p=rindex|(ofname,|
|00005ed0| 27 2f 27 29 29 20 21 3d | 20 4e 55 4c 4c 29 09 63 |'/')) !=| NULL).c|
|00005ee0| 70 2b 2b 3b 0a 09 09 65 | 6c 73 65 09 09 09 09 09 |p++;...e|lse.....|
|00005ef0| 63 70 20 3d 20 6f 66 6e | 61 6d 65 3b 0a 09 09 69 |cp = ofn|ame;...i|
|00005f00| 66 20 28 73 74 72 6c 65 | 6e 28 63 70 29 20 3e 20 |f (strle|n(cp) > |
|00005f10| 31 32 29 20 7b 0a 09 09 | 20 20 20 20 66 70 72 69 |12) {...| fpri|
|00005f20| 6e 74 66 28 73 74 64 65 | 72 72 2c 22 25 73 3a 20 |ntf(stde|rr,"%s: |
|00005f30| 66 69 6c 65 6e 61 6d 65 | 20 74 6f 6f 20 6c 6f 6e |filename| too lon|
|00005f40| 67 20 74 6f 20 74 61 63 | 6b 20 6f 6e 20 2e 5a 5c |g to tac|k on .Z\|
|00005f50| 6e 22 2c 63 70 29 3b 0a | 09 09 20 20 20 20 63 6f |n",cp);.|.. co|
|00005f60| 6e 74 69 6e 75 65 3b 0a | 09 09 7d 0a 23 65 6e 64 |ntinue;.|..}.#end|
|00005f70| 69 66 20 20 2f 2a 20 42 | 53 44 34 5f 32 09 09 4c |if /* B|SD4_2..L|
|00005f80| 6f 6e 67 20 66 69 6c 65 | 6e 61 6d 65 73 20 61 6c |ong file|names al|
|00005f90| 6c 6f 77 65 64 20 2a 2f | 0a 09 09 73 74 72 63 61 |lowed */|...strca|
|00005fa0| 74 28 6f 66 6e 61 6d 65 | 2c 20 22 2e 5a 22 29 3b |t(ofname|, ".Z");|
|00005fb0| 0a 09 20 20 20 20 7d 0a | 09 20 20 20 20 2f 2a 20 |.. }.|. /* |
|00005fc0| 43 68 65 63 6b 20 66 6f | 72 20 6f 76 65 72 77 72 |Check fo|r overwr|
|00005fd0| 69 74 65 20 6f 66 20 65 | 78 69 73 74 69 6e 67 20 |ite of e|xisting |
|00005fe0| 66 69 6c 65 20 2a 2f 0a | 09 20 20 20 20 69 66 20 |file */.|. if |
|00005ff0| 28 6f 76 65 72 77 72 69 | 74 65 20 3d 3d 20 30 20 |(overwri|te == 0 |
|00006000| 26 26 20 7a 63 61 74 5f | 66 6c 67 20 3d 3d 20 30 |&& zcat_|flg == 0|
|00006010| 29 20 7b 0a 09 09 69 66 | 20 28 73 74 61 74 28 6f |) {...if| (stat(o|
|00006020| 66 6e 61 6d 65 2c 20 26 | 73 74 61 74 62 75 66 29 |fname, &|statbuf)|
|00006030| 20 3d 3d 20 30 29 20 7b | 0a 09 09 20 20 20 20 63 | == 0) {|... c|
|00006040| 68 61 72 20 72 65 73 70 | 6f 6e 73 65 5b 32 5d 3b |har resp|onse[2];|
|00006050| 0a 09 09 20 20 20 20 72 | 65 73 70 6f 6e 73 65 5b |... r|esponse[|
|00006060| 30 5d 20 3d 20 27 6e 27 | 3b 0a 09 09 20 20 20 20 |0] = 'n'|;... |
|00006070| 66 70 72 69 6e 74 66 28 | 73 74 64 65 72 72 2c 20 |fprintf(|stderr, |
|00006080| 22 25 73 20 61 6c 72 65 | 61 64 79 20 65 78 69 73 |"%s alre|ady exis|
|00006090| 74 73 3b 22 2c 20 6f 66 | 6e 61 6d 65 29 3b 0a 09 |ts;", of|name);..|
|000060a0| 09 20 20 20 20 69 66 20 | 28 66 6f 72 65 67 72 6f |. if |(foregro|
|000060b0| 75 6e 64 28 29 29 20 7b | 0a 09 09 09 66 70 72 69 |und()) {|....fpri|
|000060c0| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 22 20 64 6f |ntf(stde|rr, " do|
|000060d0| 20 79 6f 75 20 77 69 73 | 68 20 74 6f 20 6f 76 65 | you wis|h to ove|
|000060e0| 72 77 72 69 74 65 20 25 | 73 20 28 79 20 6f 72 20 |rwrite %|s (y or |
|000060f0| 6e 29 3f 20 22 2c 0a 09 | 09 09 6f 66 6e 61 6d 65 |n)? ",..|..ofname|
|00006100| 29 3b 0a 09 09 09 66 66 | 6c 75 73 68 28 73 74 64 |);....ff|lush(std|
|00006110| 65 72 72 29 3b 0a 09 09 | 09 72 65 61 64 28 32 2c |err);...|.read(2,|
|00006120| 20 72 65 73 70 6f 6e 73 | 65 2c 20 32 29 3b 0a 09 | respons|e, 2);..|
|00006130| 09 09 77 68 69 6c 65 20 | 28 72 65 73 70 6f 6e 73 |..while |(respons|
|00006140| 65 5b 31 5d 20 21 3d 20 | 27 5c 6e 27 29 20 7b 0a |e[1] != |'\n') {.|
|00006150| 09 09 09 20 20 20 20 69 | 66 20 28 72 65 61 64 28 |... i|f (read(|
|00006160| 32 2c 20 72 65 73 70 6f | 6e 73 65 2b 31 2c 20 31 |2, respo|nse+1, 1|
|00006170| 29 20 3c 20 30 29 20 7b | 09 2f 2a 20 41 63 6b 21 |) < 0) {|./* Ack!|
|00006180| 20 2a 2f 0a 09 09 09 09 | 70 65 72 72 6f 72 28 22 | */.....|perror("|
|00006190| 73 74 64 65 72 72 22 29 | 3b 20 62 72 65 61 6b 3b |stderr")|; break;|
|000061a0| 0a 09 09 09 20 20 20 20 | 7d 0a 09 09 09 7d 0a 09 |.... |}....}..|
|000061b0| 09 20 20 20 20 7d 0a 09 | 09 20 20 20 20 69 66 20 |. }..|. if |
|000061c0| 28 72 65 73 70 6f 6e 73 | 65 5b 30 5d 20 21 3d 20 |(respons|e[0] != |
|000061d0| 27 79 27 29 20 7b 0a 09 | 09 09 66 70 72 69 6e 74 |'y') {..|..fprint|
|000061e0| 66 28 73 74 64 65 72 72 | 2c 20 22 5c 74 6e 6f 74 |f(stderr|, "\tnot|
|000061f0| 20 6f 76 65 72 77 72 69 | 74 74 65 6e 5c 6e 22 29 | overwri|tten\n")|
|00006200| 3b 0a 09 09 09 63 6f 6e | 74 69 6e 75 65 3b 0a 09 |;....con|tinue;..|
|00006210| 09 20 20 20 20 7d 0a 09 | 09 7d 0a 09 20 20 20 20 |. }..|.}.. |
|00006220| 7d 0a 09 20 20 20 20 69 | 66 28 7a 63 61 74 5f 66 |}.. i|f(zcat_f|
|00006230| 6c 67 20 3d 3d 20 30 29 | 20 7b 09 09 2f 2a 20 4f |lg == 0)| {../* O|
|00006240| 70 65 6e 20 6f 75 74 70 | 75 74 20 66 69 6c 65 20 |pen outp|ut file |
|00006250| 2a 2f 0a 09 09 69 66 20 | 28 66 72 65 6f 70 65 6e |*/...if |(freopen|
|00006260| 28 6f 66 6e 61 6d 65 2c | 20 22 77 22 2c 20 73 74 |(ofname,| "w", st|
|00006270| 64 6f 75 74 29 20 3d 3d | 20 4e 55 4c 4c 29 20 7b |dout) ==| NULL) {|
|00006280| 0a 09 09 20 20 20 20 70 | 65 72 72 6f 72 28 6f 66 |... p|error(of|
|00006290| 6e 61 6d 65 29 3b 0a 09 | 09 20 20 20 20 63 6f 6e |name);..|. con|
|000062a0| 74 69 6e 75 65 3b 0a 09 | 09 7d 0a 09 09 69 66 28 |tinue;..|.}...if(|
|000062b0| 21 71 75 69 65 74 29 0a | 09 09 09 66 70 72 69 6e |!quiet).|...fprin|
|000062c0| 74 66 28 73 74 64 65 72 | 72 2c 20 22 25 73 3a 20 |tf(stder|r, "%s: |
|000062d0| 22 2c 20 2a 66 69 6c 65 | 70 74 72 29 3b 0a 09 20 |", *file|ptr);.. |
|000062e0| 20 20 20 7d 0a 0a 09 20 | 20 20 20 2f 2a 20 41 63 | }... | /* Ac|
|000062f0| 74 75 61 6c 6c 79 20 64 | 6f 20 74 68 65 20 63 6f |tually d|o the co|
|00006300| 6d 70 72 65 73 73 69 6f | 6e 2f 64 65 63 6f 6d 70 |mpressio|n/decomp|
|00006310| 72 65 73 73 69 6f 6e 20 | 2a 2f 0a 09 20 20 20 20 |ression |*/.. |
|00006320| 69 66 20 28 64 6f 5f 64 | 65 63 6f 6d 70 20 3d 3d |if (do_d|ecomp ==|
|00006330| 20 30 29 09 63 6f 6d 70 | 72 65 73 73 28 29 3b 0a | 0).comp|ress();.|
|00006340| 23 69 66 6e 64 65 66 20 | 44 45 42 55 47 0a 09 20 |#ifndef |DEBUG.. |
|00006350| 20 20 20 65 6c 73 65 09 | 09 09 64 65 63 6f 6d 70 | else.|..decomp|
|00006360| 72 65 73 73 28 29 3b 0a | 23 65 6c 73 65 0a 09 20 |ress();.|#else.. |
|00006370| 20 20 20 65 6c 73 65 20 | 69 66 20 28 64 65 62 75 | else |if (debu|
|00006380| 67 20 3d 3d 20 30 29 09 | 64 65 63 6f 6d 70 72 65 |g == 0).|decompre|
|00006390| 73 73 28 29 3b 0a 09 20 | 20 20 20 65 6c 73 65 09 |ss();.. | else.|
|000063a0| 09 09 70 72 69 6e 74 63 | 6f 64 65 73 28 29 3b 0a |..printc|odes();.|
|000063b0| 09 20 20 20 20 69 66 20 | 28 76 65 72 62 6f 73 65 |. if |(verbose|
|000063c0| 29 09 09 64 75 6d 70 5f | 74 61 62 28 29 3b 0a 23 |)..dump_|tab();.#|
|000063d0| 65 6e 64 69 66 20 2f 2a | 20 44 45 42 55 47 20 2a |endif /*| DEBUG *|
|000063e0| 2f 0a 09 20 20 20 20 69 | 66 28 7a 63 61 74 5f 66 |/.. i|f(zcat_f|
|000063f0| 6c 67 20 3d 3d 20 30 29 | 20 7b 0a 09 09 63 6f 70 |lg == 0)| {...cop|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.