home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / unix / hqxtobin.shr < prev    next >
SHell self-extracting ARchive  |  1989-04-10  |  51.5 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

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

You can browse this item here: hqxtobin.shr

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
66% dexvert PC-Shrink Archive (archive/pcShrink) ext Supported
66% dexvert Apple IIGS SH3/SHR (image/a2gsSHStar) ext Supported
66% dexvert Magic Draw (image/magicDraw) ext Supported
66% dexvert Apple IIGS Preferred Format (image/a2gsPreferred) ext Supported
1% dexvert Text File (text/txt) fallback Supported
100% file C source text default
99% file C source, ASCII text 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)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 20 38 2d 41 70 72 2d 38 | 39 20 20 35 3a 34 34 3a | 8-Apr-8|9 5:44:|
|00000010| 32 38 2d 47 4d 54 2c 35 | 32 36 39 33 3b 30 30 30 |28-GMT,5|2693;000|
|00000020| 30 30 30 30 30 30 30 31 | 31 0a 52 65 74 75 72 6e |00000001|1.Return|
|00000030| 2d 50 61 74 68 3a 20 3c | 6d 6f 6f 72 65 40 73 76 |-Path: <|moore@sv|
|00000040| 61 78 2e 63 73 2e 63 6f | 72 6e 65 6c 6c 2e 65 64 |ax.cs.co|rnell.ed|
|00000050| 75 3e 0a 52 65 63 65 69 | 76 65 64 3a 20 66 72 6f |u>.Recei|ved: fro|
|00000060| 6d 20 63 75 2d 61 72 70 | 61 2e 63 73 2e 63 6f 72 |m cu-arp|a.cs.cor|
|00000070| 6e 65 6c 6c 2e 65 64 75 | 20 62 79 20 73 75 6d 65 |nell.edu| by sume|
|00000080| 78 2d 61 69 6d 2e 73 74 | 61 6e 66 6f 72 64 2e 65 |x-aim.st|anford.e|
|00000090| 64 75 20 28 34 2e 30 2f | 69 6e 63 2d 31 2e 30 29 |du (4.0/|inc-1.0)|
|000000a0| 0a 09 69 64 20 41 41 30 | 36 31 37 35 3b 20 46 72 |..id AA0|6175; Fr|
|000000b0| 69 2c 20 37 20 41 70 72 | 20 38 39 20 32 32 3a 34 |i, 7 Apr| 89 22:4|
|000000c0| 34 3a 32 38 20 50 44 54 | 0a 52 65 63 65 69 76 65 |4:28 PDT|.Receive|
|000000d0| 64 3a 20 66 72 6f 6d 20 | 53 56 41 58 2e 43 53 2e |d: from |SVAX.CS.|
|000000e0| 43 4f 52 4e 45 4c 4c 2e | 45 44 55 20 62 79 20 63 |CORNELL.|EDU by c|
|000000f0| 75 2d 61 72 70 61 2e 63 | 73 2e 63 6f 72 6e 65 6c |u-arpa.c|s.cornel|
|00000100| 6c 2e 65 64 75 20 28 35 | 2e 36 31 2b 32 2f 31 2e |l.edu (5|.61+2/1.|
|00000110| 39 31 64 29 0a 09 69 64 | 20 41 41 32 30 31 30 31 |91d)..id| AA20101|
|00000120| 3b 20 53 61 74 2c 20 38 | 20 41 70 72 20 38 39 20 |; Sat, 8| Apr 89 |
|00000130| 30 31 3a 35 32 3a 30 39 | 20 2d 30 34 30 30 0a 44 |01:52:09| -0400.D|
|00000140| 61 74 65 3a 20 53 61 74 | 2c 20 38 20 41 70 72 20 |ate: Sat|, 8 Apr |
|00000150| 38 39 20 30 31 3a 35 31 | 3a 34 38 20 2d 30 34 30 |89 01:51|:48 -040|
|00000160| 30 0a 46 72 6f 6d 3a 20 | 6d 6f 6f 72 65 40 73 76 |0.From: |moore@sv|
|00000170| 61 78 2e 63 73 2e 63 6f | 72 6e 65 6c 6c 2e 65 64 |ax.cs.co|rnell.ed|
|00000180| 75 20 28 44 6f 75 67 20 | 4d 6f 6f 72 65 29 0a 4d |u (Doug |Moore).M|
|00000190| 65 73 73 61 67 65 2d 49 | 64 3a 20 3c 38 39 30 34 |essage-I|d: <8904|
|000001a0| 30 38 30 35 35 31 2e 41 | 41 32 30 33 32 34 40 73 |080551.A|A20324@s|
|000001b0| 76 61 78 2e 63 73 2e 63 | 6f 72 6e 65 6c 6c 2e 65 |vax.cs.c|ornell.e|
|000001c0| 64 75 3e 0a 52 65 63 65 | 69 76 65 64 3a 20 62 79 |du>.Rece|ived: by|
|000001d0| 20 73 76 61 78 2e 63 73 | 2e 63 6f 72 6e 65 6c 6c | svax.cs|.cornell|
|000001e0| 2e 65 64 75 20 28 35 2e | 36 31 2b 32 2f 31 2e 39 |.edu (5.|61+2/1.9|
|000001f0| 31 64 29 0a 09 69 64 20 | 41 41 32 30 33 32 34 3b |1d)..id |AA20324;|
|00000200| 20 53 61 74 2c 20 38 20 | 41 70 72 20 38 39 20 30 | Sat, 8 |Apr 89 0|
|00000210| 31 3a 35 31 3a 34 38 20 | 2d 30 34 30 30 0a 54 6f |1:51:48 |-0400.To|
|00000220| 3a 20 69 6e 66 6f 2d 6d | 61 63 2d 72 65 71 75 65 |: info-m|ac-reque|
|00000230| 73 74 40 73 75 6d 65 78 | 2d 61 69 6d 2e 73 74 61 |st@sumex|-aim.sta|
|00000240| 6e 66 6f 72 64 2e 65 64 | 75 0a 53 75 62 6a 65 63 |nford.ed|u.Subjec|
|00000250| 74 3a 20 52 65 3a 20 49 | 6e 66 6f 2d 4d 61 63 20 |t: Re: I|nfo-Mac |
|00000260| 44 69 67 65 73 74 20 56 | 37 20 23 36 35 0a 4e 65 |Digest V|7 #65.Ne|
|00000270| 77 73 67 72 6f 75 70 73 | 3a 20 63 6f 6d 70 2e 73 |wsgroups|: comp.s|
|00000280| 79 73 2e 6d 61 63 2e 64 | 69 67 65 73 74 0a 49 6e |ys.mac.d|igest.In|
|00000290| 2d 52 65 70 6c 79 2d 54 | 6f 3a 20 3c 38 39 30 34 |-Reply-T|o: <8904|
|000002a0| 30 37 32 33 32 36 2e 41 | 41 30 32 30 35 36 40 73 |072326.A|A02056@s|
|000002b0| 75 6d 65 78 2d 61 69 6d | 2e 73 74 61 6e 66 6f 72 |umex-aim|.stanfor|
|000002c0| 64 2e 65 64 75 3e 0a 4f | 72 67 61 6e 69 7a 61 74 |d.edu>.O|rganizat|
|000002d0| 69 6f 6e 3a 20 43 6f 72 | 6e 65 6c 6c 20 55 6e 69 |ion: Cor|nell Uni|
|000002e0| 76 2e 20 43 53 20 44 65 | 70 74 2c 20 49 74 68 61 |v. CS De|pt, Itha|
|000002f0| 63 61 20 4e 59 0a 43 63 | 3a 20 0a 0a 0a 55 6e 64 |ca NY.Cc|: ...Und|
|00000300| 65 72 20 22 61 64 6d 69 | 6e 69 73 74 72 69 76 69 |er "admi|nistrivi|
|00000310| 61 22 2c 20 79 6f 75 20 | 72 65 71 75 65 73 74 20 |a", you |request |
|00000320| 61 20 55 4e 49 58 20 75 | 74 69 6c 69 74 79 20 74 |a UNIX u|tility t|
|00000330| 6f 20 63 6f 6e 76 65 72 | 74 20 2a 2e 68 71 78 20 |o conver|t *.hqx |
|00000340| 74 6f 20 2a 2e 62 69 6e | 2e 0a 50 65 72 68 61 70 |to *.bin|..Perhap|
|00000350| 73 20 79 6f 75 20 77 6f | 75 6c 64 20 66 69 6e 64 |s you wo|uld find|
|00000360| 20 74 68 69 73 20 70 72 | 6f 67 72 61 6d 20 6f 66 | this pr|ogram of|
|00000370| 20 6d 69 6e 65 20 75 73 | 65 66 75 6c 2e 0a 0a 44 | mine us|eful...D|
|00000380| 6f 75 67 20 4d 6f 6f 72 | 65 20 28 6d 6f 6f 72 65 |oug Moor|e (moore|
|00000390| 40 63 73 2e 63 6f 72 6e | 65 6c 6c 2e 65 64 75 29 |@cs.corn|ell.edu)|
|000003a0| 0a 0a 23 21 2f 62 69 6e | 2f 73 68 0a 23 20 54 68 |..#!/bin|/sh.# Th|
|000003b0| 69 73 20 69 73 20 61 20 | 73 68 65 6c 6c 20 61 72 |is is a |shell ar|
|000003c0| 63 68 69 76 65 2c 20 6d | 65 61 6e 69 6e 67 3a 0a |chive, m|eaning:.|
|000003d0| 23 20 31 2e 20 52 65 6d | 6f 76 65 20 65 76 65 72 |# 1. Rem|ove ever|
|000003e0| 79 74 68 69 6e 67 20 61 | 62 6f 76 65 20 74 68 65 |ything a|bove the|
|000003f0| 20 23 21 20 2f 62 69 6e | 2f 73 68 20 6c 69 6e 65 | #! /bin|/sh line|
|00000400| 2e 0a 23 20 32 2e 20 53 | 61 76 65 20 74 68 65 20 |..# 2. S|ave the |
|00000410| 72 65 73 75 6c 74 69 6e | 67 20 74 65 78 74 20 69 |resultin|g text i|
|00000420| 6e 20 61 20 66 69 6c 65 | 2e 0a 23 20 33 2e 20 45 |n a file|..# 3. E|
|00000430| 78 65 63 75 74 65 20 74 | 68 65 20 66 69 6c 65 20 |xecute t|he file |
|00000440| 77 69 74 68 20 2f 62 69 | 6e 2f 73 68 20 28 6e 6f |with /bi|n/sh (no|
|00000450| 74 20 63 73 68 29 20 74 | 6f 20 63 72 65 61 74 65 |t csh) t|o create|
|00000460| 20 74 68 65 20 66 69 6c | 65 73 3a 0a 23 20 6d 63 | the fil|es:.# mc|
|00000470| 76 65 72 74 2e 63 0a 23 | 20 68 71 78 69 66 79 2e |vert.c.#| hqxify.|
|00000480| 63 0a 23 20 75 6e 70 61 | 63 6b 2e 63 0a 23 20 6d |c.# unpa|ck.c.# m|
|00000490| 61 63 74 79 70 65 73 2e | 68 0a 23 20 4d 61 6b 65 |actypes.|h.# Make|
|000004a0| 66 69 6c 65 0a 23 20 6d | 63 76 65 72 74 2e 31 0a |file.# m|cvert.1.|
|000004b0| 69 66 20 74 65 73 74 20 | 2d 66 20 6d 63 76 65 72 |if test |-f mcver|
|000004c0| 74 2e 63 0a 74 68 65 6e | 0a 65 63 68 6f 20 73 68 |t.c.then|.echo sh|
|000004d0| 61 72 3a 20 77 69 6c 6c | 20 6e 6f 74 20 6f 76 65 |ar: will| not ove|
|000004e0| 72 77 72 69 74 65 20 65 | 78 69 73 74 69 6e 67 20 |rwrite e|xisting |
|000004f0| 66 69 6c 65 20 22 20 6d | 63 76 65 72 74 2e 63 20 |file " m|cvert.c |
|00000500| 22 0a 65 6c 73 65 0a 63 | 61 74 20 3e 6d 63 76 65 |".else.c|at >mcve|
|00000510| 72 74 2e 63 20 3c 3c 27 | 2d 2d 2d 2d 2d 2d 20 45 |rt.c <<'|------ E|
|00000520| 4f 46 20 2d 2d 2d 2d 2d | 2d 27 0a 2f 2a 20 6d 63 |OF -----|-'./* mc|
|00000530| 76 65 72 74 2e 63 20 2d | 20 76 65 72 73 69 6f 6e |vert.c -| version|
|00000540| 20 31 2e 30 20 2d 20 4d | 61 72 63 68 20 33 30 2c | 1.0 - M|arch 30,|
|00000550| 20 31 39 38 39 0a 20 2a | 20 57 72 69 74 74 65 6e | 1989. *| Written|
|00000560| 20 62 79 20 44 6f 75 67 | 20 4d 6f 6f 72 65 20 2d | by Doug| Moore -|
|00000570| 20 43 6f 72 6e 65 6c 6c | 20 55 6e 69 76 65 72 73 | Cornell| Univers|
|00000580| 69 74 79 20 2d 20 6d 6f | 6f 72 65 40 63 73 2e 63 |ity - mo|ore@cs.c|
|00000590| 6f 72 6e 65 6c 6c 2e 65 | 64 75 20 2d 20 41 70 72 |ornell.e|du - Apr|
|000005a0| 69 6c 20 27 38 37 0a 20 | 2a 20 53 75 6e 20 62 75 |il '87. |* Sun bu|
|000005b0| 67 20 66 69 78 65 73 2c | 20 61 73 73 6f 72 74 65 |g fixes,| assorte|
|000005c0| 64 20 73 74 75 66 66 20 | 2d 20 4a 69 6d 20 53 61 |d stuff |- Jim Sa|
|000005d0| 73 61 6b 69 2c 20 4d 61 | 72 63 68 20 27 38 39 0a |saki, Ma|rch '89.|
|000005e0| 20 2a 0a 20 2a 20 54 68 | 69 73 20 70 72 6f 67 72 | *. * Th|is progr|
|000005f0| 61 6d 20 6d 61 79 20 62 | 65 20 66 72 65 65 6c 79 |am may b|e freely|
|00000600| 20 64 69 73 74 72 69 62 | 75 74 65 64 20 66 6f 72 | distrib|uted for|
|00000610| 20 6e 6f 6e 2d 70 72 6f | 66 69 74 20 70 75 72 70 | non-pro|fit purp|
|00000620| 6f 73 65 73 2e 20 20 49 | 74 20 6d 61 79 20 6e 6f |oses. I|t may no|
|00000630| 74 0a 20 2a 20 62 65 20 | 73 6f 6c 64 2c 20 62 79 |t. * be |sold, by|
|00000640| 20 69 74 73 65 6c 66 20 | 6f 72 20 61 73 20 70 61 | itself |or as pa|
|00000650| 72 74 20 6f 66 20 61 20 | 63 6f 6c 6c 65 63 74 69 |rt of a |collecti|
|00000660| 6f 6e 20 6f 66 20 73 6f | 66 74 77 61 72 65 2e 20 |on of so|ftware. |
|00000670| 20 49 74 20 6d 61 79 20 | 62 65 20 66 72 65 65 6c | It may |be freel|
|00000680| 79 0a 20 2a 20 6d 6f 64 | 69 66 69 65 64 20 61 73 |y. * mod|ified as|
|00000690| 20 6c 6f 6e 67 20 61 73 | 20 6e 6f 20 6d 6f 64 69 | long as| no modi|
|000006a0| 66 69 65 64 20 76 65 72 | 73 69 6f 6e 20 69 73 20 |fied ver|sion is |
|000006b0| 64 69 73 74 72 69 62 75 | 74 65 64 2e 20 20 4d 6f |distribu|ted. Mo|
|000006c0| 64 69 66 69 63 61 74 69 | 6f 6e 73 20 6f 66 0a 20 |dificati|ons of. |
|000006d0| 2a 20 69 6e 74 65 72 65 | 73 74 20 74 6f 20 61 6c |* intere|st to al|
|000006e0| 6c 20 63 61 6e 20 62 65 | 20 69 6e 63 6f 72 70 6f |l can be| incorpo|
|000006f0| 72 61 74 65 64 20 69 6e | 74 6f 20 74 68 65 20 70 |rated in|to the p|
|00000700| 72 6f 67 72 61 6d 20 62 | 79 20 73 65 6e 64 69 6e |rogram b|y sendin|
|00000710| 67 20 74 68 65 6d 20 74 | 6f 20 6d 65 0a 20 2a 20 |g them t|o me. * |
|00000720| 66 6f 72 20 64 69 73 74 | 72 69 62 75 74 69 6f 6e |for dist|ribution|
|00000730| 2e 20 20 50 61 72 74 73 | 20 6f 66 20 74 68 65 20 |. Parts| of the |
|00000740| 63 6f 64 65 20 63 61 6e | 20 62 65 20 75 73 65 64 |code can| be used|
|00000750| 20 69 6e 20 6f 74 68 65 | 72 20 70 72 6f 67 72 61 | in othe|r progra|
|00000760| 6d 73 2e 20 20 49 20 61 | 6d 20 6e 6f 74 0a 20 2a |ms. I a|m not. *|
|00000770| 20 72 65 73 70 6f 6e 73 | 69 62 6c 65 20 66 6f 72 | respons|ible for|
|00000780| 20 61 6e 79 20 64 61 6d | 61 67 65 20 63 61 75 73 | any dam|age caus|
|00000790| 65 64 20 62 79 20 74 68 | 69 73 20 70 72 6f 67 72 |ed by th|is progr|
|000007a0| 61 6d 2e 20 20 49 20 68 | 6f 70 65 20 79 6f 75 20 |am. I h|ope you |
|000007b0| 65 6e 6a 6f 79 20 69 74 | 2e 0a 20 2a 2f 0a 0a 23 |enjoy it|.. */..#|
|000007c0| 69 6e 63 6c 75 64 65 20 | 22 6d 61 63 74 79 70 65 |include |"mactype|
|000007d0| 73 2e 68 22 0a 0a 23 64 | 65 66 69 6e 65 20 48 51 |s.h"..#d|efine HQ|
|000007e0| 58 20 30 0a 23 64 65 66 | 69 6e 65 20 54 45 58 54 |X 0.#def|ine TEXT|
|000007f0| 20 31 0a 23 64 65 66 69 | 6e 65 20 44 41 54 41 20 | 1.#defi|ne DATA |
|00000800| 32 0a 23 64 65 66 69 6e | 65 20 52 53 52 43 20 33 |2.#defin|e RSRC 3|
|00000810| 0a 23 64 65 66 69 6e 65 | 20 46 4f 52 57 41 52 44 |.#define| FORWARD|
|00000820| 53 20 30 0a 23 64 65 66 | 69 6e 65 20 42 41 43 4b |S 0.#def|ine BACK|
|00000830| 57 41 52 44 53 20 31 0a | 0a 46 49 4c 45 20 2a 76 |WARDS 1.|.FILE *v|
|00000840| 65 72 62 6f 73 65 3b 0a | 63 68 61 72 20 2a 2a 68 |erbose;.|char **h|
|00000850| 71 78 6e 61 6d 65 73 2c | 20 2a 2a 68 71 78 6e 61 |qxnames,| **hqxna|
|00000860| 6d 65 73 5f 6c 65 66 74 | 3b 0a 63 68 61 72 20 2a |mes_left|;.char *|
|00000870| 64 69 72 2c 20 2a 65 78 | 74 2c 20 2a 74 65 78 74 |dir, *ex|t, *text|
|00000880| 5f 61 75 74 68 6f 72 3b | 0a 63 68 61 72 20 2a 6d |_author;|.char *m|
|00000890| 61 78 6c 69 6e 65 73 5f | 73 74 72 3b 0a 69 6e 74 |axlines_|str;.int|
|000008a0| 20 6d 61 78 6c 69 6e 65 | 73 3b 0a 0a 6d 61 69 6e | maxline|s;..main|
|000008b0| 28 61 72 67 63 2c 20 61 | 72 67 76 29 0a 69 6e 74 |(argc, a|rgv).int|
|000008c0| 20 61 72 67 63 3b 0a 63 | 68 61 72 20 2a 2a 61 72 | argc;.c|har **ar|
|000008d0| 67 76 3b 0a 7b 20 20 20 | 63 68 61 72 20 2a 66 6c |gv;.{ |char *fl|
|000008e0| 61 67 73 2c 20 2a 67 65 | 74 65 6e 76 28 29 3b 0a |ags, *ge|tenv();.|
|000008f0| 20 20 20 20 69 6e 74 20 | 64 69 72 65 63 74 69 6f | int |directio|
|00000900| 6e 2c 20 6d 6f 64 65 2c | 20 75 6e 70 69 74 5f 66 |n, mode,| unpit_f|
|00000910| 6c 61 67 3b 0a 0a 20 20 | 20 20 61 72 67 76 2b 2b |lag;.. | argv++|
|00000920| 3b 0a 20 20 20 20 61 72 | 67 63 2d 2d 3b 0a 20 20 |;. ar|gc--;. |
|00000930| 20 20 76 65 72 62 6f 73 | 65 20 3d 20 73 74 64 65 | verbos|e = stde|
|00000940| 72 72 3b 0a 20 20 20 20 | 64 69 72 65 63 74 69 6f |rr;. |directio|
|00000950| 6e 20 3d 20 46 4f 52 57 | 41 52 44 53 3b 0a 20 20 |n = FORW|ARDS;. |
|00000960| 20 20 6d 6f 64 65 20 3d | 20 48 51 58 3b 0a 20 20 | mode =| HQX;. |
|00000970| 20 20 75 6e 70 69 74 5f | 66 6c 61 67 20 3d 20 30 | unpit_|flag = 0|
|00000980| 3b 0a 0a 20 20 20 20 69 | 66 20 28 28 74 65 78 74 |;.. i|f ((text|
|00000990| 5f 61 75 74 68 6f 72 20 | 3d 20 67 65 74 65 6e 76 |_author |= getenv|
|000009a0| 28 22 4d 41 43 5f 45 44 | 49 54 4f 52 22 29 29 20 |("MAC_ED|ITOR")) |
|000009b0| 20 20 20 3d 3d 20 4e 55 | 4c 4c 29 20 20 20 20 74 | == NU|LL) t|
|000009c0| 65 78 74 5f 61 75 74 68 | 6f 72 20 3d 20 22 4d 41 |ext_auth|or = "MA|
|000009d0| 43 41 22 3b 0a 20 20 20 | 20 69 66 20 28 28 65 78 |CA";. | if ((ex|
|000009e0| 74 20 3d 20 20 20 20 20 | 20 20 20 20 67 65 74 65 |t = | gete|
|000009f0| 6e 76 28 22 4d 41 43 5f | 45 58 54 22 29 29 20 20 |nv("MAC_|EXT")) |
|00000a00| 20 20 20 20 20 3d 3d 20 | 4e 55 4c 4c 29 20 20 20 | == |NULL) |
|00000a10| 20 65 78 74 20 3d 20 22 | 2e 62 69 6e 22 3b 0a 20 | ext = "|.bin";. |
|00000a20| 20 20 20 69 66 20 28 28 | 64 69 72 20 3d 20 20 20 | if ((|dir = |
|00000a30| 20 20 20 20 20 20 67 65 | 74 65 6e 76 28 22 4d 41 | ge|tenv("MA|
|00000a40| 43 5f 44 4c 4f 41 44 5f | 44 49 52 22 29 29 20 3d |C_DLOAD_|DIR")) =|
|00000a50| 3d 20 4e 55 4c 4c 29 20 | 20 20 20 64 69 72 20 3d |= NULL) | dir =|
|00000a60| 20 22 2e 22 3b 0a 20 20 | 20 20 69 66 20 28 28 6d | ".";. | if ((m|
|00000a70| 61 78 6c 69 6e 65 73 5f | 73 74 72 20 3d 20 67 65 |axlines_|str = ge|
|00000a80| 74 65 6e 76 28 22 4d 41 | 43 5f 4c 49 4e 45 5f 4c |tenv("MA|C_LINE_L|
|00000a90| 49 4d 49 54 22 29 29 20 | 3d 3d 20 4e 55 4c 4c 29 |IMIT")) |== NULL)|
|00000aa0| 20 20 6d 61 78 6c 69 6e | 65 73 20 3d 20 32 30 30 | maxlin|es = 200|
|00000ab0| 30 3b 0a 20 20 20 20 65 | 6c 73 65 09 09 09 09 09 |0;. e|lse.....|
|00000ac0| 09 09 09 09 09 20 6d 61 | 78 6c 69 6e 65 73 20 3d |..... ma|xlines =|
|00000ad0| 20 61 74 6f 69 28 6d 61 | 78 6c 69 6e 65 73 5f 73 | atoi(ma|xlines_s|
|00000ae0| 74 72 29 3b 0a 20 20 20 | 20 0a 20 20 20 20 2f 2a |tr);. | . /*|
|00000af0| 20 4d 61 6b 65 20 63 6f | 6d 6d 61 6e 64 20 6c 69 | Make co|mmand li|
|00000b00| 6e 65 20 61 72 67 75 6d | 65 6e 74 73 20 67 6c 6f |ne argum|ents glo|
|00000b10| 62 61 6c 6c 79 20 61 63 | 63 65 73 73 69 62 6c 65 |bally ac|cessible|
|00000b20| 20 2a 2f 0a 20 20 20 20 | 68 71 78 6e 61 6d 65 73 | */. |hqxnames|
|00000b30| 20 3d 20 28 63 68 61 72 | 20 2a 2a 29 20 63 61 6c | = (char| **) cal|
|00000b40| 6c 6f 63 28 61 72 67 63 | 2b 31 2c 20 73 69 7a 65 |loc(argc|+1, size|
|00000b50| 6f 66 28 63 68 61 72 20 | 2a 29 29 3b 0a 20 20 20 |of(char |*));. |
|00000b60| 20 68 71 78 6e 61 6d 65 | 73 5f 6c 65 66 74 20 3d | hqxname|s_left =|
|00000b70| 20 68 71 78 6e 61 6d 65 | 73 3b 0a 20 20 20 20 77 | hqxname|s;. w|
|00000b80| 68 69 6c 65 20 28 61 72 | 67 63 2d 2d 29 20 20 2a |hile (ar|gc--) *|
|00000b90| 68 71 78 6e 61 6d 65 73 | 5f 6c 65 66 74 2b 2b 20 |hqxnames|_left++ |
|00000ba0| 3d 20 2a 61 72 67 76 2b | 2b 3b 0a 20 20 20 20 2a |= *argv+|+;. *|
|00000bb0| 68 71 78 6e 61 6d 65 73 | 5f 6c 65 66 74 20 3d 20 |hqxnames|_left = |
|00000bc0| 22 2d 22 3b 0a 20 20 20 | 20 68 71 78 6e 61 6d 65 |"-";. | hqxname|
|00000bd0| 73 5f 6c 65 66 74 20 3d | 20 68 71 78 6e 61 6d 65 |s_left =| hqxname|
|00000be0| 73 3b 0a 0a 20 20 20 20 | 77 68 69 6c 65 20 28 73 |s;.. |while (s|
|00000bf0| 74 72 63 6d 70 28 2a 68 | 71 78 6e 61 6d 65 73 5f |trcmp(*h|qxnames_|
|00000c00| 6c 65 66 74 2c 20 22 2d | 22 29 29 20 7b 0a 20 20 |left, "-|")) {. |
|00000c10| 20 20 20 20 20 20 69 66 | 20 28 68 71 78 6e 61 6d | if| (hqxnam|
|00000c20| 65 73 5f 6c 65 66 74 5b | 30 5d 5b 30 5d 20 3d 3d |es_left[|0][0] ==|
|00000c30| 20 27 2d 27 29 20 7b 0a | 20 20 20 20 20 20 20 20 | '-') {.| |
|00000c40| 20 20 20 20 66 6c 61 67 | 73 20 3d 20 2a 68 71 78 | flag|s = *hqx|
|00000c50| 6e 61 6d 65 73 5f 6c 65 | 66 74 2b 2b 3b 0a 20 20 |names_le|ft++;. |
|00000c60| 20 20 20 20 20 20 20 20 | 20 20 77 68 69 6c 65 20 | | while |
|00000c70| 28 2a 2b 2b 66 6c 61 67 | 73 29 0a 20 20 20 20 20 |(*++flag|s). |
|00000c80| 20 20 20 20 20 20 20 20 | 20 20 20 73 77 69 74 63 | | switc|
|00000c90| 68 20 28 2a 66 6c 61 67 | 73 29 20 7b 0a 20 20 20 |h (*flag|s) {. |
|00000ca0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 63 61 73 | | cas|
|00000cb0| 65 20 27 78 27 3a 0a 20 | 20 20 20 20 20 20 20 20 |e 'x':. | |
|00000cc0| 20 20 20 20 20 20 20 20 | 20 20 20 6d 6f 64 65 20 | | mode |
|00000cd0| 3d 20 48 51 58 3b 0a 20 | 20 20 20 20 20 20 20 20 |= HQX;. | |
|00000ce0| 20 20 20 20 20 20 20 20 | 20 20 20 62 72 65 61 6b | | break|
|00000cf0| 3b 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |;. | |
|00000d00| 20 20 63 61 73 65 20 27 | 75 27 3a 0a 20 20 20 20 | case '|u':. |
|00000d10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000d20| 6d 6f 64 65 20 3d 20 54 | 45 58 54 3b 0a 20 20 20 |mode = T|EXT;. |
|00000d30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000d40| 20 62 72 65 61 6b 3b 0a | 20 20 20 20 20 20 20 20 | break;.| |
|00000d50| 20 20 20 20 20 20 20 20 | 63 61 73 65 20 27 64 27 | |case 'd'|
|00000d60| 3a 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |:. | |
|00000d70| 20 20 20 20 20 20 6d 6f | 64 65 20 3d 20 44 41 54 | mo|de = DAT|
|00000d80| 41 3b 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |A;. | |
|00000d90| 20 20 20 20 20 20 20 62 | 72 65 61 6b 3b 0a 20 20 | b|reak;. |
|00000da0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 63 61 | | ca|
|00000db0| 73 65 20 27 72 27 3a 0a | 20 20 20 20 20 20 20 20 |se 'r':.| |
|00000dc0| 20 20 20 20 20 20 20 20 | 20 20 20 20 6d 6f 64 65 | | mode|
|00000dd0| 20 3d 20 52 53 52 43 3b | 0a 20 20 20 20 20 20 20 | = RSRC;|. |
|00000de0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 62 72 65 | | bre|
|00000df0| 61 6b 3b 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |ak;. | |
|00000e00| 20 20 20 20 63 61 73 65 | 20 27 44 27 3a 0a 20 20 | case| 'D':. |
|00000e10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000e20| 20 20 64 69 72 65 63 74 | 69 6f 6e 20 3d 20 46 4f | direct|ion = FO|
|00000e30| 52 57 41 52 44 53 3b 0a | 20 20 20 20 20 20 20 20 |RWARDS;.| |
|00000e40| 20 20 20 20 20 20 20 20 | 20 20 20 20 62 72 65 61 | | brea|
|00000e50| 6b 3b 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |k;. | |
|00000e60| 20 20 20 63 61 73 65 20 | 27 55 27 3a 0a 20 20 20 | case |'U':. |
|00000e70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000e80| 20 64 69 72 65 63 74 69 | 6f 6e 20 3d 20 42 41 43 | directi|on = BAC|
|00000e90| 4b 57 41 52 44 53 3b 0a | 20 20 20 20 20 20 20 20 |KWARDS;.| |
|00000ea0| 20 20 20 20 20 20 20 20 | 20 20 20 20 62 72 65 61 | | brea|
|00000eb0| 6b 3b 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |k;. | |
|00000ec0| 20 20 20 63 61 73 65 20 | 27 71 27 3a 0a 20 20 20 | case |'q':. |
|00000ed0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000ee0| 20 75 6e 70 69 74 5f 66 | 6c 61 67 20 3d 20 30 3b | unpit_f|lag = 0;|
|00000ef0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00000f00| 20 20 20 20 20 62 72 65 | 61 6b 3b 0a 20 20 20 20 | bre|ak;. |
|00000f10| 20 20 20 20 20 20 20 20 | 20 20 20 20 63 61 73 65 | | case|
|00000f20| 20 27 70 27 3a 0a 20 20 | 20 20 20 20 20 20 20 20 | 'p':. | |
|00000f30| 20 20 20 20 20 20 20 20 | 20 20 75 6e 70 69 74 5f | | unpit_|
|00000f40| 66 6c 61 67 20 3d 20 31 | 3b 0a 20 20 20 20 20 20 |flag = 1|;. |
|00000f50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 62 72 | | br|
|00000f60| 65 61 6b 3b 0a 20 20 20 | 20 20 20 20 20 20 20 20 |eak;. | |
|00000f70| 20 20 20 20 20 63 61 73 | 65 20 27 73 27 3a 0a 20 | cas|e 's':. |
|00000f80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000f90| 20 20 20 76 65 72 62 6f | 73 65 20 3d 20 66 6f 70 | verbo|se = fop|
|00000fa0| 65 6e 28 22 2f 64 65 76 | 2f 6e 75 6c 6c 22 2c 20 |en("/dev|/null", |
|00000fb0| 22 77 22 29 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |"w");. | |
|00000fc0| 20 20 20 20 20 20 20 20 | 20 20 62 72 65 61 6b 3b | | break;|
|00000fd0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00000fe0| 20 63 61 73 65 20 27 76 | 27 3a 0a 20 20 20 20 20 | case 'v|':. |
|00000ff0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 76 | | v|
|00001000| 65 72 62 6f 73 65 20 3d | 20 73 74 64 65 72 72 3b |erbose =| stderr;|
|00001010| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00001020| 20 20 20 20 20 62 72 65 | 61 6b 3b 0a 20 20 20 20 | bre|ak;. |
|00001030| 20 20 20 20 20 20 20 20 | 20 20 20 20 64 65 66 61 | | defa|
|00001040| 75 6c 74 3a 0a 20 20 20 | 20 20 20 20 20 20 20 20 |ult:. | |
|00001050| 20 20 20 20 20 20 20 20 | 20 65 72 72 6f 72 28 0a | | error(.|
|00001060| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001070| 20 20 20 20 22 55 73 61 | 67 65 3a 20 6d 63 76 65 | "Usa|ge: mcve|
|00001080| 72 74 20 5b 20 2d 5b 72 | 7c 64 7c 75 7c 78 5d 20 |rt [ -[r||d|u|x] |
|00001090| 5b 44 7c 55 5d 20 5b 70 | 7c 71 5d 20 5b 73 7c 76 |[D|U] [p||q] [s|v|
|000010a0| 5d 20 5d 20 66 69 6c 65 | 6e 61 6d 65 2e 2e 2e 22 |] ] file|name..."|
|000010b0| 2c 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |,. | |
|000010c0| 20 20 20 20 20 20 4e 55 | 4c 4c 29 3b 0a 20 20 20 | NU|LL);. |
|000010d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000010e0| 20 7d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 7d | }. | }|
|000010f0| 0a 0a 20 20 20 20 20 20 | 20 20 69 66 20 28 64 69 |.. | if (di|
|00001100| 72 65 63 74 69 6f 6e 20 | 3d 3d 20 42 41 43 4b 57 |rection |== BACKW|
|00001110| 41 52 44 53 29 0a 20 20 | 20 20 20 20 20 20 20 20 |ARDS). | |
|00001120| 20 20 69 66 20 28 6d 6f | 64 65 20 3d 3d 20 48 51 | if (mo|de == HQ|
|00001130| 58 20 26 26 20 75 6e 70 | 69 74 5f 66 6c 61 67 29 |X && unp|it_flag)|
|00001140| 20 72 65 5f 68 71 78 28 | 29 3b 2f 2a 20 6e 6f 20 | re_hqx(|);/* no |
|00001150| 72 65 5f 70 69 74 28 29 | 20 79 65 74 20 2a 2f 0a |re_pit()| yet */.|
|00001160| 20 20 20 20 20 20 20 20 | 20 20 20 20 65 6c 73 65 | | else|
|00001170| 20 69 66 20 28 6d 6f 64 | 65 20 3d 3d 20 48 51 58 | if (mod|e == HQX|
|00001180| 29 20 72 65 5f 68 71 78 | 28 29 3b 0a 20 20 20 20 |) re_hqx|();. |
|00001190| 20 20 20 20 20 20 20 20 | 65 6c 73 65 20 72 65 5f | |else re_|
|000011a0| 6f 74 68 65 72 28 6d 6f | 64 65 29 3b 0a 20 20 20 |other(mo|de);. |
|000011b0| 20 20 20 20 20 65 6c 73 | 65 0a 20 20 20 20 20 20 | els|e. |
|000011c0| 20 20 20 20 20 20 69 66 | 20 28 6d 6f 64 65 20 3d | if| (mode =|
|000011d0| 3d 20 48 51 58 29 20 75 | 6e 5f 68 71 78 28 75 6e |= HQX) u|n_hqx(un|
|000011e0| 70 69 74 5f 66 6c 61 67 | 29 3b 0a 20 20 20 20 20 |pit_flag|);. |
|000011f0| 20 20 20 20 20 20 20 65 | 6c 73 65 20 75 6e 5f 6f | e|lse un_o|
|00001200| 74 68 65 72 28 6d 6f 64 | 65 29 3b 0a 20 20 20 20 |ther(mod|e);. |
|00001210| 20 20 20 20 7d 0a 20 20 | 20 20 7d 0a 0a 2f 2a 20 | }. | }../* |
|00001220| 41 6e 20 61 72 72 61 79 | 20 75 73 65 66 75 6c 20 |An array| useful |
|00001230| 66 6f 72 20 43 52 43 20 | 63 61 6c 63 75 6c 61 74 |for CRC |calculat|
|00001240| 69 6f 6e 73 20 74 68 61 | 74 20 75 73 65 20 30 78 |ions tha|t use 0x|
|00001250| 31 30 32 31 20 61 73 20 | 74 68 65 20 22 73 65 65 |1021 as |the "see|
|00001260| 64 22 20 2a 2f 0a 77 6f | 72 64 20 6d 61 67 69 63 |d" */.wo|rd magic|
|00001270| 5b 5d 20 3d 20 7b 0a 20 | 20 20 20 30 78 30 30 30 |[] = {. | 0x000|
|00001280| 30 2c 20 20 30 78 31 30 | 32 31 2c 20 20 30 78 32 |0, 0x10|21, 0x2|
|00001290| 30 34 32 2c 20 20 30 78 | 33 30 36 33 2c 20 20 30 |042, 0x|3063, 0|
|000012a0| 78 34 30 38 34 2c 20 20 | 30 78 35 30 61 35 2c 20 |x4084, |0x50a5, |
|000012b0| 20 30 78 36 30 63 36 2c | 20 20 30 78 37 30 65 37 | 0x60c6,| 0x70e7|
|000012c0| 2c 0a 20 20 20 20 30 78 | 38 31 30 38 2c 20 20 30 |,. 0x|8108, 0|
|000012d0| 78 39 31 32 39 2c 20 20 | 30 78 61 31 34 61 2c 20 |x9129, |0xa14a, |
|000012e0| 20 30 78 62 31 36 62 2c | 20 20 30 78 63 31 38 63 | 0xb16b,| 0xc18c|
|000012f0| 2c 20 20 30 78 64 31 61 | 64 2c 20 20 30 78 65 31 |, 0xd1a|d, 0xe1|
|00001300| 63 65 2c 20 20 30 78 66 | 31 65 66 2c 0a 20 20 20 |ce, 0xf|1ef,. |
|00001310| 20 30 78 31 32 33 31 2c | 20 20 30 78 30 32 31 30 | 0x1231,| 0x0210|
|00001320| 2c 20 20 30 78 33 32 37 | 33 2c 20 20 30 78 32 32 |, 0x327|3, 0x22|
|00001330| 35 32 2c 20 20 30 78 35 | 32 62 35 2c 20 20 30 78 |52, 0x5|2b5, 0x|
|00001340| 34 32 39 34 2c 20 20 30 | 78 37 32 66 37 2c 20 20 |4294, 0|x72f7, |
|00001350| 30 78 36 32 64 36 2c 0a | 20 20 20 20 30 78 39 33 |0x62d6,.| 0x93|
|00001360| 33 39 2c 20 20 30 78 38 | 33 31 38 2c 20 20 30 78 |39, 0x8|318, 0x|
|00001370| 62 33 37 62 2c 20 20 30 | 78 61 33 35 61 2c 20 20 |b37b, 0|xa35a, |
|00001380| 30 78 64 33 62 64 2c 20 | 20 30 78 63 33 39 63 2c |0xd3bd, | 0xc39c,|
|00001390| 20 20 30 78 66 33 66 66 | 2c 20 20 30 78 65 33 64 | 0xf3ff|, 0xe3d|
|000013a0| 65 2c 0a 20 20 20 20 30 | 78 32 34 36 32 2c 20 20 |e,. 0|x2462, |
|000013b0| 30 78 33 34 34 33 2c 20 | 20 30 78 30 34 32 30 2c |0x3443, | 0x0420,|
|000013c0| 20 20 30 78 31 34 30 31 | 2c 20 20 30 78 36 34 65 | 0x1401|, 0x64e|
|000013d0| 36 2c 20 20 30 78 37 34 | 63 37 2c 20 20 30 78 34 |6, 0x74|c7, 0x4|
|000013e0| 34 61 34 2c 20 20 30 78 | 35 34 38 35 2c 0a 20 20 |4a4, 0x|5485,. |
|000013f0| 20 20 30 78 61 35 36 61 | 2c 20 20 30 78 62 35 34 | 0xa56a|, 0xb54|
|00001400| 62 2c 20 20 30 78 38 35 | 32 38 2c 20 20 30 78 39 |b, 0x85|28, 0x9|
|00001410| 35 30 39 2c 20 20 30 78 | 65 35 65 65 2c 20 20 30 |509, 0x|e5ee, 0|
|00001420| 78 66 35 63 66 2c 20 20 | 30 78 63 35 61 63 2c 20 |xf5cf, |0xc5ac, |
|00001430| 20 30 78 64 35 38 64 2c | 0a 20 20 20 20 30 78 33 | 0xd58d,|. 0x3|
|00001440| 36 35 33 2c 20 20 30 78 | 32 36 37 32 2c 20 20 30 |653, 0x|2672, 0|
|00001450| 78 31 36 31 31 2c 20 20 | 30 78 30 36 33 30 2c 20 |x1611, |0x0630, |
|00001460| 20 30 78 37 36 64 37 2c | 20 20 30 78 36 36 66 36 | 0x76d7,| 0x66f6|
|00001470| 2c 20 20 30 78 35 36 39 | 35 2c 20 20 30 78 34 36 |, 0x569|5, 0x46|
|00001480| 62 34 2c 0a 20 20 20 20 | 30 78 62 37 35 62 2c 20 |b4,. |0xb75b, |
|00001490| 20 30 78 61 37 37 61 2c | 20 20 30 78 39 37 31 39 | 0xa77a,| 0x9719|
|000014a0| 2c 20 20 30 78 38 37 33 | 38 2c 20 20 30 78 66 37 |, 0x873|8, 0xf7|
|000014b0| 64 66 2c 20 20 30 78 65 | 37 66 65 2c 20 20 30 78 |df, 0xe|7fe, 0x|
|000014c0| 64 37 39 64 2c 20 20 30 | 78 63 37 62 63 2c 0a 20 |d79d, 0|xc7bc,. |
|000014d0| 20 20 20 30 78 34 38 63 | 34 2c 20 20 30 78 35 38 | 0x48c|4, 0x58|
|000014e0| 65 35 2c 20 20 30 78 36 | 38 38 36 2c 20 20 30 78 |e5, 0x6|886, 0x|
|000014f0| 37 38 61 37 2c 20 20 30 | 78 30 38 34 30 2c 20 20 |78a7, 0|x0840, |
|00001500| 30 78 31 38 36 31 2c 20 | 20 30 78 32 38 30 32 2c |0x1861, | 0x2802,|
|00001510| 20 20 30 78 33 38 32 33 | 2c 0a 20 20 20 20 30 78 | 0x3823|,. 0x|
|00001520| 63 39 63 63 2c 20 20 30 | 78 64 39 65 64 2c 20 20 |c9cc, 0|xd9ed, |
|00001530| 30 78 65 39 38 65 2c 20 | 20 30 78 66 39 61 66 2c |0xe98e, | 0xf9af,|
|00001540| 20 20 30 78 38 39 34 38 | 2c 20 20 30 78 39 39 36 | 0x8948|, 0x996|
|00001550| 39 2c 20 20 30 78 61 39 | 30 61 2c 20 20 30 78 62 |9, 0xa9|0a, 0xb|
|00001560| 39 32 62 2c 0a 20 20 20 | 20 30 78 35 61 66 35 2c |92b,. | 0x5af5,|
|00001570| 20 20 30 78 34 61 64 34 | 2c 20 20 30 78 37 61 62 | 0x4ad4|, 0x7ab|
|00001580| 37 2c 20 20 30 78 36 61 | 39 36 2c 20 20 30 78 31 |7, 0x6a|96, 0x1|
|00001590| 61 37 31 2c 20 20 30 78 | 30 61 35 30 2c 20 20 30 |a71, 0x|0a50, 0|
|000015a0| 78 33 61 33 33 2c 20 20 | 30 78 32 61 31 32 2c 0a |x3a33, |0x2a12,.|
|000015b0| 20 20 20 20 30 78 64 62 | 66 64 2c 20 20 30 78 63 | 0xdb|fd, 0xc|
|000015c0| 62 64 63 2c 20 20 30 78 | 66 62 62 66 2c 20 20 30 |bdc, 0x|fbbf, 0|
|000015d0| 78 65 62 39 65 2c 20 20 | 30 78 39 62 37 39 2c 20 |xeb9e, |0x9b79, |
|000015e0| 20 30 78 38 62 35 38 2c | 20 20 30 78 62 62 33 62 | 0x8b58,| 0xbb3b|
|000015f0| 2c 20 20 30 78 61 62 31 | 61 2c 0a 20 20 20 20 30 |, 0xab1|a,. 0|
|00001600| 78 36 63 61 36 2c 20 20 | 30 78 37 63 38 37 2c 20 |x6ca6, |0x7c87, |
|00001610| 20 30 78 34 63 65 34 2c | 20 20 30 78 35 63 63 35 | 0x4ce4,| 0x5cc5|
|00001620| 2c 20 20 30 78 32 63 32 | 32 2c 20 20 30 78 33 63 |, 0x2c2|2, 0x3c|
|00001630| 30 33 2c 20 20 30 78 30 | 63 36 30 2c 20 20 30 78 |03, 0x0|c60, 0x|
|00001640| 31 63 34 31 2c 0a 20 20 | 20 20 30 78 65 64 61 65 |1c41,. | 0xedae|
|00001650| 2c 20 20 30 78 66 64 38 | 66 2c 20 20 30 78 63 64 |, 0xfd8|f, 0xcd|
|00001660| 65 63 2c 20 20 30 78 64 | 64 63 64 2c 20 20 30 78 |ec, 0xd|dcd, 0x|
|00001670| 61 64 32 61 2c 20 20 30 | 78 62 64 30 62 2c 20 20 |ad2a, 0|xbd0b, |
|00001680| 30 78 38 64 36 38 2c 20 | 20 30 78 39 64 34 39 2c |0x8d68, | 0x9d49,|
|00001690| 0a 20 20 20 20 30 78 37 | 65 39 37 2c 20 20 30 78 |. 0x7|e97, 0x|
|000016a0| 36 65 62 36 2c 20 20 30 | 78 35 65 64 35 2c 20 20 |6eb6, 0|x5ed5, |
|000016b0| 30 78 34 65 66 34 2c 20 | 20 30 78 33 65 31 33 2c |0x4ef4, | 0x3e13,|
|000016c0| 20 20 30 78 32 65 33 32 | 2c 20 20 30 78 31 65 35 | 0x2e32|, 0x1e5|
|000016d0| 31 2c 20 20 30 78 30 65 | 37 30 2c 0a 20 20 20 20 |1, 0x0e|70,. |
|000016e0| 30 78 66 66 39 66 2c 20 | 20 30 78 65 66 62 65 2c |0xff9f, | 0xefbe,|
|000016f0| 20 20 30 78 64 66 64 64 | 2c 20 20 30 78 63 66 66 | 0xdfdd|, 0xcff|
|00001700| 63 2c 20 20 30 78 62 66 | 31 62 2c 20 20 30 78 61 |c, 0xbf|1b, 0xa|
|00001710| 66 33 61 2c 20 20 30 78 | 39 66 35 39 2c 20 20 30 |f3a, 0x|9f59, 0|
|00001720| 78 38 66 37 38 2c 0a 20 | 20 20 20 30 78 39 31 38 |x8f78,. | 0x918|
|00001730| 38 2c 20 20 30 78 38 31 | 61 39 2c 20 20 30 78 62 |8, 0x81|a9, 0xb|
|00001740| 31 63 61 2c 20 20 30 78 | 61 31 65 62 2c 20 20 30 |1ca, 0x|a1eb, 0|
|00001750| 78 64 31 30 63 2c 20 20 | 30 78 63 31 32 64 2c 20 |xd10c, |0xc12d, |
|00001760| 20 30 78 66 31 34 65 2c | 20 20 30 78 65 31 36 66 | 0xf14e,| 0xe16f|
|00001770| 2c 0a 20 20 20 20 30 78 | 31 30 38 30 2c 20 20 30 |,. 0x|1080, 0|
|00001780| 78 30 30 61 31 2c 20 20 | 30 78 33 30 63 32 2c 20 |x00a1, |0x30c2, |
|00001790| 20 30 78 32 30 65 33 2c | 20 20 30 78 35 30 30 34 | 0x20e3,| 0x5004|
|000017a0| 2c 20 20 30 78 34 30 32 | 35 2c 20 20 30 78 37 30 |, 0x402|5, 0x70|
|000017b0| 34 36 2c 20 20 30 78 36 | 30 36 37 2c 0a 20 20 20 |46, 0x6|067,. |
|000017c0| 20 30 78 38 33 62 39 2c | 20 20 30 78 39 33 39 38 | 0x83b9,| 0x9398|
|000017d0| 2c 20 20 30 78 61 33 66 | 62 2c 20 20 30 78 62 33 |, 0xa3f|b, 0xb3|
|000017e0| 64 61 2c 20 20 30 78 63 | 33 33 64 2c 20 20 30 78 |da, 0xc|33d, 0x|
|000017f0| 64 33 31 63 2c 20 20 30 | 78 65 33 37 66 2c 20 20 |d31c, 0|xe37f, |
|00001800| 30 78 66 33 35 65 2c 0a | 20 20 20 20 30 78 30 32 |0xf35e,.| 0x02|
|00001810| 62 31 2c 20 20 30 78 31 | 32 39 30 2c 20 20 30 78 |b1, 0x1|290, 0x|
|00001820| 32 32 66 33 2c 20 20 30 | 78 33 32 64 32 2c 20 20 |22f3, 0|x32d2, |
|00001830| 30 78 34 32 33 35 2c 20 | 20 30 78 35 32 31 34 2c |0x4235, | 0x5214,|
|00001840| 20 20 30 78 36 32 37 37 | 2c 20 20 30 78 37 32 35 | 0x6277|, 0x725|
|00001850| 36 2c 0a 20 20 20 20 30 | 78 62 35 65 61 2c 20 20 |6,. 0|xb5ea, |
|00001860| 30 78 61 35 63 62 2c 20 | 20 30 78 39 35 61 38 2c |0xa5cb, | 0x95a8,|
|00001870| 20 20 30 78 38 35 38 39 | 2c 20 20 30 78 66 35 36 | 0x8589|, 0xf56|
|00001880| 65 2c 20 20 30 78 65 35 | 34 66 2c 20 20 30 78 64 |e, 0xe5|4f, 0xd|
|00001890| 35 32 63 2c 20 20 30 78 | 63 35 30 64 2c 0a 20 20 |52c, 0x|c50d,. |
|000018a0| 20 20 30 78 33 34 65 32 | 2c 20 20 30 78 32 34 63 | 0x34e2|, 0x24c|
|000018b0| 33 2c 20 20 30 78 31 34 | 61 30 2c 20 20 30 78 30 |3, 0x14|a0, 0x0|
|000018c0| 34 38 31 2c 20 20 30 78 | 37 34 36 36 2c 20 20 30 |481, 0x|7466, 0|
|000018d0| 78 36 34 34 37 2c 20 20 | 30 78 35 34 32 34 2c 20 |x6447, |0x5424, |
|000018e0| 20 30 78 34 34 30 35 2c | 0a 20 20 20 20 30 78 61 | 0x4405,|. 0xa|
|000018f0| 37 64 62 2c 20 20 30 78 | 62 37 66 61 2c 20 20 30 |7db, 0x|b7fa, 0|
|00001900| 78 38 37 39 39 2c 20 20 | 30 78 39 37 62 38 2c 20 |x8799, |0x97b8, |
|00001910| 20 30 78 65 37 35 66 2c | 20 20 30 78 66 37 37 65 | 0xe75f,| 0xf77e|
|00001920| 2c 20 20 30 78 63 37 31 | 64 2c 20 20 30 78 64 37 |, 0xc71|d, 0xd7|
|00001930| 33 63 2c 0a 20 20 20 20 | 30 78 32 36 64 33 2c 20 |3c,. |0x26d3, |
|00001940| 20 30 78 33 36 66 32 2c | 20 20 30 78 30 36 39 31 | 0x36f2,| 0x0691|
|00001950| 2c 20 20 30 78 31 36 62 | 30 2c 20 20 30 78 36 36 |, 0x16b|0, 0x66|
|00001960| 35 37 2c 20 20 30 78 37 | 36 37 36 2c 20 20 30 78 |57, 0x7|676, 0x|
|00001970| 34 36 31 35 2c 20 20 30 | 78 35 36 33 34 2c 0a 20 |4615, 0|x5634,. |
|00001980| 20 20 20 30 78 64 39 34 | 63 2c 20 20 30 78 63 39 | 0xd94|c, 0xc9|
|00001990| 36 64 2c 20 20 30 78 66 | 39 30 65 2c 20 20 30 78 |6d, 0xf|90e, 0x|
|000019a0| 65 39 32 66 2c 20 20 30 | 78 39 39 63 38 2c 20 20 |e92f, 0|x99c8, |
|000019b0| 30 78 38 39 65 39 2c 20 | 20 30 78 62 39 38 61 2c |0x89e9, | 0xb98a,|
|000019c0| 20 20 30 78 61 39 61 62 | 2c 0a 20 20 20 20 30 78 | 0xa9ab|,. 0x|
|000019d0| 35 38 34 34 2c 20 20 30 | 78 34 38 36 35 2c 20 20 |5844, 0|x4865, |
|000019e0| 30 78 37 38 30 36 2c 20 | 20 30 78 36 38 32 37 2c |0x7806, | 0x6827,|
|000019f0| 20 20 30 78 31 38 63 30 | 2c 20 20 30 78 30 38 65 | 0x18c0|, 0x08e|
|00001a00| 31 2c 20 20 30 78 33 38 | 38 32 2c 20 20 30 78 32 |1, 0x38|82, 0x2|
|00001a10| 38 61 33 2c 0a 20 20 20 | 20 30 78 63 62 37 64 2c |8a3,. | 0xcb7d,|
|00001a20| 20 20 30 78 64 62 35 63 | 2c 20 20 30 78 65 62 33 | 0xdb5c|, 0xeb3|
|00001a30| 66 2c 20 20 30 78 66 62 | 31 65 2c 20 20 30 78 38 |f, 0xfb|1e, 0x8|
|00001a40| 62 66 39 2c 20 20 30 78 | 39 62 64 38 2c 20 20 30 |bf9, 0x|9bd8, 0|
|00001a50| 78 61 62 62 62 2c 20 20 | 30 78 62 62 39 61 2c 0a |xabbb, |0xbb9a,.|
|00001a60| 20 20 20 20 30 78 34 61 | 37 35 2c 20 20 30 78 35 | 0x4a|75, 0x5|
|00001a70| 61 35 34 2c 20 20 30 78 | 36 61 33 37 2c 20 20 30 |a54, 0x|6a37, 0|
|00001a80| 78 37 61 31 36 2c 20 20 | 30 78 30 61 66 31 2c 20 |x7a16, |0x0af1, |
|00001a90| 20 30 78 31 61 64 30 2c | 20 20 30 78 32 61 62 33 | 0x1ad0,| 0x2ab3|
|00001aa0| 2c 20 20 30 78 33 61 39 | 32 2c 0a 20 20 20 20 30 |, 0x3a9|2,. 0|
|00001ab0| 78 66 64 32 65 2c 20 20 | 30 78 65 64 30 66 2c 20 |xfd2e, |0xed0f, |
|00001ac0| 20 30 78 64 64 36 63 2c | 20 20 30 78 63 64 34 64 | 0xdd6c,| 0xcd4d|
|00001ad0| 2c 20 20 30 78 62 64 61 | 61 2c 20 20 30 78 61 64 |, 0xbda|a, 0xad|
|00001ae0| 38 62 2c 20 20 30 78 39 | 64 65 38 2c 20 20 30 78 |8b, 0x9|de8, 0x|
|00001af0| 38 64 63 39 2c 0a 20 20 | 20 20 30 78 37 63 32 36 |8dc9,. | 0x7c26|
|00001b00| 2c 20 20 30 78 36 63 30 | 37 2c 20 20 30 78 35 63 |, 0x6c0|7, 0x5c|
|00001b10| 36 34 2c 20 20 30 78 34 | 63 34 35 2c 20 20 30 78 |64, 0x4|c45, 0x|
|00001b20| 33 63 61 32 2c 20 20 30 | 78 32 63 38 33 2c 20 20 |3ca2, 0|x2c83, |
|00001b30| 30 78 31 63 65 30 2c 20 | 20 30 78 30 63 63 31 2c |0x1ce0, | 0x0cc1,|
|00001b40| 0a 20 20 20 20 30 78 65 | 66 31 66 2c 20 20 30 78 |. 0xe|f1f, 0x|
|00001b50| 66 66 33 65 2c 20 20 30 | 78 63 66 35 64 2c 20 20 |ff3e, 0|xcf5d, |
|00001b60| 30 78 64 66 37 63 2c 20 | 20 30 78 61 66 39 62 2c |0xdf7c, | 0xaf9b,|
|00001b70| 20 20 30 78 62 66 62 61 | 2c 20 20 30 78 38 66 64 | 0xbfba|, 0x8fd|
|00001b80| 39 2c 20 20 30 78 39 66 | 66 38 2c 0a 20 20 20 20 |9, 0x9f|f8,. |
|00001b90| 30 78 36 65 31 37 2c 20 | 20 30 78 37 65 33 36 2c |0x6e17, | 0x7e36,|
|00001ba0| 20 20 30 78 34 65 35 35 | 2c 20 20 30 78 35 65 37 | 0x4e55|, 0x5e7|
|00001bb0| 34 2c 20 20 30 78 32 65 | 39 33 2c 20 20 30 78 33 |4, 0x2e|93, 0x3|
|00001bc0| 65 62 32 2c 20 20 30 78 | 30 65 64 31 2c 20 20 30 |eb2, 0x|0ed1, 0|
|00001bd0| 78 31 65 66 30 0a 20 20 | 20 20 7d 3b 0a 0a 2f 2a |x1ef0. | };../*|
|00001be0| 20 52 65 70 6f 72 74 20 | 61 20 66 61 74 61 6c 20 | Report |a fatal |
|00001bf0| 65 72 72 6f 72 20 2a 2f | 0a 65 72 72 6f 72 28 6d |error */|.error(m|
|00001c00| 73 67 2c 20 6e 61 6d 65 | 29 0a 63 68 61 72 20 6d |sg, name|).char m|
|00001c10| 73 67 5b 5d 2c 20 6e 61 | 6d 65 5b 5d 3b 0a 7b 20 |sg[], na|me[];.{ |
|00001c20| 20 20 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 | fprint|f(stderr|
|00001c30| 2c 20 6d 73 67 2c 20 6e | 61 6d 65 29 3b 0a 20 20 |, msg, n|ame);. |
|00001c40| 20 20 70 75 74 63 28 27 | 5c 6e 27 2c 20 73 74 64 | putc('|\n', std|
|00001c50| 65 72 72 29 3b 0a 20 20 | 20 20 65 78 69 74 28 31 |err);. | exit(1|
|00001c60| 29 3b 0a 20 20 20 20 7d | 0a 0a 2f 2a 20 72 65 70 |);. }|../* rep|
|00001c70| 6c 61 63 65 20 69 6c 6c | 65 67 61 6c 20 55 6e 69 |lace ill|egal Uni|
|00001c80| 78 20 63 68 61 72 61 63 | 74 65 72 73 20 69 6e 20 |x charac|ters in |
|00001c90| 66 69 6c 65 20 6e 61 6d | 65 20 2a 2f 0a 2f 2a 20 |file nam|e */./* |
|00001ca0| 6d 61 6b 65 20 73 75 72 | 65 20 68 6f 73 74 20 66 |make sur|e host f|
|00001cb0| 69 6c 65 20 6e 61 6d 65 | 20 64 6f 65 73 6e 27 74 |ile name| doesn't|
|00001cc0| 20 67 65 74 20 74 72 75 | 6e 63 61 74 65 64 20 62 | get tru|ncated b|
|00001cd0| 65 79 6f 6e 64 20 72 65 | 63 6f 67 6e 69 74 69 6f |eyond re|cognitio|
|00001ce0| 6e 20 2a 2f 0a 75 6e 69 | 78 69 66 79 28 6e 70 29 |n */.uni|xify(np)|
|00001cf0| 0a 72 65 67 69 73 74 65 | 72 20 62 79 74 65 20 2a |.registe|r byte *|
|00001d00| 6e 70 3b 0a 7b 20 20 20 | 72 65 67 69 73 74 65 72 |np;.{ |register|
|00001d10| 20 75 6c 6f 6e 67 20 63 | 3b 0a 20 20 20 20 63 20 | ulong c|;. c |
|00001d20| 3d 20 73 74 72 6c 65 6e | 28 6e 70 29 3b 0a 20 20 |= strlen|(np);. |
|00001d30| 20 20 69 66 20 28 63 20 | 3e 20 53 59 53 4e 41 4d | if (c |> SYSNAM|
|00001d40| 45 4c 45 4e 20 2d 20 34 | 29 20 63 20 3d 20 53 59 |ELEN - 4|) c = SY|
|00001d50| 53 4e 41 4d 45 4c 45 4e | 20 2d 20 34 3b 0a 20 20 |SNAMELEN| - 4;. |
|00001d60| 20 20 6e 70 5b 63 5d 20 | 3d 20 27 5c 30 27 3b 0a | np[c] |= '\0';.|
|00001d70| 20 20 20 20 6e 70 2d 2d | 3b 0a 20 20 20 20 77 68 | np--|;. wh|
|00001d80| 69 6c 65 20 28 63 20 3d | 20 2a 2b 2b 6e 70 29 0a |ile (c =| *++np).|
|00001d90| 20 20 20 20 20 20 20 20 | 69 66 20 28 63 20 3c 3d | |if (c <=|
|00001da0| 20 27 20 27 20 7c 7c 20 | 63 20 3d 3d 20 27 2f 27 | ' ' || |c == '/'|
|00001db0| 20 7c 7c 20 63 20 3e 20 | 27 7e 27 29 20 2a 6e 70 | || c > |'~') *np|
|00001dc0| 20 3d 20 27 5f 27 3b 0a | 20 20 20 20 7d 0a 0a 2f | = '_';.| }../|
|00001dd0| 2a 20 43 6f 6e 76 65 72 | 74 20 55 6e 69 78 20 74 |* Conver|t Unix t|
|00001de0| 69 6d 65 20 28 47 4d 54 | 20 73 69 6e 63 65 20 31 |ime (GMT| since 1|
|00001df0| 2d 31 2d 31 39 37 30 29 | 20 74 6f 20 4d 61 63 0a |-1-1970)| to Mac.|
|00001e00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001e10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001e20| 20 20 20 20 74 69 6d 65 | 20 28 6c 6f 63 61 6c 20 | time| (local |
|00001e30| 73 69 6e 63 65 20 31 2d | 31 2d 31 39 30 34 29 20 |since 1-|1-1904) |
|00001e40| 2a 2f 0a 23 64 65 66 69 | 6e 65 20 4d 41 43 54 49 |*/.#defi|ne MACTI|
|00001e50| 4d 45 44 49 46 46 20 30 | 78 37 63 32 35 62 30 38 |MEDIFF 0|x7c25b08|
|00001e60| 30 20 2f 2a 20 4d 61 63 | 20 74 69 6d 65 20 6f 66 |0 /* Mac| time of|
|00001e70| 20 30 30 3a 30 30 3a 30 | 30 20 47 4d 54 2c 20 4a | 00:00:0|0 GMT, J|
|00001e80| 61 6e 20 31 2c 20 31 39 | 37 30 20 2a 2f 0a 0a 75 |an 1, 19|70 */..u|
|00001e90| 6c 6f 6e 67 20 74 69 6d | 65 32 6d 61 63 28 74 69 |long tim|e2mac(ti|
|00001ea0| 6d 65 29 0a 75 6c 6f 6e | 67 20 74 69 6d 65 3b 0a |me).ulon|g time;.|
|00001eb0| 7b 20 20 20 73 74 72 75 | 63 74 20 74 69 6d 65 62 |{ stru|ct timeb|
|00001ec0| 20 74 70 3b 0a 20 20 20 | 20 66 74 69 6d 65 28 26 | tp;. | ftime(&|
|00001ed0| 74 70 29 3b 0a 20 20 20 | 20 72 65 74 75 72 6e 20 |tp);. | return |
|00001ee0| 6c 6f 6e 67 32 6d 61 63 | 28 74 69 6d 65 20 2b 20 |long2mac|(time + |
|00001ef0| 4d 41 43 54 49 4d 45 44 | 49 46 46 0a 20 20 20 20 |MACTIMED|IFF. |
|00001f00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001f10| 2d 20 36 30 20 2a 20 28 | 74 70 2e 74 69 6d 65 7a |- 60 * (|tp.timez|
|00001f20| 6f 6e 65 20 2d 20 36 30 | 20 2a 20 74 70 2e 64 73 |one - 60| * tp.ds|
|00001f30| 74 66 6c 61 67 29 29 3b | 0a 20 20 20 20 7d 0a 0a |tflag));|. }..|
|00001f40| 0a 2f 2a 20 54 68 69 73 | 20 70 72 6f 63 65 64 75 |./* This| procedu|
|00001f50| 72 65 20 63 6f 70 69 65 | 73 20 74 68 65 20 69 6e |re copie|s the in|
|00001f60| 70 75 74 20 66 69 6c 65 | 20 74 6f 20 74 68 65 20 |put file| to the |
|00001f70| 6f 75 74 70 75 74 20 66 | 69 6c 65 2c 20 62 61 73 |output f|ile, bas|
|00001f80| 69 63 61 6c 6c 79 2c 20 | 61 6c 74 68 6f 75 67 68 |ically, |although|
|00001f90| 0a 20 20 20 20 69 6e 20 | 54 45 58 54 20 6d 6f 64 |. in |TEXT mod|
|00001fa0| 65 20 69 74 20 63 68 61 | 6e 67 65 73 20 4c 46 27 |e it cha|nges LF'|
|00001fb0| 73 20 74 6f 20 43 52 27 | 73 20 61 6e 64 20 69 6e |s to CR'|s and in|
|00001fc0| 20 61 6e 79 20 6d 6f 64 | 65 20 69 74 20 66 6f 72 | any mod|e it for|
|00001fd0| 67 65 73 20 61 20 4d 61 | 63 20 69 6e 66 6f 20 0a |ges a Ma|c info .|
|00001fe0| 20 20 20 20 68 65 61 64 | 65 72 2e 20 20 41 75 74 | head|er. Aut|
|00001ff0| 68 6f 72 20 74 79 70 65 | 20 66 6f 72 20 54 45 58 |hor type| for TEX|
|00002000| 54 20 6d 6f 64 65 20 63 | 61 6e 20 63 6f 6d 65 20 |T mode c|an come |
|00002010| 66 72 6f 6d 20 74 68 65 | 20 4d 41 43 5f 45 44 49 |from the| MAC_EDI|
|00002020| 54 4f 52 20 65 6e 76 69 | 72 6f 6e 2d 0a 20 20 20 |TOR envi|ron-. |
|00002030| 20 6d 65 6e 74 20 76 61 | 72 69 61 62 6c 65 20 69 | ment va|riable i|
|00002040| 66 20 69 74 20 69 73 20 | 64 65 66 69 6e 65 64 2e |f it is |defined.|
|00002050| 20 2a 2f 0a 0a 75 6e 5f | 6f 74 68 65 72 28 6d 6f | */..un_|other(mo|
|00002060| 64 65 29 0a 69 6e 74 20 | 6d 6f 64 65 3b 0a 7b 20 |de).int |mode;.{ |
|00002070| 20 20 72 65 67 69 73 74 | 65 72 20 75 6c 6f 6e 67 | regist|er ulong|
|00002080| 20 62 3b 0a 20 20 20 20 | 72 65 67 69 73 74 65 72 | b;. |register|
|00002090| 20 75 6c 6f 6e 67 20 6e | 63 68 61 72 73 3b 0a 20 | ulong n|chars;. |
|000020a0| 20 20 20 63 68 61 72 20 | 74 78 74 66 6e 61 6d 65 | char |txtfname|
|000020b0| 5b 42 49 4e 4e 41 4d 45 | 4c 45 4e 5d 2c 20 62 69 |[BINNAME|LEN], bi|
|000020c0| 6e 66 6e 61 6d 65 5b 42 | 49 4e 4e 41 4d 45 4c 45 |nfname[B|INNAMELE|
|000020d0| 4e 5d 3b 0a 20 20 20 20 | 46 49 4c 45 20 2a 74 78 |N];. |FILE *tx|
|000020e0| 74 66 69 6c 65 2c 20 2a | 62 69 6e 66 69 6c 65 3b |tfile, *|binfile;|
|000020f0| 20 0a 20 20 20 20 63 68 | 61 72 20 2a 73 75 66 66 | . ch|ar *suff|
|00002100| 69 78 3b 0a 20 20 20 20 | 73 74 72 75 63 74 20 73 |ix;. |struct s|
|00002110| 74 61 74 20 73 74 62 75 | 66 3b 0a 20 20 20 20 69 |tat stbu|f;. i|
|00002120| 6e 66 6f 5f 68 65 61 64 | 65 72 20 69 6e 66 6f 3b |nfo_head|er info;|
|00002130| 0a 20 20 20 20 69 6e 74 | 20 65 78 74 72 61 5f 63 |. int| extra_c|
|00002140| 68 61 72 73 3b 0a 20 20 | 20 20 75 6c 6f 6e 67 20 |hars;. | ulong |
|00002150| 64 6c 65 6e 2c 20 72 6c | 65 6e 2c 20 6d 74 69 6d |dlen, rl|en, mtim|
|00002160| 2c 20 63 74 69 6d 3b 0a | 0a 20 20 20 20 69 66 20 |, ctim;.|. if |
|00002170| 28 6d 6f 64 65 20 3d 3d | 20 44 41 54 41 29 20 73 |(mode ==| DATA) s|
|00002180| 75 66 66 69 78 20 3d 20 | 22 2e 64 61 74 61 22 3b |uffix = |".data";|
|00002190| 0a 20 20 20 20 65 6c 73 | 65 20 69 66 20 28 6d 6f |. els|e if (mo|
|000021a0| 64 65 20 3d 3d 20 52 53 | 52 43 29 20 73 75 66 66 |de == RS|RC) suff|
|000021b0| 69 78 20 3d 20 22 2e 72 | 73 72 63 22 3b 0a 20 20 |ix = ".r|src";. |
|000021c0| 20 20 65 6c 73 65 20 73 | 75 66 66 69 78 20 3d 20 | else s|uffix = |
|000021d0| 22 2e 74 65 78 74 22 3b | 0a 0a 20 20 20 20 77 68 |".text";|.. wh|
|000021e0| 69 6c 65 20 28 68 71 78 | 6e 61 6d 65 73 5f 6c 65 |ile (hqx|names_le|
|000021f0| 66 74 5b 30 5d 5b 30 5d | 20 21 3d 20 27 2d 27 29 |ft[0][0]| != '-')|
|00002200| 20 7b 0a 0a 20 20 20 20 | 20 20 20 20 73 74 72 63 | {.. | strc|
|00002210| 70 79 28 74 78 74 66 6e | 61 6d 65 2c 20 2a 68 71 |py(txtfn|ame, *hq|
|00002220| 78 6e 61 6d 65 73 5f 6c | 65 66 74 2b 2b 29 3b 0a |xnames_l|eft++);.|
|00002230| 20 20 20 20 20 20 20 20 | 69 66 20 28 21 28 74 78 | |if (!(tx|
|00002240| 74 66 69 6c 65 20 3d 20 | 66 6f 70 65 6e 28 74 78 |tfile = |fopen(tx|
|00002250| 74 66 6e 61 6d 65 2c 20 | 22 72 22 29 29 29 20 7b |tfname, |"r"))) {|
|00002260| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 |. | /* |
|00002270| 4d 61 79 62 65 20 77 65 | 20 61 72 65 20 73 75 70 |Maybe we| are sup|
|00002280| 70 6f 73 65 64 20 74 6f | 20 66 69 67 75 72 65 20 |posed to| figure |
|00002290| 6f 75 74 20 74 68 65 20 | 73 75 66 66 69 78 20 6f |out the |suffix o|
|000022a0| 75 72 73 65 6c 76 65 73 | 3f 20 2a 2f 0a 20 20 20 |urselves|? */. |
|000022b0| 20 20 20 20 20 20 20 20 | 20 73 74 72 63 61 74 28 | | strcat(|
|000022c0| 74 78 74 66 6e 61 6d 65 | 2c 20 73 75 66 66 69 78 |txtfname|, suffix|
|000022d0| 29 3b 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 69 |);. | i|
|000022e0| 66 20 28 21 28 74 78 74 | 66 69 6c 65 20 3d 20 66 |f (!(txt|file = f|
|000022f0| 6f 70 65 6e 28 74 78 74 | 66 6e 61 6d 65 2c 20 22 |open(txt|fname, "|
|00002300| 72 22 29 29 29 0a 20 20 | 20 20 20 20 20 20 20 20 |r"))). | |
|00002310| 20 20 20 20 20 20 65 72 | 72 6f 72 28 22 43 61 6e | er|ror("Can|
|00002320| 6e 6f 74 20 6f 70 65 6e | 20 25 73 22 2c 20 74 78 |not open| %s", tx|
|00002330| 74 66 6e 61 6d 65 29 3b | 0a 20 20 20 20 20 20 20 |tfname);|. |
|00002340| 20 20 20 20 20 7d 0a 0a | 20 20 20 20 20 20 20 20 | }..| |
|00002350| 69 66 20 28 73 74 61 74 | 28 74 78 74 66 6e 61 6d |if (stat|(txtfnam|
|00002360| 65 2c 20 26 73 74 62 75 | 66 29 29 0a 20 20 20 20 |e, &stbu|f)). |
|00002370| 20 20 20 20 20 20 20 20 | 65 72 72 6f 72 28 22 43 | |error("C|
|00002380| 61 6e 6e 6f 74 20 72 65 | 61 64 20 25 73 22 2c 20 |annot re|ad %s", |
|00002390| 74 78 74 66 6e 61 6d 65 | 29 3b 0a 0a 20 20 20 20 |txtfname|);.. |
|000023a0| 20 20 20 20 2f 2a 20 73 | 74 75 66 66 20 68 65 61 | /* s|tuff hea|
|000023b0| 64 65 72 20 64 61 74 61 | 20 69 6e 74 6f 20 74 68 |der data| into th|
|000023c0| 65 20 69 6e 66 6f 20 68 | 65 61 64 65 72 20 2a 2f |e info h|eader */|
|000023d0| 0a 20 20 20 20 20 20 20 | 20 62 7a 65 72 6f 28 26 |. | bzero(&|
|000023e0| 69 6e 66 6f 2c 20 73 69 | 7a 65 6f 66 28 69 6e 66 |info, si|zeof(inf|
|000023f0| 6f 5f 68 65 61 64 65 72 | 29 29 3b 0a 20 20 20 20 |o_header|));. |
|00002400| 20 20 20 20 69 6e 66 6f | 2e 6e 6c 65 6e 20 3d 20 | info|.nlen = |
|00002410| 73 74 72 6c 65 6e 28 74 | 78 74 66 6e 61 6d 65 29 |strlen(t|xtfname)|
|00002420| 3b 0a 20 20 20 20 20 20 | 20 20 69 6e 66 6f 2e 6e |;. | info.n|
|00002430| 6c 65 6e 20 3d 20 28 69 | 6e 66 6f 2e 6e 6c 65 6e |len = (i|nfo.nlen|
|00002440| 20 3e 20 4e 41 4d 45 4c | 45 4e 29 20 3f 20 4e 41 | > NAMEL|EN) ? NA|
|00002450| 4d 45 4c 45 4e 20 3a 20 | 69 6e 66 6f 2e 6e 6c 65 |MELEN : |info.nle|
|00002460| 6e 3b 0a 09 69 6e 66 6f | 2e 6e 61 6d 65 5b 69 6e |n;..info|.name[in|
|00002470| 66 6f 2e 6e 6c 65 6e 5d | 20 3d 20 27 5c 30 27 3b |fo.nlen]| = '\0';|
|00002480| 0a 20 20 20 20 20 20 20 | 20 73 74 72 63 70 79 28 |. | strcpy(|
|00002490| 69 6e 66 6f 2e 6e 61 6d | 65 2c 20 74 78 74 66 6e |info.nam|e, txtfn|
|000024a0| 61 6d 65 29 3b 20 20 20 | 20 20 20 20 20 20 20 20 |ame); | |
|000024b0| 2f 2a 20 6e 61 6d 65 20 | 2a 2f 0a 20 20 20 20 20 |/* name |*/. |
|000024c0| 20 20 20 6d 74 69 6d 20 | 3d 20 74 69 6d 65 32 6d | mtim |= time2m|
|000024d0| 61 63 28 73 74 62 75 66 | 2e 73 74 5f 6d 74 69 6d |ac(stbuf|.st_mtim|
|000024e0| 65 29 3b 0a 20 20 20 20 | 20 20 20 20 63 74 69 6d |e);. | ctim|
|000024f0| 20 3d 20 74 69 6d 65 32 | 6d 61 63 28 73 74 62 75 | = time2|mac(stbu|
|00002500| 66 2e 73 74 5f 63 74 69 | 6d 65 29 3b 0a 20 20 20 |f.st_cti|me);. |
|00002510| 20 20 20 20 20 62 63 6f | 70 79 28 26 6d 74 69 6d | bco|py(&mtim|
|00002520| 2c 20 69 6e 66 6f 2e 6d | 74 69 6d 2c 20 34 29 3b |, info.m|tim, 4);|
|00002530| 0a 20 20 20 20 20 20 20 | 20 62 63 6f 70 79 28 26 |. | bcopy(&|
|00002540| 63 74 69 6d 2c 20 69 6e | 66 6f 2e 63 74 69 6d 2c |ctim, in|fo.ctim,|
|00002550| 20 34 29 3b 0a 0a 20 20 | 20 20 20 20 20 20 69 66 | 4);.. | if|
|00002560| 20 28 6d 6f 64 65 20 3d | 3d 20 52 53 52 43 29 20 | (mode =|= RSRC) |
|00002570| 7b 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2a |{. | /*|
|00002580| 20 64 6c 65 6e 20 69 73 | 20 61 6c 72 65 61 64 79 | dlen is| already|
|00002590| 20 7a 65 72 6f 20 2a 2f | 0a 20 20 20 20 20 20 20 | zero */|. |
|000025a0| 20 20 20 20 20 72 6c 65 | 6e 20 3d 20 6c 6f 6e 67 | rle|n = long|
|000025b0| 32 6d 61 63 28 73 74 62 | 75 66 2e 73 74 5f 73 69 |2mac(stb|uf.st_si|
|000025c0| 7a 65 29 3b 0a 20 20 20 | 20 20 20 20 20 20 20 20 |ze);. | |
|000025d0| 20 62 63 6f 70 79 28 26 | 72 6c 65 6e 2c 20 69 6e | bcopy(&|rlen, in|
|000025e0| 66 6f 2e 72 6c 65 6e 2c | 20 34 29 3b 0a 20 20 20 |fo.rlen,| 4);. |
|000025f0| 20 20 20 20 20 20 20 20 | 20 62 63 6f 70 79 28 22 | | bcopy("|
|00002600| 41 50 50 4c 22 2c 20 69 | 6e 66 6f 2e 74 79 70 65 |APPL", i|nfo.type|
|00002610| 2c 20 34 29 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |, 4);. | |
|00002620| 20 20 62 63 6f 70 79 28 | 22 43 43 4f 4d 22 2c 20 | bcopy(|"CCOM", |
|00002630| 69 6e 66 6f 2e 61 75 74 | 68 2c 20 34 29 3b 0a 20 |info.aut|h, 4);. |
|00002640| 20 20 20 20 20 20 20 20 | 20 20 20 7d 0a 20 20 20 | | }. |
|00002650| 20 20 20 20 20 65 6c 73 | 65 20 7b 0a 20 20 20 20 | els|e {. |
|00002660| 20 20 20 20 20 20 20 20 | 64 6c 65 6e 20 3d 20 6c | |dlen = l|
|00002670| 6f 6e 67 32 6d 61 63 28 | 73 74 62 75 66 2e 73 74 |ong2mac(|stbuf.st|
|00002680| 5f 73 69 7a 65 29 3b 0a | 20 20 20 20 20 20 20 20 |_size);.| |
|00002690| 20 20 20 20 62 63 6f 70 | 79 28 26 64 6c 65 6e 2c | bcop|y(&dlen,|
|000026a0| 20 69 6e 66 6f 2e 64 6c | 65 6e 2c 20 34 29 3b 0a | info.dl|en, 4);.|
|000026b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2a 20 72 | | /* r|
|000026c0| 6c 65 6e 20 69 73 20 61 | 6c 72 65 61 64 79 20 7a |len is a|lready z|
|000026d0| 65 72 6f 20 2a 2f 0a 20 | 20 20 20 20 20 20 20 20 |ero */. | |
|000026e0| 20 20 20 62 63 6f 70 79 | 28 22 54 45 58 54 22 2c | bcopy|("TEXT",|
|000026f0| 20 69 6e 66 6f 2e 74 79 | 70 65 2c 20 34 29 3b 0a | info.ty|pe, 4);.|
|00002700| 20 20 20 20 20 20 20 20 | 20 20 20 20 69 66 20 28 | | if (|
|00002710| 6d 6f 64 65 20 3d 3d 20 | 44 41 54 41 29 20 62 63 |mode == |DATA) bc|
|00002720| 6f 70 79 28 22 3f 3f 3f | 3f 22 2c 20 69 6e 66 6f |opy("???|?", info|
|00002730| 2e 61 75 74 68 2c 20 34 | 29 3b 0a 20 20 20 20 20 |.auth, 4|);. |
|00002740| 20 20 20 20 20 20 20 65 | 6c 73 65 20 62 63 6f 70 | e|lse bcop|
|00002750| 79 28 74 65 78 74 5f 61 | 75 74 68 6f 72 2c 20 69 |y(text_a|uthor, i|
|00002760| 6e 66 6f 2e 61 75 74 68 | 2c 20 34 29 3b 0a 20 20 |nfo.auth|, 4);. |
|00002770| 20 20 20 20 20 20 20 20 | 20 20 7d 0a 0a 20 20 20 | | }.. |
|00002780| 20 20 20 20 20 2f 2a 20 | 43 72 65 61 74 65 20 74 | /* |Create t|
|00002790| 68 65 20 2e 62 69 6e 20 | 66 69 6c 65 20 61 6e 64 |he .bin |file and|
|000027a0| 20 77 72 69 74 65 20 74 | 68 65 20 69 6e 66 6f 20 | write t|he info |
|000027b0| 74 6f 20 69 74 20 2a 2f | 0a 20 20 20 20 20 20 20 |to it */|. |
|000027c0| 20 73 70 72 69 6e 74 66 | 28 62 69 6e 66 6e 61 6d | sprintf|(binfnam|
|000027d0| 65 2c 20 22 25 73 2f 25 | 73 25 73 22 2c 20 64 69 |e, "%s/%|s%s", di|
|000027e0| 72 2c 20 74 78 74 66 6e | 61 6d 65 2c 20 65 78 74 |r, txtfn|ame, ext|
|000027f0| 29 3b 0a 20 20 20 20 20 | 20 20 20 69 66 20 28 28 |);. | if ((|
|00002800| 62 69 6e 66 69 6c 65 20 | 3d 20 66 6f 70 65 6e 28 |binfile |= fopen(|
|00002810| 62 69 6e 66 6e 61 6d 65 | 2c 20 22 77 22 29 29 20 |binfname|, "w")) |
|00002820| 3d 3d 20 4e 55 4c 4c 29 | 0a 20 20 20 20 20 20 20 |== NULL)|. |
|00002830| 20 20 20 20 20 65 72 72 | 6f 72 28 22 43 61 6e 6e | err|or("Cann|
|00002840| 6f 74 20 6f 70 65 6e 20 | 25 73 22 2c 20 62 69 6e |ot open |%s", bin|
|00002850| 66 6e 61 6d 65 29 3b 0a | 20 20 20 20 20 20 20 20 |fname);.| |
|00002860| 66 70 72 69 6e 74 66 28 | 76 65 72 62 6f 73 65 2c |fprintf(|verbose,|
|00002870| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00002880| 20 22 43 6f 6e 76 65 72 | 74 69 6e 67 20 20 20 20 | "Conver|ting |
|00002890| 20 25 2d 33 30 73 20 74 | 79 70 65 20 3d 20 5c 22 | %-30s t|ype = \"|
|000028a0| 25 34 2e 34 73 5c 22 2c | 20 61 75 74 68 6f 72 20 |%4.4s\",| author |
|000028b0| 3d 20 5c 22 25 34 2e 34 | 73 5c 22 5c 6e 22 2c 0a |= \"%4.4|s\"\n",.|
|000028c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000028d0| 74 78 74 66 6e 61 6d 65 | 2c 20 69 6e 66 6f 2e 74 |txtfname|, info.t|
|000028e0| 79 70 65 2c 20 69 6e 66 | 6f 2e 61 75 74 68 29 3b |ype, inf|o.auth);|
|000028f0| 0a 20 20 20 20 20 20 20 | 20 66 77 72 69 74 65 28 |. | fwrite(|
|00002900| 26 69 6e 66 6f 2c 20 73 | 69 7a 65 6f 66 28 69 6e |&info, s|izeof(in|
|00002910| 66 6f 29 2c 20 31 2c 20 | 62 69 6e 66 69 6c 65 29 |fo), 1, |binfile)|
|00002920| 3b 0a 0a 20 20 20 20 20 | 20 20 20 6e 63 68 61 72 |;.. | nchar|
|00002930| 73 20 3d 20 73 74 62 75 | 66 2e 73 74 5f 73 69 7a |s = stbu|f.st_siz|
|00002940| 65 3b 0a 20 20 20 20 20 | 20 20 20 65 78 74 72 61 |e;. | extra|
|00002950| 5f 63 68 61 72 73 20 3d | 20 31 32 37 20 2d 20 28 |_chars =| 127 - (|
|00002960| 6e 63 68 61 72 73 2b 31 | 32 37 29 20 25 20 31 32 |nchars+1|27) % 12|
|00002970| 38 3b 0a 20 20 20 20 20 | 20 20 20 69 66 20 28 6d |8;. | if (m|
|00002980| 6f 64 65 20 3d 3d 20 54 | 45 58 54 29 20 77 68 69 |ode == T|EXT) whi|
|00002990| 6c 65 20 28 6e 63 68 61 | 72 73 2d 2d 29 20 7b 0a |le (ncha|rs--) {.|
|000029a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 62 20 3d 20 | | b = |
|000029b0| 67 65 74 63 28 74 78 74 | 66 69 6c 65 29 3b 0a 20 |getc(txt|file);. |
|000029c0| 20 20 20 20 20 20 20 20 | 20 20 20 69 66 20 28 62 | | if (b|
|000029d0| 20 3d 3d 20 4c 46 29 20 | 62 20 3d 20 43 52 3b 0a | == LF) |b = CR;.|
|000029e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 70 75 74 63 | | putc|
|000029f0| 28 62 2c 20 62 69 6e 66 | 69 6c 65 29 3b 0a 20 20 |(b, binf|ile);. |
|00002a00| 20 20 20 20 20 20 20 20 | 20 20 7d 0a 20 20 20 20 | | }. |
|00002a10| 20 20 20 20 65 6c 73 65 | 20 77 68 69 6c 65 20 28 | else| while (|
|00002a20| 6e 63 68 61 72 73 2d 2d | 29 20 70 75 74 63 28 67 |nchars--|) putc(g|
|00002a30| 65 74 63 28 74 78 74 66 | 69 6c 65 29 2c 20 62 69 |etc(txtf|ile), bi|
|00002a40| 6e 66 69 6c 65 29 3b 0a | 0a 20 20 20 20 20 20 20 |nfile);.|. |
|00002a50| 20 77 68 69 6c 65 20 28 | 65 78 74 72 61 5f 63 68 | while (|extra_ch|
|00002a60| 61 72 73 2d 2d 29 20 70 | 75 74 63 28 30 2c 20 62 |ars--) p|utc(0, b|
|00002a70| 69 6e 66 69 6c 65 29 3b | 0a 20 20 20 20 20 20 20 |infile);|. |
|00002a80| 20 66 63 6c 6f 73 65 28 | 62 69 6e 66 69 6c 65 29 | fclose(|binfile)|
|00002a90| 3b 0a 20 20 20 20 20 20 | 20 20 66 63 6c 6f 73 65 |;. | fclose|
|00002aa0| 28 74 78 74 66 69 6c 65 | 29 3b 0a 20 20 20 20 20 |(txtfile|);. |
|00002ab0| 20 20 20 7d 0a 20 20 20 | 20 7d 0a 0a 2f 2a 20 54 | }. | }../* T|
|00002ac0| 68 69 73 20 70 72 6f 63 | 65 64 75 72 65 20 63 6f |his proc|edure co|
|00002ad0| 70 69 65 73 20 74 68 65 | 20 69 6e 70 75 74 20 66 |pies the| input f|
|00002ae0| 69 6c 65 20 74 6f 20 74 | 68 65 20 6f 75 74 70 75 |ile to t|he outpu|
|00002af0| 74 20 66 69 6c 65 2c 20 | 62 61 73 69 63 61 6c 6c |t file, |basicall|
|00002b00| 79 2c 20 61 6c 74 68 6f | 75 67 68 0a 20 20 20 20 |y, altho|ugh. |
|00002b10| 69 6e 20 54 45 58 54 20 | 6d 6f 64 65 20 69 74 20 |in TEXT |mode it |
|00002b20| 63 68 61 6e 67 65 73 20 | 43 52 27 73 20 74 6f 20 |changes |CR's to |
|00002b30| 4c 46 27 73 20 61 6e 64 | 20 69 6e 20 61 6e 79 20 |LF's and| in any |
|00002b40| 6d 6f 64 65 20 69 74 20 | 73 6b 69 70 73 20 6f 76 |mode it |skips ov|
|00002b50| 65 72 20 74 68 65 20 4d | 61 63 0a 20 20 20 20 69 |er the M|ac. i|
|00002b60| 6e 66 6f 20 68 65 61 64 | 65 72 2e 20 2a 2f 0a 0a |nfo head|er. */..|
|00002b70| 72 65 5f 6f 74 68 65 72 | 28 6d 6f 64 65 29 0a 69 |re_other|(mode).i|
|00002b80| 6e 74 20 6d 6f 64 65 3b | 0a 7b 20 20 20 72 65 67 |nt mode;|.{ reg|
|00002b90| 69 73 74 65 72 20 75 6c | 6f 6e 67 20 62 3b 0a 20 |ister ul|ong b;. |
|00002ba0| 20 20 20 72 65 67 69 73 | 74 65 72 20 75 6c 6f 6e | regis|ter ulon|
|00002bb0| 67 20 6e 63 68 61 72 73 | 3b 0a 20 20 20 20 63 68 |g nchars|;. ch|
|00002bc0| 61 72 20 74 78 74 66 6e | 61 6d 65 5b 42 49 4e 4e |ar txtfn|ame[BINN|
|00002bd0| 41 4d 45 4c 45 4e 5d 2c | 20 62 69 6e 66 6e 61 6d |AMELEN],| binfnam|
|00002be0| 65 5b 42 49 4e 4e 41 4d | 45 4c 45 4e 5d 3b 0a 20 |e[BINNAM|ELEN];. |
|00002bf0| 20 20 20 46 49 4c 45 20 | 2a 74 78 74 66 69 6c 65 | FILE |*txtfile|
|00002c00| 2c 20 2a 62 69 6e 66 69 | 6c 65 3b 20 0a 20 20 20 |, *binfi|le; . |
|00002c10| 20 63 68 61 72 20 2a 73 | 75 66 66 69 78 3b 0a 20 | char *s|uffix;. |
|00002c20| 20 20 20 69 6e 66 6f 5f | 68 65 61 64 65 72 20 69 | info_|header i|
|00002c30| 6e 66 6f 3b 0a 0a 20 20 | 20 20 69 66 20 28 6d 6f |nfo;.. | if (mo|
|00002c40| 64 65 20 3d 3d 20 44 41 | 54 41 29 20 73 75 66 66 |de == DA|TA) suff|
|00002c50| 69 78 20 3d 20 22 2e 64 | 61 74 61 22 3b 0a 20 20 |ix = ".d|ata";. |
|00002c60| 20 20 65 6c 73 65 20 69 | 66 20 28 6d 6f 64 65 20 | else i|f (mode |
|00002c70| 3d 3d 20 52 53 52 43 29 | 20 73 75 66 66 69 78 20 |== RSRC)| suffix |
|00002c80| 3d 20 22 2e 72 73 72 63 | 22 3b 0a 20 20 20 20 65 |= ".rsrc|";. e|
|00002c90| 6c 73 65 20 73 75 66 66 | 69 78 20 3d 20 22 2e 74 |lse suff|ix = ".t|
|00002ca0| 65 78 74 22 3b 0a 0a 20 | 20 20 20 77 68 69 6c 65 |ext";.. | while|
|00002cb0| 20 28 68 71 78 6e 61 6d | 65 73 5f 6c 65 66 74 5b | (hqxnam|es_left[|
|00002cc0| 30 5d 5b 30 5d 20 21 3d | 20 27 2d 27 29 20 7b 0a |0][0] !=| '-') {.|
|00002cd0| 0a 20 20 20 20 20 20 20 | 20 73 74 72 63 70 79 28 |. | strcpy(|
|00002ce0| 62 69 6e 66 6e 61 6d 65 | 2c 20 2a 68 71 78 6e 61 |binfname|, *hqxna|
|00002cf0| 6d 65 73 5f 6c 65 66 74 | 2b 2b 29 3b 0a 20 20 20 |mes_left|++);. |
|00002d00| 20 20 20 20 20 69 66 20 | 28 28 62 69 6e 66 69 6c | if |((binfil|
|00002d10| 65 20 3d 20 66 6f 70 65 | 6e 28 62 69 6e 66 6e 61 |e = fope|n(binfna|
|00002d20| 6d 65 2c 20 22 72 22 29 | 29 20 3d 3d 20 4e 55 4c |me, "r")|) == NUL|
|00002d30| 4c 29 20 7b 0a 20 20 20 | 20 20 20 20 20 20 20 20 |L) {. | |
|00002d40| 20 2f 2a 20 4d 61 79 62 | 65 20 77 65 20 61 72 65 | /* Mayb|e we are|
|00002d50| 20 73 75 70 70 6f 73 65 | 64 20 74 6f 20 66 69 67 | suppose|d to fig|
|00002d60| 75 72 65 20 6f 75 74 20 | 74 68 65 20 73 75 66 66 |ure out |the suff|
|00002d70| 69 78 20 6f 75 72 73 65 | 6c 76 65 73 3f 20 2a 2f |ix ourse|lves? */|
|00002d80| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 73 74 72 |. | str|
|00002d90| 63 61 74 28 62 69 6e 66 | 6e 61 6d 65 2c 20 65 78 |cat(binf|name, ex|
|00002da0| 74 29 3b 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |t);. | |
|00002db0| 69 66 20 28 21 28 62 69 | 6e 66 69 6c 65 20 3d 20 |if (!(bi|nfile = |
|00002dc0| 66 6f 70 65 6e 28 62 69 | 6e 66 6e 61 6d 65 2c 20 |fopen(bi|nfname, |
|00002dd0| 22 72 22 29 29 29 0a 20 | 20 20 20 20 20 20 20 20 |"r"))). | |
|00002de0| 20 20 20 20 20 20 20 65 | 72 72 6f 72 28 22 43 61 | e|rror("Ca|
|00002df0| 6e 6e 6f 74 20 6f 70 65 | 6e 20 25 73 22 2c 20 62 |nnot ope|n %s", b|
|00002e00| 69 6e 66 6e 61 6d 65 29 | 3b 0a 20 20 20 20 20 20 |infname)|;. |
|00002e10| 20 20 20 20 20 20 7d 0a | 0a 20 20 20 20 20 20 20 | }.|. |
|00002e20| 20 2f 2a 20 52 65 61 64 | 20 74 68 65 20 69 6e 66 | /* Read| the inf|
|00002e30| 6f 20 66 72 6f 6d 20 74 | 68 65 20 2e 62 69 6e 20 |o from t|he .bin |
|00002e40| 66 69 6c 65 2c 20 63 72 | 65 61 74 65 20 74 68 65 |file, cr|eate the|
|00002e50| 20 6f 75 74 70 75 74 20 | 66 69 6c 65 20 2a 2f 0a | output |file */.|
|00002e60| 20 20 20 20 20 20 20 20 | 66 72 65 61 64 28 26 69 | |fread(&i|
|00002e70| 6e 66 6f 2c 20 73 69 7a | 65 6f 66 28 69 6e 66 6f |nfo, siz|eof(info|
|00002e80| 29 2c 20 31 2c 20 62 69 | 6e 66 69 6c 65 29 3b 0a |), 1, bi|nfile);.|
|00002e90| 20 20 20 20 20 20 20 20 | 73 74 72 6e 63 70 79 28 | |strncpy(|
|00002ea0| 74 78 74 66 6e 61 6d 65 | 2c 20 69 6e 66 6f 2e 6e |txtfname|, info.n|
|00002eb0| 61 6d 65 2c 20 69 6e 66 | 6f 2e 6e 6c 65 6e 29 3b |ame, inf|o.nlen);|
|00002ec0| 0a 09 74 78 74 66 6e 61 | 6d 65 5b 69 6e 66 6f 2e |..txtfna|me[info.|
|00002ed0| 6e 6c 65 6e 5d 20 3d 20 | 27 5c 30 27 3b 0a 20 20 |nlen] = |'\0';. |
|00002ee0| 20 20 20 20 20 20 66 70 | 72 69 6e 74 66 28 76 65 | fp|rintf(ve|
|00002ef0| 72 62 6f 73 65 2c 0a 20 | 20 20 20 20 20 20 20 20 |rbose,. | |
|00002f00| 20 20 20 20 20 20 20 22 | 43 6f 6e 76 65 72 74 69 | "|Converti|
|00002f10| 6e 67 20 20 20 20 20 25 | 2d 33 30 73 20 74 79 70 |ng %|-30s typ|
|00002f20| 65 20 3d 20 5c 22 25 34 | 2e 34 73 5c 22 2c 20 61 |e = \"%4|.4s\", a|
|00002f30| 75 74 68 6f 72 20 3d 20 | 5c 22 25 34 2e 34 73 5c |uthor = |\"%4.4s\|
|00002f40| 22 5c 6e 22 2c 0a 20 20 | 20 20 20 20 20 20 20 20 |"\n",. | |
|00002f50| 20 20 20 20 20 20 74 78 | 74 66 6e 61 6d 65 2c 20 | tx|tfname, |
|00002f60| 69 6e 66 6f 2e 74 79 70 | 65 2c 20 69 6e 66 6f 2e |info.typ|e, info.|
|00002f70| 61 75 74 68 29 3b 0a 20 | 20 20 20 20 20 20 20 69 |auth);. | i|
|00002f80| 66 20 28 28 74 78 74 66 | 69 6c 65 20 3d 20 66 6f |f ((txtf|ile = fo|
|00002f90| 70 65 6e 28 74 78 74 66 | 6e 61 6d 65 2c 20 22 72 |pen(txtf|name, "r|
|00002fa0| 22 29 29 20 3d 3d 20 4e | 55 4c 4c 29 20 7b 0a 20 |")) == N|ULL) {. |
|00002fb0| 20 20 20 20 20 20 20 20 | 20 20 20 69 66 20 28 28 | | if ((|
|00002fc0| 74 78 74 66 69 6c 65 20 | 3d 20 66 6f 70 65 6e 28 |txtfile |= fopen(|
|00002fd0| 74 78 74 66 6e 61 6d 65 | 2c 20 22 77 22 29 29 20 |txtfname|, "w")) |
|00002fe0| 3d 3d 20 4e 55 4c 4c 29 | 0a 20 20 20 20 20 20 20 |== NULL)|. |
|00002ff0| 20 20 20 20 20 20 20 20 | 20 65 72 72 6f 72 28 22 | | error("|
|00003000| 43 61 6e 6e 6f 74 20 6f | 70 65 6e 20 25 73 22 2c |Cannot o|pen %s",|
|00003010| 20 74 78 74 66 6e 61 6d | 65 29 3b 0a 20 20 20 20 | txtfnam|e);. |
|00003020| 20 20 20 20 20 20 20 20 | 7d 0a 20 20 20 20 20 20 | |}. |
|00003030| 20 20 65 6c 73 65 20 7b | 0a 20 20 20 20 20 20 20 | else {|. |
|00003040| 20 20 20 20 20 66 63 6c | 6f 73 65 28 74 78 74 66 | fcl|ose(txtf|
|00003050| 69 6c 65 29 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |ile);. | |
|00003060| 20 20 73 74 72 63 61 74 | 28 74 78 74 66 6e 61 6d | strcat|(txtfnam|
|00003070| 65 2c 20 73 75 66 66 69 | 78 29 3b 0a 20 20 20 20 |e, suffi|x);. |
|00003080| 20 20 20 20 20 20 20 20 | 69 66 20 28 28 74 78 74 | |if ((txt|
|00003090| 66 69 6c 65 20 3d 20 66 | 6f 70 65 6e 28 74 78 74 |file = f|open(txt|
|000030a0| 66 6e 61 6d 65 2c 20 22 | 77 22 29 29 20 3d 3d 20 |fname, "|w")) == |
|000030b0| 4e 55 4c 4c 29 0a 20 20 | 20 20 20 20 20 20 20 20 |NULL). | |
|000030c0| 20 20 20 20 20 20 65 72 | 72 6f 72 28 22 43 61 6e | er|ror("Can|
|000030d0| 6e 6f 74 20 6f 70 65 6e | 20 25 73 22 2c 20 74 78 |not open| %s", tx|
|000030e0| 74 66 6e 61 6d 65 29 3b | 0a 20 20 20 20 20 20 20 |tfname);|. |
|000030f0| 20 20 20 20 20 7d 0a 0a | 20 20 20 20 20 20 20 20 | }..| |
|00003100| 6e 63 68 61 72 73 20 3d | 20 6d 61 63 32 6c 6f 6e |nchars =| mac2lon|
|00003110| 67 28 2a 20 28 75 6c 6f | 6e 67 20 2a 29 20 69 6e |g(* (ulo|ng *) in|
|00003120| 66 6f 2e 64 6c 65 6e 29 | 3b 0a 20 20 20 20 20 20 |fo.dlen)|;. |
|00003130| 20 20 69 66 20 28 6d 6f | 64 65 20 3d 3d 20 54 45 | if (mo|de == TE|
|00003140| 58 54 29 20 77 68 69 6c | 65 20 28 6e 63 68 61 72 |XT) whil|e (nchar|
|00003150| 73 2d 2d 29 20 7b 0a 20 | 20 20 20 20 20 20 20 20 |s--) {. | |
|00003160| 20 20 20 62 20 3d 20 67 | 65 74 63 28 62 69 6e 66 | b = g|etc(binf|
|00003170| 69 6c 65 29 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |ile);. | |
|00003180| 20 20 69 66 20 28 62 20 | 3d 3d 20 43 52 29 20 62 | if (b |== CR) b|
|00003190| 20 3d 20 4c 46 3b 0a 20 | 20 20 20 20 20 20 20 20 | = LF;. | |
|000031a0| 20 20 20 70 75 74 63 28 | 62 2c 20 74 78 74 66 69 | putc(|b, txtfi|
|000031b0| 6c 65 29 3b 0a 20 20 20 | 20 20 20 20 20 20 20 20 |le);. | |
|000031c0| 20 7d 0a 20 20 20 20 20 | 20 20 20 65 6c 73 65 20 | }. | else |
|000031d0| 69 66 20 28 6d 6f 64 65 | 20 3d 3d 20 44 41 54 41 |if (mode| == DATA|
|000031e0| 29 20 77 68 69 6c 65 20 | 28 6e 63 68 61 72 73 2d |) while |(nchars-|
|000031f0| 2d 29 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 70 |-). | p|
|00003200| 75 74 63 28 67 65 74 63 | 28 62 69 6e 66 69 6c 65 |utc(getc|(binfile|
|00003210| 29 2c 20 74 78 74 66 69 | 6c 65 29 3b 0a 20 20 20 |), txtfi|le);. |
|00003220| 20 20 20 20 20 65 6c 73 | 65 20 7b 0a 20 20 20 20 | els|e {. |
|00003230| 20 20 20 20 20 20 20 20 | 77 68 69 6c 65 20 28 6e | |while (n|
|00003240| 63 68 61 72 73 2d 2d 29 | 20 67 65 74 63 28 62 69 |chars--)| getc(bi|
|00003250| 6e 66 69 6c 65 29 3b 0a | 20 20 20 20 20 20 20 20 |nfile);.| |
|00003260| 20 20 20 20 6e 63 68 61 | 72 73 20 3d 20 6d 61 63 | ncha|rs = mac|
|00003270| 32 6c 6f 6e 67 28 2a 20 | 28 75 6c 6f 6e 67 20 2a |2long(* |(ulong *|
|00003280| 29 20 69 6e 66 6f 2e 72 | 6c 65 6e 29 3b 0a 20 20 |) info.r|len);. |
|00003290| 20 20 20 20 20 20 20 20 | 20 20 77 68 69 6c 65 20 | | while |
|000032a0| 28 6e 63 68 61 72 73 2d | 2d 29 20 70 75 74 63 28 |(nchars-|-) putc(|
|000032b0| 67 65 74 63 28 62 69 6e | 66 69 6c 65 29 2c 20 74 |getc(bin|file), t|
|000032c0| 78 74 66 69 6c 65 29 3b | 0a 20 20 20 20 20 20 20 |xtfile);|. |
|000032d0| 20 20 20 20 20 7d 0a 0a | 20 20 20 20 20 20 20 20 | }..| |
|000032e0| 66 63 6c 6f 73 65 28 62 | 69 6e 66 69 6c 65 29 3b |fclose(b|infile);|
|000032f0| 0a 20 20 20 20 20 20 20 | 20 66 63 6c 6f 73 65 28 |. | fclose(|
|00003300| 74 78 74 66 69 6c 65 29 | 3b 0a 20 20 20 20 20 20 |txtfile)|;. |
|00003310| 20 20 7d 0a 20 20 20 20 | 7d 0a 2d 2d 2d 2d 2d 2d | }. |}.------|
|00003320| 20 45 4f 46 20 2d 2d 2d | 2d 2d 2d 0a 6c 73 20 2d | EOF ---|---.ls -|
|00003330| 6c 20 6d 63 76 65 72 74 | 2e 63 0a 66 69 20 23 20 |l mcvert|.c.fi # |
|00003340| 45 6e 64 20 6d 63 76 65 | 72 74 2e 63 0a 69 66 20 |End mcve|rt.c.if |
|00003350| 74 65 73 74 20 2d 66 20 | 68 71 78 69 66 79 2e 63 |test -f |hqxify.c|
|00003360| 0a 74 68 65 6e 0a 65 63 | 68 6f 20 73 68 61 72 3a |.then.ec|ho shar:|
|00003370| 20 77 69 6c 6c 20 6e 6f | 74 20 6f 76 65 72 77 72 | will no|t overwr|
|00003380| 69 74 65 20 65 78 69 73 | 74 69 6e 67 20 66 69 6c |ite exis|ting fil|
|00003390| 65 20 22 20 68 71 78 69 | 66 79 2e 63 20 22 0a 65 |e " hqxi|fy.c ".e|
|000033a0| 6c 73 65 0a 63 61 74 20 | 3e 68 71 78 69 66 79 2e |lse.cat |>hqxify.|
|000033b0| 63 20 3c 3c 27 2d 2d 2d | 2d 2d 2d 20 45 4f 46 20 |c <<'---|--- EOF |
|000033c0| 2d 2d 2d 2d 2d 2d 27 0a | 23 69 6e 63 6c 75 64 65 |------'.|#include|
|000033d0| 20 22 6d 61 63 74 79 70 | 65 73 2e 68 22 0a 0a 23 | "mactyp|es.h"..#|
|000033e0| 64 65 66 69 6e 65 20 48 | 51 58 42 55 46 4c 45 4e |define H|QXBUFLEN|
|000033f0| 20 35 31 32 0a 62 79 74 | 65 20 68 71 78 62 75 66 | 512.byt|e hqxbuf|
|00003400| 5b 48 51 58 42 55 46 4c | 45 4e 2b 31 5d 2c 20 2a |[HQXBUFL|EN+1], *|
|00003410| 62 75 66 5f 70 74 72 2c | 20 2a 62 75 66 5f 65 6e |buf_ptr,| *buf_en|
|00003420| 64 2c 20 2a 62 75 66 5f | 73 74 61 72 74 3d 68 71 |d, *buf_|start=hq|
|00003430| 78 62 75 66 2b 31 3b 0a | 0a 23 64 65 66 69 6e 65 |xbuf+1;.|.#define|
|00003440| 20 4d 41 58 4c 49 4e 45 | 20 32 35 35 0a 62 79 74 | MAXLINE| 255.byt|
|00003450| 65 20 6c 69 6e 65 5b 4d | 41 58 4c 49 4e 45 2b 31 |e line[M|AXLINE+1|
|00003460| 5d 2c 20 2a 6c 69 6e 65 | 5f 70 74 72 2c 20 2a 6c |], *line|_ptr, *l|
|00003470| 69 6e 65 5f 65 6e 64 2c | 20 2a 6c 69 6e 65 5f 73 |ine_end,| *line_s|
|00003480| 74 61 72 74 3d 6c 69 6e | 65 2b 31 3b 0a 0a 69 6e |tart=lin|e+1;..in|
|00003490| 74 20 6c 69 6e 65 5f 63 | 6f 75 6e 74 2c 20 66 69 |t line_c|ount, fi|
|000034a0| 6c 65 5f 63 6f 75 6e 74 | 3b 0a 69 6e 74 20 73 61 |le_count|;.int sa|
|000034b0| 76 65 5f 73 74 61 74 65 | 2c 20 74 6f 74 61 6c 5f |ve_state|, total_|
|000034c0| 62 79 74 65 73 2c 20 73 | 61 76 65 5f 72 75 6e 5f |bytes, s|ave_run_|
|000034d0| 6c 65 6e 67 74 68 3b 0a | 77 6f 72 64 20 73 61 76 |length;.|word sav|
|000034e0| 65 5f 6e 69 62 62 6c 65 | 3b 0a 63 68 61 72 20 62 |e_nibble|;.char b|
|000034f0| 69 6e 66 6e 61 6d 65 5b | 42 49 4e 4e 41 4d 45 4c |infname[|BINNAMEL|
|00003500| 45 4e 5d 2c 20 68 71 78 | 66 6e 61 6d 65 5b 42 49 |EN], hqx|fname[BI|
|00003510| 4e 4e 41 4d 45 4c 45 4e | 5d 3b 0a 46 49 4c 45 20 |NNAMELEN|];.FILE |
|00003520| 2a 68 71 78 66 69 6c 65 | 2c 20 2a 62 69 6e 66 69 |*hqxfile|, *binfi|
|00003530| 6c 65 3b 0a 0a 2f 2a 20 | 54 68 69 73 20 72 6f 75 |le;../* |This rou|
|00003540| 74 69 6e 65 20 72 65 61 | 64 73 20 74 68 65 20 68 |tine rea|ds the h|
|00003550| 65 61 64 65 72 20 6f 66 | 20 61 20 68 71 78 65 64 |eader of| a hqxed|
|00003560| 20 66 69 6c 65 20 61 6e | 64 20 61 70 70 72 6f 70 | file an|d approp|
|00003570| 72 69 61 74 65 6c 79 20 | 74 77 69 64 64 6c 65 73 |riately |twiddles|
|00003580| 20 69 74 2c 0a 20 20 20 | 20 64 65 74 65 72 6d 69 | it,. | determi|
|00003590| 6e 65 73 20 69 66 20 69 | 74 20 68 61 73 20 43 52 |nes if i|t has CR|
|000035a0| 43 20 70 72 6f 62 6c 65 | 6d 73 2c 20 63 72 65 61 |C proble|ms, crea|
|000035b0| 74 65 73 20 74 68 65 20 | 2e 62 69 6e 20 66 69 6c |tes the |.bin fil|
|000035c0| 65 2c 20 61 6e 64 20 70 | 75 74 73 20 74 68 65 20 |e, and p|uts the |
|000035d0| 69 6e 66 6f 0a 20 20 20 | 20 69 6e 74 6f 20 74 68 |info. | into th|
|000035e0| 65 20 2e 62 69 6e 20 66 | 69 6c 65 2e 0a 20 20 20 |e .bin f|ile.. |
|000035f0| 20 4f 75 74 70 75 74 20 | 69 73 20 68 71 78 5f 64 | Output |is hqx_d|
|00003600| 61 74 61 6c 65 6e 2c 20 | 68 71 78 5f 72 73 72 63 |atalen, |hqx_rsrc|
|00003610| 6c 65 6e 2c 20 74 79 70 | 65 2c 20 62 69 6e 66 6e |len, typ|e, binfn|
|00003620| 61 6d 65 2c 20 62 69 6e | 66 69 6c 65 20 2a 2f 0a |ame, bin|file */.|
|00003630| 0a 68 71 78 5f 74 6f 5f | 62 69 6e 5f 68 64 72 28 |.hqx_to_|bin_hdr(|
|00003640| 74 79 70 65 2c 20 68 71 | 78 5f 64 61 74 61 6c 65 |type, hq|x_datale|
|00003650| 6e 2c 20 68 71 78 5f 72 | 73 72 63 6c 65 6e 29 0a |n, hqx_r|srclen).|
|00003660| 63 68 61 72 20 2a 74 79 | 70 65 3b 0a 75 6c 6f 6e |char *ty|pe;.ulon|
|00003670| 67 20 2a 68 71 78 5f 64 | 61 74 61 6c 65 6e 2c 20 |g *hqx_d|atalen, |
|00003680| 2a 68 71 78 5f 72 73 72 | 63 6c 65 6e 3b 0a 7b 20 |*hqx_rsr|clen;.{ |
|00003690| 20 20 72 65 67 69 73 74 | 65 72 20 62 79 74 65 20 | regist|er byte |
|000036a0| 2a 68 71 78 5f 70 74 72 | 2c 20 2a 68 71 78 5f 65 |*hqx_ptr|, *hqx_e|
|000036b0| 6e 64 3b 0a 20 20 20 20 | 72 65 67 69 73 74 65 72 |nd;. |register|
|000036c0| 20 75 6c 6f 6e 67 20 63 | 61 6c 63 5f 63 72 63 3b | ulong c|alc_crc;|
|000036d0| 0a 20 20 20 20 68 71 78 | 5f 62 75 66 20 2a 68 71 |. hqx|_buf *hq|
|000036e0| 78 5f 62 6c 6f 63 6b 3b | 0a 20 20 20 20 68 71 78 |x_block;|. hqx|
|000036f0| 5f 68 65 61 64 65 72 20 | 2a 68 71 78 3b 0a 20 20 |_header |*hqx;. |
|00003700| 20 20 69 6e 66 6f 5f 68 | 65 61 64 65 72 20 69 6e | info_h|eader in|
|00003710| 66 6f 3b 0a 20 20 20 20 | 75 6c 6f 6e 67 20 6d 74 |fo;. |ulong mt|
|00003720| 69 6d 3b 0a 20 20 20 20 | 65 78 74 65 72 6e 20 77 |im;. |extern w|
|00003730| 6f 72 64 20 6d 61 67 69 | 63 5b 5d 3b 0a 20 20 20 |ord magi|c[];. |
|00003740| 20 65 78 74 65 72 6e 20 | 46 49 4c 45 20 2a 76 65 | extern |FILE *ve|
|00003750| 72 62 6f 73 65 3b 0a 20 | 20 20 20 65 78 74 65 72 |rbose;. | exter|
|00003760| 6e 20 63 68 61 72 20 2a | 64 69 72 2c 20 2a 65 78 |n char *|dir, *ex|
|00003770| 74 3b 0a 0a 20 20 20 20 | 2f 2a 20 72 65 61 64 20 |t;.. |/* read |
|00003780| 74 68 65 20 68 71 78 20 | 68 65 61 64 65 72 2c 20 |the hqx |header, |
|00003790| 61 73 73 75 6d 69 6e 67 | 20 74 68 61 74 20 49 20 |assuming| that I |
|000037a0| 77 6f 6e 27 74 20 65 78 | 68 61 75 73 74 20 68 71 |won't ex|haust hq|
|000037b0| 78 62 75 66 20 69 6e 20 | 73 6f 20 64 6f 69 6e 67 |xbuf in |so doing|
|000037c0| 20 2a 2f 0a 20 20 20 20 | 66 69 6c 6c 5f 68 71 78 | */. |fill_hqx|
|000037d0| 62 75 66 28 29 3b 0a 20 | 20 20 20 68 71 78 5f 62 |buf();. | hqx_b|
|000037e0| 6c 6f 63 6b 20 3d 20 28 | 68 71 78 5f 62 75 66 20 |lock = (|hqx_buf |
|000037f0| 2a 29 20 62 75 66 5f 70 | 74 72 3b 0a 20 20 20 20 |*) buf_p|tr;. |
|00003800| 68 71 78 20 3d 20 28 68 | 71 78 5f 68 65 61 64 65 |hqx = (h|qx_heade|
|00003810| 72 20 2a 29 20 28 68 71 | 78 5f 62 6c 6f 63 6b 2d |r *) (hq|x_block-|
|00003820| 3e 6e 61 6d 65 20 2b 20 | 68 71 78 5f 62 6c 6f 63 |>name + |hqx_bloc|
|00003830| 6b 2d 3e 6e 6c 65 6e 29 | 3b 0a 20 20 20 20 68 71 |k->nlen)|;. hq|
|00003840| 78 5f 70 74 72 20 3d 20 | 62 75 66 5f 70 74 72 3b |x_ptr = |buf_ptr;|
|00003850| 0a 20 20 20 20 68 71 78 | 5f 65 6e 64 20 3d 20 28 |. hqx|_end = (|
|00003860| 62 79 74 65 20 2a 29 20 | 68 71 78 20 2b 20 73 69 |byte *) |hqx + si|
|00003870| 7a 65 6f 66 28 68 71 78 | 5f 68 65 61 64 65 72 29 |zeof(hqx|_header)|
|00003880| 3b 0a 20 20 20 20 63 61 | 6c 63 5f 63 72 63 20 3d |;. ca|lc_crc =|
|00003890| 20 30 3b 0a 20 20 20 20 | 77 68 69 6c 65 20 28 68 | 0;. |while (h|
|000038a0| 71 78 5f 70 74 72 20 3c | 20 68 71 78 5f 65 6e 64 |qx_ptr <| hqx_end|
|000038b0| 29 0a 20 20 20 20 20 20 | 20 20 63 61 6c 63 5f 63 |). | calc_c|
|000038c0| 72 63 20 3d 20 28 28 28 | 63 61 6c 63 5f 63 72 63 |rc = (((|calc_crc|
|000038d0| 26 30 78 66 66 29 20 3c | 3c 20 38 29 20 7c 20 2a |&0xff) <|< 8) | *|
|000038e0| 68 71 78 5f 70 74 72 2b | 2b 29 20 5e 20 6d 61 67 |hqx_ptr+|+) ^ mag|
|000038f0| 69 63 5b 63 61 6c 63 5f | 63 72 63 20 3e 3e 20 38 |ic[calc_|crc >> 8|
|00003900| 5d 3b 0a 20 20 20 20 63 | 61 6c 63 5f 63 72 63 20 |];. c|alc_crc |
|00003910| 3d 20 28 28 63 61 6c 63 | 5f 63 72 63 26 30 78 66 |= ((calc|_crc&0xf|
|00003920| 66 29 20 3c 3c 20 38 29 | 20 5e 20 6d 61 67 69 63 |f) << 8)| ^ magic|
|00003930| 5b 63 61 6c 63 5f 63 72 | 63 20 3e 3e 20 38 5d 3b |[calc_cr|c >> 8];|
|00003940| 0a 20 20 20 20 63 61 6c | 63 5f 63 72 63 20 3d 20 |. cal|c_crc = |
|00003950| 28 28 63 61 6c 63 5f 63 | 72 63 26 30 78 66 66 29 |((calc_c|rc&0xff)|
|00003960| 20 3c 3c 20 38 29 20 5e | 20 6d 61 67 69 63 5b 63 | << 8) ^| magic[c|
|00003970| 61 6c 63 5f 63 72 63 20 | 3e 3e 20 38 5d 3b 0a 20 |alc_crc |>> 8];. |
|00003980| 20 20 20 62 75 66 5f 70 | 74 72 20 3d 20 68 71 78 | buf_p|tr = hqx|
|00003990| 5f 70 74 72 3b 0a 0a 20 | 20 20 20 2f 2a 20 73 74 |_ptr;.. | /* st|
|000039a0| 75 66 66 20 74 68 65 20 | 68 71 78 20 68 65 61 64 |uff the |hqx head|
|000039b0| 65 72 20 64 61 74 61 20 | 69 6e 74 6f 20 74 68 65 |er data |into the|
|000039c0| 20 69 6e 66 6f 20 68 65 | 61 64 65 72 20 2a 2f 0a | info he|ader */.|
|000039d0| 20 20 20 20 62 7a 65 72 | 6f 28 26 69 6e 66 6f 2c | bzer|o(&info,|
|000039e0| 20 73 69 7a 65 6f 66 28 | 69 6e 66 6f 5f 68 65 61 | sizeof(|info_hea|
|000039f0| 64 65 72 29 29 3b 0a 20 | 20 20 20 69 6e 66 6f 2e |der));. | info.|
|00003a00| 6e 6c 65 6e 20 3d 20 68 | 71 78 5f 62 6c 6f 63 6b |nlen = h|qx_block|
|00003a10| 2d 3e 6e 6c 65 6e 3b 0a | 20 20 20 20 73 74 72 6e |->nlen;.| strn|
|00003a20| 63 70 79 28 69 6e 66 6f | 2e 6e 61 6d 65 2c 20 68 |cpy(info|.name, h|
|00003a30| 71 78 5f 62 6c 6f 63 6b | 2d 3e 6e 61 6d 65 2c 20 |qx_block|->name, |
|00003a40| 69 6e 66 6f 2e 6e 6c 65 | 6e 29 3b 20 20 20 20 20 |info.nle|n); |
|00003a50| 2f 2a 20 6e 61 6d 65 20 | 2a 2f 0a 20 20 20 20 62 |/* name |*/. b|
|00003a60| 63 6f 70 79 28 68 71 78 | 2d 3e 74 79 70 65 2c 20 |copy(hqx|->type, |
|00003a70| 69 6e 66 6f 2e 74 79 70 | 65 2c 20 39 29 3b 20 20 |info.typ|e, 9); |
|00003a80| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2a 20 74 79 | | /* ty|
|00003a90| 70 65 2c 20 61 75 74 68 | 6f 72 2c 20 66 6c 61 67 |pe, auth|or, flag|
|00003aa0| 20 2a 2f 0a 20 20 20 20 | 69 6e 66 6f 2e 66 6c 61 | */. |info.fla|
|00003ab0| 67 73 20 20 26 3d 20 30 | 78 37 65 3b 20 20 20 20 |gs &= 0|x7e; |
|00003ac0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003ad0| 20 20 20 20 2f 2a 20 72 | 65 73 65 74 20 6c 6f 63 | /* r|eset loc|
|00003ae0| 6b 20 62 69 74 2c 20 69 | 6e 69 74 20 62 69 74 20 |k bit, i|nit bit |
|00003af0| 2a 2f 0a 20 20 20 20 69 | 66 20 28 68 71 78 2d 3e |*/. i|f (hqx->|
|00003b00| 70 72 6f 74 65 63 74 20 | 26 20 30 78 34 30 29 20 |protect |& 0x40) |
|00003b10| 69 6e 66 6f 2e 70 72 6f | 74 65 63 74 20 3d 20 31 |info.pro|tect = 1|
|00003b20| 3b 20 20 2f 2a 20 63 6f | 70 79 20 70 72 6f 74 65 |; /* co|py prote|
|00003b30| 63 74 20 62 69 74 20 2a | 2f 0a 20 20 20 20 62 63 |ct bit *|/. bc|
|00003b40| 6f 70 79 28 68 71 78 2d | 3e 64 6c 65 6e 2c 20 69 |opy(hqx-|>dlen, i|
|00003b50| 6e 66 6f 2e 64 6c 65 6e | 2c 20 38 29 3b 20 20 20 |nfo.dlen|, 8); |
|00003b60| 20 20 20 20 20 20 20 20 | 20 20 2f 2a 20 64 6c 65 | | /* dle|
|00003b70| 6e 2c 20 72 6c 65 6e 20 | 2a 2f 0a 20 20 20 20 6d |n, rlen |*/. m|
|00003b80| 74 69 6d 20 3d 20 74 69 | 6d 65 32 6d 61 63 28 74 |tim = ti|me2mac(t|
|00003b90| 69 6d 65 28 30 29 29 3b | 0a 20 20 20 20 62 63 6f |ime(0));|. bco|
|00003ba0| 70 79 28 26 6d 74 69 6d | 2c 20 69 6e 66 6f 2e 6d |py(&mtim|, info.m|
|00003bb0| 74 69 6d 2c 20 34 29 3b | 0a 20 20 20 20 62 63 6f |tim, 4);|. bco|
|00003bc0| 70 79 28 26 6d 74 69 6d | 2c 20 69 6e 66 6f 2e 63 |py(&mtim|, info.c|
|00003bd0| 74 69 6d 2c 20 34 29 3b | 0a 0a 20 20 20 20 2f 2a |tim, 4);|.. /*|
|00003be0| 20 43 72 65 61 74 65 20 | 74 68 65 20 2e 62 69 6e | Create |the .bin|
|00003bf0| 20 66 69 6c 65 20 61 6e | 64 20 77 72 69 74 65 20 | file an|d write |
|00003c00| 74 68 65 20 69 6e 66 6f | 20 74 6f 20 69 74 20 2a |the info| to it *|
|00003c10| 2f 0a 20 20 20 20 75 6e | 69 78 69 66 79 28 68 71 |/. un|ixify(hq|
|00003c20| 78 5f 62 6c 6f 63 6b 2d | 3e 6e 61 6d 65 29 3b 0a |x_block-|>name);.|
|00003c30| 20 20 20 20 73 70 72 69 | 6e 74 66 28 62 69 6e 66 | spri|ntf(binf|
|00003c40| 6e 61 6d 65 2c 20 22 25 | 73 2f 25 73 25 73 22 2c |name, "%|s/%s%s",|
|00003c50| 20 64 69 72 2c 20 68 71 | 78 5f 62 6c 6f 63 6b 2d | dir, hq|x_block-|
|00003c60| 3e 6e 61 6d 65 2c 20 65 | 78 74 29 3b 0a 20 20 20 |>name, e|xt);. |
|00003c70| 20 66 70 72 69 6e 74 66 | 28 76 65 72 62 6f 73 65 | fprintf|(verbose|
|00003c80| 2c 0a 20 20 20 20 20 20 | 20 20 22 43 6f 6e 76 65 |,. | "Conve|
|00003c90| 72 74 69 6e 67 20 20 20 | 20 20 25 2d 33 30 73 20 |rting | %-30s |
|00003ca0| 74 79 70 65 20 3d 20 5c | 22 25 34 2e 34 73 5c 22 |type = \|"%4.4s\"|
|00003cb0| 2c 20 61 75 74 68 6f 72 | 20 3d 20 5c 22 25 34 2e |, author| = \"%4.|
|00003cc0| 34 73 5c 22 5c 6e 22 2c | 0a 20 20 20 20 20 20 20 |4s\"\n",|. |
|00003cd0| 20 68 71 78 5f 62 6c 6f | 63 6b 2d 3e 6e 61 6d 65 | hqx_blo|ck->name|
|00003ce0| 2c 20 69 6e 66 6f 2e 74 | 79 70 65 2c 20 69 6e 66 |, info.t|ype, inf|
|00003cf0| 6f 2e 61 75 74 68 29 3b | 0a 20 20 20 20 69 66 20 |o.auth);|. if |
|00003d00| 28 28 62 69 6e 66 69 6c | 65 20 3d 20 66 6f 70 65 |((binfil|e = fope|
|00003d10| 6e 28 62 69 6e 66 6e 61 | 6d 65 2c 20 22 77 22 29 |n(binfna|me, "w")|
|00003d20| 29 20 3d 3d 20 4e 55 4c | 4c 29 0a 20 20 20 20 20 |) == NUL|L). |
|00003d30| 20 20 20 65 72 72 6f 72 | 28 22 43 61 6e 6e 6f 74 | error|("Cannot|
|00003d40| 20 6f 70 65 6e 20 25 73 | 22 2c 20 62 69 6e 66 6e | open %s|", binfn|
|00003d50| 61 6d 65 29 3b 0a 20 20 | 20 20 63 68 65 63 6b 5f |ame);. | check_|
|00003d60| 68 71 78 5f 63 72 63 28 | 63 61 6c 63 5f 63 72 63 |hqx_crc(|calc_crc|
|00003d70| 2c 20 22 46 69 6c 65 20 | 68 65 61 64 65 72 20 43 |, "File |header C|
|00003d80| 52 43 20 6d 69 73 6d 61 | 74 63 68 20 69 6e 20 25 |RC misma|tch in %|
|00003d90| 73 22 2c 20 62 69 6e 66 | 6e 61 6d 65 29 3b 0a 20 |s", binf|name);. |
|00003da0| 20 20 20 66 77 72 69 74 | 65 28 26 69 6e 66 6f 2c | fwrit|e(&info,|
|00003db0| 20 73 69 7a 65 6f 66 28 | 69 6e 66 6f 29 2c 20 31 | sizeof(|info), 1|
|00003dc0| 2c 20 62 69 6e 66 69 6c | 65 29 3b 0a 0a 20 20 20 |, binfil|e);.. |
|00003dd0| 20 2f 2a 20 47 65 74 20 | 61 20 63 6f 75 70 6c 65 | /* Get |a couple|
|00003de0| 20 6f 66 20 69 74 65 6d | 73 20 77 65 27 6c 6c 20 | of item|s we'll |
|00003df0| 6e 65 65 64 20 6c 61 74 | 65 72 20 2a 2f 0a 20 20 |need lat|er */. |
|00003e00| 20 20 62 63 6f 70 79 28 | 69 6e 66 6f 2e 64 6c 65 | bcopy(|info.dle|
|00003e10| 6e 2c 20 68 71 78 5f 64 | 61 74 61 6c 65 6e 2c 20 |n, hqx_d|atalen, |
|00003e20| 34 29 3b 0a 20 20 20 20 | 2a 68 71 78 5f 64 61 74 |4);. |*hqx_dat|
|00003e30| 61 6c 65 6e 20 3d 20 6d | 61 63 32 6c 6f 6e 67 28 |alen = m|ac2long(|
|00003e40| 2a 68 71 78 5f 64 61 74 | 61 6c 65 6e 29 3b 0a 20 |*hqx_dat|alen);. |
|00003e50| 20 20 20 62 63 6f 70 79 | 28 69 6e 66 6f 2e 72 6c | bcopy|(info.rl|
|00003e60| 65 6e 2c 20 68 71 78 5f | 72 73 72 63 6c 65 6e 2c |en, hqx_|rsrclen,|
|00003e70| 20 34 29 3b 0a 20 20 20 | 20 2a 68 71 78 5f 72 73 | 4);. | *hqx_rs|
|00003e80| 72 63 6c 65 6e 20 3d 20 | 6d 61 63 32 6c 6f 6e 67 |rclen = |mac2long|
|00003e90| 28 2a 68 71 78 5f 72 73 | 72 63 6c 65 6e 29 3b 0a |(*hqx_rs|rclen);.|
|00003ea0| 20 20 20 20 62 63 6f 70 | 79 28 69 6e 66 6f 2e 74 | bcop|y(info.t|
|00003eb0| 79 70 65 2c 20 74 79 70 | 65 2c 20 34 29 3b 0a 20 |ype, typ|e, 4);. |
|00003ec0| 20 20 20 7d 0a 0a 2f 2a | 20 54 68 69 73 20 72 6f | }../*| This ro|
|00003ed0| 75 74 69 6e 65 20 72 65 | 61 64 73 20 74 68 65 20 |utine re|ads the |
|00003ee0| 68 65 61 64 65 72 20 6f | 66 20 61 20 62 69 6e 20 |header o|f a bin |
|00003ef0| 66 69 6c 65 20 61 6e 64 | 20 61 70 70 72 6f 70 72 |file and| appropr|
|00003f00| 69 61 74 65 6c 79 20 74 | 77 69 64 64 6c 65 73 20 |iately t|widdles |
|00003f10| 69 74 2c 0a 20 20 20 20 | 63 72 65 61 74 65 73 20 |it,. |creates |
|00003f20| 74 68 65 20 2e 68 71 78 | 20 66 69 6c 65 2c 20 61 |the .hqx| file, a|
|00003f30| 6e 64 20 70 75 74 73 20 | 74 68 65 20 69 6e 66 6f |nd puts |the info|
|00003f40| 20 69 6e 74 6f 20 74 68 | 65 20 2e 68 71 78 20 66 | into th|e .hqx f|
|00003f50| 69 6c 65 2e 0a 20 20 20 | 20 4f 75 74 70 75 74 20 |ile.. | Output |
|00003f60| 69 73 20 68 71 78 5f 64 | 61 74 61 6c 65 6e 2c 20 |is hqx_d|atalen, |
|00003f70| 68 71 78 5f 72 73 72 63 | 6c 65 6e 2c 20 74 79 70 |hqx_rsrc|len, typ|
|00003f80| 65 2c 20 68 71 78 66 6e | 61 6d 65 2c 20 68 71 78 |e, hqxfn|ame, hqx|
|00003f90| 66 69 6c 65 20 2a 2f 0a | 0a 62 69 6e 5f 74 6f 5f |file */.|.bin_to_|
|00003fa0| 68 71 78 5f 68 64 72 28 | 68 71 78 5f 64 61 74 61 |hqx_hdr(|hqx_data|
|00003fb0| 6c 65 6e 2c 20 68 71 78 | 5f 72 73 72 63 6c 65 6e |len, hqx|_rsrclen|
|00003fc0| 29 0a 75 6c 6f 6e 67 20 | 2a 68 71 78 5f 64 61 74 |).ulong |*hqx_dat|
|00003fd0| 61 6c 65 6e 2c 20 2a 68 | 71 78 5f 72 73 72 63 6c |alen, *h|qx_rsrcl|
|00003fe0| 65 6e 3b 0a 7b 20 20 20 | 72 65 67 69 73 74 65 72 |en;.{ |register|
|00003ff0| 20 62 79 74 65 20 2a 68 | 71 78 5f 70 74 72 2c 20 | byte *h|qx_ptr, |
|00004000| 2a 68 71 78 5f 65 6e 64 | 3b 0a 20 20 20 20 72 65 |*hqx_end|;. re|
|00004010| 67 69 73 74 65 72 20 75 | 6c 6f 6e 67 20 63 61 6c |gister u|long cal|
|00004020| 63 5f 63 72 63 3b 0a 20 | 20 20 20 68 71 78 5f 62 |c_crc;. | hqx_b|
|00004030| 75 66 20 2a 68 71 78 5f | 62 6c 6f 63 6b 3b 0a 20 |uf *hqx_|block;. |
|00004040| 20 20 20 68 71 78 5f 68 | 65 61 64 65 72 20 2a 68 | hqx_h|eader *h|
|00004050| 71 78 3b 0a 20 20 20 20 | 69 6e 66 6f 5f 68 65 61 |qx;. |info_hea|
|00004060| 64 65 72 20 69 6e 66 6f | 3b 0a 20 20 20 20 65 78 |der info|;. ex|
|00004070| 74 65 72 6e 20 77 6f 72 | 64 20 6d 61 67 69 63 5b |tern wor|d magic[|
|00004080| 5d 3b 0a 20 20 20 20 65 | 78 74 65 72 6e 20 46 49 |];. e|xtern FI|
|00004090| 4c 45 20 2a 76 65 72 62 | 6f 73 65 3b 0a 20 20 20 |LE *verb|ose;. |
|000040a0| 20 65 78 74 65 72 6e 20 | 63 68 61 72 20 2a 2a 68 | extern |char **h|
|000040b0| 71 78 6e 61 6d 65 73 5f | 6c 65 66 74 3b 0a 20 20 |qxnames_|left;. |
|000040c0| 20 20 65 78 74 65 72 6e | 20 63 68 61 72 20 2a 65 | extern| char *e|
|000040d0| 78 74 3b 0a 0a 20 20 20 | 20 73 74 72 63 70 79 28 |xt;.. | strcpy(|
|000040e0| 62 69 6e 66 6e 61 6d 65 | 2c 20 2a 68 71 78 6e 61 |binfname|, *hqxna|
|000040f0| 6d 65 73 5f 6c 65 66 74 | 2b 2b 29 3b 0a 20 20 20 |mes_left|++);. |
|00004100| 20 69 66 20 28 21 28 62 | 69 6e 66 69 6c 65 20 3d | if (!(b|infile =|
|00004110| 20 66 6f 70 65 6e 28 62 | 69 6e 66 6e 61 6d 65 2c | fopen(b|infname,|
|00004120| 20 22 72 22 29 29 29 20 | 7b 0a 20 20 20 20 20 20 | "r"))) |{. |
|00004130| 20 20 2f 2a 20 4d 61 79 | 62 65 20 77 65 20 61 72 | /* May|be we ar|
|00004140| 65 20 73 75 70 70 6f 73 | 65 64 20 74 6f 20 66 69 |e suppos|ed to fi|
|00004150| 67 75 72 65 20 6f 75 74 | 20 74 68 65 20 73 75 66 |gure out| the suf|
|00004160| 66 69 78 20 6f 75 72 73 | 65 6c 76 65 73 3f 20 2a |fix ours|elves? *|
|00004170| 2f 0a 20 20 20 20 20 20 | 20 20 73 74 72 63 61 74 |/. | strcat|
|00004180| 28 62 69 6e 66 6e 61 6d | 65 2c 20 65 78 74 29 3b |(binfnam|e, ext);|
|00004190| 0a 20 20 20 20 20 20 20 | 20 69 66 20 28 21 28 62 |. | if (!(b|
|000041a0| 69 6e 66 69 6c 65 20 3d | 20 66 6f 70 65 6e 28 62 |infile =| fopen(b|
|000041b0| 69 6e 66 6e 61 6d 65 2c | 20 22 72 22 29 29 29 0a |infname,| "r"))).|
|000041c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 65 72 72 6f | | erro|
|000041d0| 72 28 22 43 61 6e 6e 6f | 74 20 6f 70 65 6e 20 25 |r("Canno|t open %|
|000041e0| 73 22 2c 20 62 69 6e 66 | 6e 61 6d 65 29 3b 0a 20 |s", binf|name);. |
|000041f0| 20 20 20 20 20 20 20 7d | 0a 20 20 20 20 69 66 20 | }|. if |
|00004200| 28 21 66 72 65 61 64 28 | 26 69 6e 66 6f 2c 20 73 |(!fread(|&info, s|
|00004210| 69 7a 65 6f 66 28 69 6e | 66 6f 29 2c 20 31 2c 20 |izeof(in|fo), 1, |
|00004220| 62 69 6e 66 69 6c 65 29 | 29 0a 20 20 20 20 20 20 |binfile)|). |
|00004230| 20 20 65 72 72 6f 72 28 | 22 55 6e 65 78 70 65 63 | error(|"Unexpec|
|00004240| 74 65 64 20 45 4f 46 20 | 69 6e 20 68 65 61 64 65 |ted EOF |in heade|
|00004250| 72 20 6f 66 20 25 73 22 | 2c 20 62 69 6e 66 6e 61 |r of %s"|, binfna|
|00004260| 6d 65 29 3b 0a 0a 20 20 | 20 20 2f 2a 20 73 74 75 |me);.. | /* stu|
|00004270| 66 66 20 74 68 65 20 69 | 6e 66 6f 20 68 65 61 64 |ff the i|nfo head|
|00004280| 65 72 20 69 6e 74 6f 20 | 74 68 65 20 68 71 78 20 |er into |the hqx |
|00004290| 68 65 61 64 65 72 20 2a | 2f 0a 20 20 20 20 68 71 |header *|/. hq|
|000042a0| 78 5f 62 6c 6f 63 6b 20 | 3d 20 28 68 71 78 5f 62 |x_block |= (hqx_b|
|000042b0| 75 66 20 2a 29 20 62 75 | 66 5f 70 74 72 3b 0a 20 |uf *) bu|f_ptr;. |
|000042c0| 20 20 20 68 71 78 5f 62 | 6c 6f 63 6b 2d 3e 6e 6c | hqx_b|lock->nl|
|000042d0| 65 6e 20 3d 20 69 6e 66 | 6f 2e 6e 6c 65 6e 3b 0a |en = inf|o.nlen;.|
|000042e0| 20 20 20 20 73 74 72 6e | 63 70 79 28 68 71 78 5f | strn|cpy(hqx_|
|000042f0| 62 6c 6f 63 6b 2d 3e 6e | 61 6d 65 2c 20 69 6e 66 |block->n|ame, inf|
|00004300| 6f 2e 6e 61 6d 65 2c 20 | 69 6e 66 6f 2e 6e 6c 65 |o.name, |info.nle|
|00004310| 6e 29 3b 0a 20 20 20 20 | 68 71 78 20 3d 20 28 68 |n);. |hqx = (h|
|00004320| 71 78 5f 68 65 61 64 65 | 72 20 2a 29 20 28 68 71 |qx_heade|r *) (hq|
|00004330| 78 5f 62 6c 6f 63 6b 2d | 3e 6e 61 6d 65 20 2b 20 |x_block-|>name + |
|00004340| 68 71 78 5f 62 6c 6f 63 | 6b 2d 3e 6e 6c 65 6e 29 |hqx_bloc|k->nlen)|
|00004350| 3b 0a 20 20 20 20 68 71 | 78 2d 3e 76 65 72 73 69 |;. hq|x->versi|
|00004360| 6f 6e 20 20 3d 20 30 3b | 0a 20 20 20 20 62 63 6f |on = 0;|. bco|
|00004370| 70 79 28 69 6e 66 6f 2e | 74 79 70 65 2c 20 68 71 |py(info.|type, hq|
|00004380| 78 2d 3e 74 79 70 65 2c | 20 39 29 3b 20 20 20 20 |x->type,| 9); |
|00004390| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 74 79 70 65 | | /* type|
|000043a0| 2c 20 61 75 74 68 6f 72 | 2c 20 66 6c 61 67 73 20 |, author|, flags |
|000043b0| 2a 2f 0a 20 20 20 20 69 | 66 20 28 69 6e 66 6f 2e |*/. i|f (info.|
|000043c0| 70 72 6f 74 65 63 74 20 | 3d 20 31 29 20 68 71 78 |protect |= 1) hqx|
|000043d0| 2d 3e 70 72 6f 74 65 63 | 74 20 3d 20 30 3b 20 20 |->protec|t = 0; |
|000043e0| 20 20 20 2f 2a 20 70 72 | 6f 74 65 63 74 20 62 69 | /* pr|otect bi|
|000043f0| 74 3a 20 30 78 34 30 20 | 2a 2f 0a 20 20 20 20 65 |t: 0x40 |*/. e|
|00004400| 6c 73 65 20 68 71 78 2d | 3e 70 72 6f 74 65 63 74 |lse hqx-|>protect|
|00004410| 20 3d 20 30 3b 0a 20 20 | 20 20 62 63 6f 70 79 28 | = 0;. | bcopy(|
|00004420| 69 6e 66 6f 2e 64 6c 65 | 6e 2c 20 68 71 78 2d 3e |info.dle|n, hqx->|
|00004430| 64 6c 65 6e 2c 20 38 29 | 3b 20 20 20 20 20 20 20 |dlen, 8)|; |
|00004440| 20 20 20 20 20 20 2f 2a | 20 64 6c 65 6e 2c 20 72 | /*| dlen, r|
|00004450| 6c 65 6e 20 2a 2f 0a 0a | 20 20 20 20 2f 2a 20 43 |len */..| /* C|
|00004460| 72 65 61 74 65 20 74 68 | 65 20 2e 68 71 78 20 66 |reate th|e .hqx f|
|00004470| 69 6c 65 20 61 6e 64 20 | 77 72 69 74 65 20 74 68 |ile and |write th|
|00004480| 65 20 69 6e 66 6f 20 74 | 6f 20 69 74 20 2a 2f 0a |e info t|o it */.|
|00004490| 20 20 20 20 73 74 72 6e | 63 70 79 28 68 71 78 66 | strn|cpy(hqxf|
|000044a0| 6e 61 6d 65 2c 20 69 6e | 66 6f 2e 6e 61 6d 65 2c |name, in|fo.name,|
|000044b0| 20 69 6e 66 6f 2e 6e 6c | 65 6e 29 3b 0a 20 20 20 | info.nl|en);. |
|000044c0| 20 75 6e 69 78 69 66 79 | 28 68 71 78 66 6e 61 6d | unixify|(hqxfnam|
|000044d0| 65 29 3b 0a 20 20 20 20 | 66 70 72 69 6e 74 66 28 |e);. |fprintf(|
|000044e0| 76 65 72 62 6f 73 65 2c | 0a 20 20 20 20 20 20 20 |verbose,|. |
|000044f0| 20 22 43 6f 6e 76 65 72 | 74 69 6e 67 20 20 20 20 | "Conver|ting |
|00004500| 20 25 2d 33 30 73 20 74 | 79 70 65 20 3d 20 5c 22 | %-30s t|ype = \"|
|00004510| 25 34 2e 34 73 5c 22 2c | 20 61 75 74 68 6f 72 20 |%4.4s\",| author |
|00004520| 3d 20 5c 22 25 34 2e 34 | 73 5c 22 5c 6e 22 2c 0a |= \"%4.4|s\"\n",.|
|00004530| 20 20 20 20 20 20 20 20 | 68 71 78 66 6e 61 6d 65 | |hqxfname|
|00004540| 2c 20 69 6e 66 6f 2e 74 | 79 70 65 2c 20 69 6e 66 |, info.t|ype, inf|
|00004550| 6f 2e 61 75 74 68 29 3b | 0a 0a 20 20 20 20 63 61 |o.auth);|.. ca|
|00004560| 6c 63 5f 63 72 63 20 3d | 20 30 3b 0a 20 20 20 20 |lc_crc =| 0;. |
|00004570| 68 71 78 5f 70 74 72 20 | 3d 20 28 62 79 74 65 20 |hqx_ptr |= (byte |
|00004580| 2a 29 20 68 71 78 5f 62 | 6c 6f 63 6b 3b 0a 20 20 |*) hqx_b|lock;. |
|00004590| 20 20 68 71 78 5f 65 6e | 64 20 3d 20 68 71 78 5f | hqx_en|d = hqx_|
|000045a0| 70 74 72 20 2b 20 31 20 | 2b 20 68 71 78 5f 62 6c |ptr + 1 |+ hqx_bl|
|000045b0| 6f 63 6b 2d 3e 6e 6c 65 | 6e 20 2b 20 73 69 7a 65 |ock->nle|n + size|
|000045c0| 6f 66 28 68 71 78 5f 68 | 65 61 64 65 72 29 3b 0a |of(hqx_h|eader);.|
|000045d0| 20 20 20 20 77 68 69 6c | 65 20 28 68 71 78 5f 70 | whil|e (hqx_p|
|000045e0| 74 72 20 3c 20 68 71 78 | 5f 65 6e 64 29 0a 20 20 |tr < hqx|_end). |
|000045f0| 20 20 20 20 20 20 63 61 | 6c 63 5f 63 72 63 20 3d | ca|lc_crc =|
|00004600| 20 28 28 28 63 61 6c 63 | 5f 63 72 63 26 30 78 66 | (((calc|_crc&0xf|
|00004610| 66 29 20 3c 3c 20 38 29 | 20 7c 20 2a 68 71 78 5f |f) << 8)| | *hqx_|
|00004620| 70 74 72 2b 2b 29 20 5e | 20 6d 61 67 69 63 5b 63 |ptr++) ^| magic[c|
|00004630| 61 6c 63 5f 63 72 63 20 | 3e 3e 20 38 5d 3b 0a 20 |alc_crc |>> 8];. |
|00004640| 20 20 20 63 61 6c 63 5f | 63 72 63 20 3d 20 28 28 | calc_|crc = ((|
|00004650| 63 61 6c 63 5f 63 72 63 | 26 30 78 66 66 29 20 3c |calc_crc|&0xff) <|
|00004660| 3c 20 38 29 20 5e 20 6d | 61 67 69 63 5b 63 61 6c |< 8) ^ m|agic[cal|
|00004670| 63 5f 63 72 63 20 3e 3e | 20 38 5d 3b 0a 20 20 20 |c_crc >>| 8];. |
|00004680| 20 63 61 6c 63 5f 63 72 | 63 20 3d 20 28 28 63 61 | calc_cr|c = ((ca|
|00004690| 6c 63 5f 63 72 63 26 30 | 78 66 66 29 20 3c 3c 20 |lc_crc&0|xff) << |
|000046a0| 38 29 20 5e 20 6d 61 67 | 69 63 5b 63 61 6c 63 5f |8) ^ mag|ic[calc_|
|000046b0| 63 72 63 20 3e 3e 20 38 | 5d 3b 0a 20 20 20 20 62 |crc >> 8|];. b|
|000046c0| 75 66 5f 70 74 72 20 3d | 20 68 71 78 5f 65 6e 64 |uf_ptr =| hqx_end|
|000046d0| 3b 0a 20 20 20 20 77 72 | 69 74 65 5f 68 71 78 5f |;. wr|ite_hqx_|
|000046e0| 63 72 63 28 63 61 6c 63 | 5f 63 72 63 29 3b 0a 0a |crc(calc|_crc);..|
|000046f0| 20 20 20 20 2f 2a 20 47 | 65 74 20 61 20 63 6f 75 | /* G|et a cou|
|00004700| 70 6c 65 20 6f 66 20 69 | 74 65 6d 73 20 77 65 27 |ple of i|tems we'|
|00004710| 6c 6c 20 6e 65 65 64 20 | 6c 61 74 65 72 20 2a 2f |ll need |later */|
|00004720| 0a 20 20 20 20 62 63 6f | 70 79 28 69 6e 66 6f 2e |. bco|py(info.|
|00004730| 64 6c 65 6e 2c 20 68 71 | 78 5f 64 61 74 61 6c 65 |dlen, hq|x_datale|
|00004740| 6e 2c 20 34 29 3b 0a 20 | 20 20 20 2a 68 71 78 5f |n, 4);. | *hqx_|
|00004750| 64 61 74 61 6c 65 6e 20 | 3d 20 6d 61 63 32 6c 6f |datalen |= mac2lo|
|00004760| 6e 67 28 2a 68 71 78 5f | 64 61 74 61 6c 65 6e 29 |ng(*hqx_|datalen)|
|00004770| 3b 0a 20 20 20 20 62 63 | 6f 70 79 28 69 6e 66 6f |;. bc|opy(info|
|00004780| 2e 72 6c 65 6e 2c 20 68 | 71 78 5f 72 73 72 63 6c |.rlen, h|qx_rsrcl|
|00004790| 65 6e 2c 20 34 29 3b 0a | 20 20 20 20 2a 68 71 78 |en, 4);.| *hqx|
|000047a0| 5f 72 73 72 63 6c 65 6e | 20 3d 20 6d 61 63 32 6c |_rsrclen| = mac2l|
|000047b0| 6f 6e 67 28 2a 68 71 78 | 5f 72 73 72 63 6c 65 6e |ong(*hqx|_rsrclen|
|000047c0| 29 3b 0a 20 20 20 20 7d | 0a 0a 0a 2f 2a 20 54 68 |);. }|.../* Th|
|000047d0| 69 73 20 72 6f 75 74 69 | 6e 65 20 63 6f 70 69 65 |is routi|ne copie|
|000047e0| 73 20 62 79 74 65 73 20 | 66 72 6f 6d 20 74 68 65 |s bytes |from the|
|000047f0| 20 64 65 63 6f 64 65 64 | 20 69 6e 70 75 74 20 73 | decoded| input s|
|00004800| 74 72 65 61 6d 20 74 6f | 20 74 68 65 20 6f 75 74 |tream to| the out|
|00004810| 70 75 74 2e 20 20 0a 20 | 20 20 20 49 74 20 61 6c |put. . | It al|
|00004820| 73 6f 20 70 61 64 73 20 | 74 6f 20 61 20 6d 75 6c |so pads |to a mul|
|00004830| 74 69 70 6c 65 20 6f 66 | 20 31 32 38 20 62 79 74 |tiple of| 128 byt|
|00004840| 65 73 20 6f 6e 20 74 68 | 65 20 6f 75 74 70 75 74 |es on th|e output|
|00004850| 2c 20 77 68 69 63 68 20 | 69 73 20 70 61 72 74 0a |, which |is part.|
|00004860| 20 20 20 20 6f 66 20 74 | 68 65 20 2e 62 69 6e 20 | of t|he .bin |
|00004870| 66 6f 72 6d 61 74 20 2a | 2f 0a 77 6f 72 64 20 68 |format *|/.word h|
|00004880| 71 78 5f 74 6f 5f 62 69 | 6e 5f 66 6f 72 6b 28 6e |qx_to_bi|n_fork(n|
|00004890| 62 79 74 65 73 29 0a 72 | 65 67 69 73 74 65 72 20 |bytes).r|egister |
|000048a0| 75 6c 6f 6e 67 20 6e 62 | 79 74 65 73 3b 0a 7b 20 |ulong nb|ytes;.{ |
|000048b0| 20 20 72 65 67 69 73 74 | 65 72 20 62 79 74 65 20 | regist|er byte |
|000048c0| 2a 63 3b 0a 20 20 20 20 | 72 65 67 69 73 74 65 72 |*c;. |register|
|000048d0| 20 75 6c 6f 6e 67 20 63 | 61 6c 63 5f 63 72 63 3b | ulong c|alc_crc;|
|000048e0| 0a 20 20 20 20 72 65 67 | 69 73 74 65 72 20 69 6e |. reg|ister in|
|000048f0| 74 20 63 5f 6c 65 6e 67 | 74 68 3b 0a 20 20 20 20 |t c_leng|th;. |
|00004900| 75 6c 6f 6e 67 20 65 78 | 74 72 61 5f 62 79 74 65 |ulong ex|tra_byte|
|00004910| 73 3b 0a 20 20 20 20 65 | 78 74 65 72 6e 20 77 6f |s;. e|xtern wo|
|00004920| 72 64 20 6d 61 67 69 63 | 5b 5d 3b 0a 0a 20 20 20 |rd magic|[];.. |
|00004930| 20 65 78 74 72 61 5f 62 | 79 74 65 73 20 3d 20 31 | extra_b|ytes = 1|
|00004940| 32 37 20 2d 20 28 6e 62 | 79 74 65 73 2b 31 32 37 |27 - (nb|ytes+127|
|00004950| 29 25 31 32 38 3b 20 2f | 2a 20 70 61 64 20 66 6f |)%128; /|* pad fo|
|00004960| 72 6b 20 74 6f 20 6d 75 | 6c 74 20 6f 66 20 31 32 |rk to mu|lt of 12|
|00004970| 38 20 62 79 74 65 73 20 | 2a 2f 0a 20 20 20 20 63 |8 bytes |*/. c|
|00004980| 61 6c 63 5f 63 72 63 20 | 3d 20 30 3b 0a 20 20 20 |alc_crc |= 0;. |
|00004990| 20 66 6f 72 20 28 3b 3b | 29 20 7b 0a 20 20 20 20 | for (;;|) {. |
|000049a0| 20 20 20 20 63 20 3d 20 | 62 75 66 5f 70 74 72 3b | c = |buf_ptr;|
|000049b0| 0a 20 20 20 20 20 20 20 | 20 63 5f 6c 65 6e 67 74 |. | c_lengt|
|000049c0| 68 20 3d 20 28 63 20 2b | 20 6e 62 79 74 65 73 20 |h = (c +| nbytes |
|000049d0| 3e 20 62 75 66 5f 65 6e | 64 29 20 3f 20 62 75 66 |> buf_en|d) ? buf|
|000049e0| 5f 65 6e 64 20 2d 20 63 | 20 3a 20 6e 62 79 74 65 |_end - c| : nbyte|
|000049f0| 73 3b 0a 20 20 20 20 20 | 20 20 20 6e 62 79 74 65 |s;. | nbyte|
|00004a00| 73 20 2d 3d 20 63 5f 6c | 65 6e 67 74 68 3b 0a 20 |s -= c_l|ength;. |
|00004a10| 20 20 20 20 20 20 20 66 | 77 72 69 74 65 28 63 2c | f|write(c,|
|00004a20| 20 73 69 7a 65 6f 66 28 | 62 79 74 65 29 2c 20 63 | sizeof(|byte), c|
|00004a30| 5f 6c 65 6e 67 74 68 2c | 20 62 69 6e 66 69 6c 65 |_length,| binfile|
|00004a40| 29 3b 0a 20 20 20 20 20 | 20 20 20 77 68 69 6c 65 |);. | while|
|00004a50| 20 28 63 5f 6c 65 6e 67 | 74 68 2d 2d 29 0a 20 20 | (c_leng|th--). |
|00004a60| 20 20 20 20 20 20 20 20 | 20 20 63 61 6c 63 5f 63 | | calc_c|
|00004a70| 72 63 20 3d 20 28 28 28 | 63 61 6c 63 5f 63 72 63 |rc = (((|calc_crc|
|00004a80| 26 30 78 66 66 29 20 3c | 3c 20 38 29 20 7c 20 2a |&0xff) <|< 8) | *|
|00004a90| 63 2b 2b 29 20 5e 20 6d | 61 67 69 63 5b 63 61 6c |c++) ^ m|agic[cal|
|00004aa0| 63 5f 63 72 63 20 3e 3e | 20 38 5d 3b 0a 20 20 20 |c_crc >>| 8];. |
|00004ab0| 20 20 20 20 20 69 66 20 | 28 21 6e 62 79 74 65 73 | if |(!nbytes|
|00004ac0| 29 20 62 72 65 61 6b 3b | 0a 20 20 20 20 20 20 20 |) break;|. |
|00004ad0| 20 66 69 6c 6c 5f 68 71 | 78 62 75 66 28 29 3b 0a | fill_hq|xbuf();.|
|00004ae0| 20 20 20 20 20 20 20 20 | 7d 0a 20 20 20 20 62 75 | |}. bu|
|00004af0| 66 5f 70 74 72 20 3d 20 | 63 3b 0a 20 20 20 20 77 |f_ptr = |c;. w|
|00004b00| 68 69 6c 65 20 28 65 78 | 74 72 61 5f 62 79 74 65 |hile (ex|tra_byte|
|00004b10| 73 2d 2d 29 20 70 75 74 | 63 28 30 2c 20 62 69 6e |s--) put|c(0, bin|
|00004b20| 66 69 6c 65 29 3b 0a 20 | 20 20 20 63 61 6c 63 5f |file);. | calc_|
|00004b30| 63 72 63 20 3d 20 28 28 | 63 61 6c 63 5f 63 72 63 |crc = ((|calc_crc|
|00004b40| 26 30 78 66 66 29 20 3c | 3c 20 38 29 20 5e 20 6d |&0xff) <|< 8) ^ m|
|00004b50| 61 67 69 63 5b 63 61 6c | 63 5f 63 72 63 20 3e 3e |agic[cal|c_crc >>|
|00004b60| 20 38 5d 3b 0a 20 20 20 | 20 63 61 6c 63 5f 63 72 | 8];. | calc_cr|
|00004b70| 63 20 3d 20 28 28 63 61 | 6c 63 5f 63 72 63 26 30 |c = ((ca|lc_crc&0|
|00004b80| 78 66 66 29 20 3c 3c 20 | 38 29 20 5e 20 6d 61 67 |xff) << |8) ^ mag|
|00004b90| 69 63 5b 63 61 6c 63 5f | 63 72 63 20 3e 3e 20 38 |ic[calc_|crc >> 8|
|00004ba0| 5d 3b 0a 20 20 20 20 72 | 65 74 75 72 6e 20 28 77 |];. r|eturn (w|
|00004bb0| 6f 72 64 29 20 63 61 6c | 63 5f 63 72 63 3b 0a 20 |ord) cal|c_crc;. |
|00004bc0| 20 20 20 7d 0a 0a 2f 2a | 20 54 68 69 73 20 72 6f | }../*| This ro|
|00004bd0| 75 74 69 6e 65 20 63 6f | 70 69 65 73 20 62 79 74 |utine co|pies byt|
|00004be0| 65 73 20 66 72 6f 6d 20 | 74 68 65 20 69 6e 70 75 |es from |the inpu|
|00004bf0| 74 20 73 74 72 65 61 6d | 20 74 6f 20 74 68 65 20 |t stream| to the |
|00004c00| 65 6e 63 6f 64 65 64 20 | 6f 75 74 70 75 74 2e 20 |encoded |output. |
|00004c10| 20 0a 20 20 20 20 49 74 | 20 61 6c 73 6f 20 70 61 | . It| also pa|
|00004c20| 64 73 20 74 6f 20 61 20 | 6d 75 6c 74 69 70 6c 65 |ds to a |multiple|
|00004c30| 20 6f 66 20 31 32 38 20 | 62 79 74 65 73 20 6f 6e | of 128 |bytes on|
|00004c40| 20 74 68 65 20 69 6e 70 | 75 74 2c 20 77 68 69 63 | the inp|ut, whic|
|00004c50| 68 20 69 73 20 70 61 72 | 74 0a 20 20 20 20 6f 66 |h is par|t. of|
|00004c60| 20 74 68 65 20 2e 62 69 | 6e 20 66 6f 72 6d 61 74 | the .bi|n format|
|00004c70| 20 2a 2f 0a 77 6f 72 64 | 20 62 69 6e 5f 74 6f 5f | */.word| bin_to_|
|00004c80| 68 71 78 5f 66 6f 72 6b | 28 6e 62 79 74 65 73 29 |hqx_fork|(nbytes)|
|00004c90| 0a 72 65 67 69 73 74 65 | 72 20 75 6c 6f 6e 67 20 |.registe|r ulong |
|00004ca0| 6e 62 79 74 65 73 3b 0a | 7b 20 20 20 72 65 67 69 |nbytes;.|{ regi|
|00004cb0| 73 74 65 72 20 62 79 74 | 65 20 2a 63 3b 0a 20 20 |ster byt|e *c;. |
|00004cc0| 20 20 72 65 67 69 73 74 | 65 72 20 75 6c 6f 6e 67 | regist|er ulong|
|00004cd0| 20 63 61 6c 63 5f 63 72 | 63 3b 0a 20 20 20 20 72 | calc_cr|c;. r|
|00004ce0| 65 67 69 73 74 65 72 20 | 69 6e 74 20 63 5f 6c 65 |egister |int c_le|
|00004cf0| 6e 67 74 68 3b 0a 20 20 | 20 20 75 6c 6f 6e 67 20 |ngth;. | ulong |
|00004d00| 65 78 74 72 61 5f 62 79 | 74 65 73 3b 0a 20 20 20 |extra_by|tes;. |
|00004d10| 20 65 78 74 65 72 6e 20 | 77 6f 72 64 20 6d 61 67 | extern |word mag|
|00004d20| 69 63 5b 5d 3b 0a 0a 20 | 20 20 20 65 78 74 72 61 |ic[];.. | extra|
|00004d30| 5f 62 79 74 65 73 20 3d | 20 31 32 37 20 2d 20 28 |_bytes =| 127 - (|
|00004d40| 6e 62 79 74 65 73 2b 31 | 32 37 29 25 31 32 38 3b |nbytes+1|27)%128;|
|00004d50| 20 2f 2a 20 70 61 64 20 | 66 6f 72 6b 20 74 6f 20 | /* pad |fork to |
|00004d60| 6d 75 6c 74 20 6f 66 20 | 31 32 38 20 62 79 74 65 |mult of |128 byte|
|00004d70| 73 20 2a 2f 0a 20 20 20 | 20 63 61 6c 63 5f 63 72 |s */. | calc_cr|
|00004d80| 63 20 3d 20 30 3b 0a 20 | 20 20 20 66 6f 72 20 28 |c = 0;. | for (|
|00004d90| 3b 3b 29 20 7b 0a 20 20 | 20 20 20 20 20 20 63 20 |;;) {. | c |
|00004da0| 3d 20 62 75 66 5f 70 74 | 72 3b 0a 20 20 20 20 20 |= buf_pt|r;. |
|00004db0| 20 20 20 63 5f 6c 65 6e | 67 74 68 20 3d 20 28 63 | c_len|gth = (c|
|00004dc0| 20 2b 20 6e 62 79 74 65 | 73 20 3e 20 62 75 66 5f | + nbyte|s > buf_|
|00004dd0| 65 6e 64 29 20 3f 20 62 | 75 66 5f 65 6e 64 20 2d |end) ? b|uf_end -|
|00004de0| 20 63 20 3a 20 6e 62 79 | 74 65 73 3b 0a 20 20 20 | c : nby|tes;. |
|00004df0| 20 20 20 20 20 6e 62 79 | 74 65 73 20 2d 3d 20 63 | nby|tes -= c|
|00004e00| 5f 6c 65 6e 67 74 68 3b | 0a 20 20 20 20 20 20 20 |_length;|. |
|00004e10| 20 66 72 65 61 64 28 63 | 2c 20 73 69 7a 65 6f 66 | fread(c|, sizeof|
|00004e20| 28 62 79 74 65 29 2c 20 | 63 5f 6c 65 6e 67 74 68 |(byte), |c_length|
|00004e30| 2c 20 62 69 6e 66 69 6c | 65 29 3b 0a 20 20 20 20 |, binfil|e);. |
|00004e40| 20 20 20 20 62 75 66 5f | 70 74 72 20 2b 3d 20 63 | buf_|ptr += c|
|00004e50| 5f 6c 65 6e 67 74 68 3b | 0a 20 20 20 20 20 20 20 |_length;|. |
|00004e60| 20 77 68 69 6c 65 20 28 | 63 5f 6c 65 6e 67 74 68 | while (|c_length|
|00004e70| 2d 2d 29 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |--). | |
|00004e80| 63 61 6c 63 5f 63 72 63 | 20 3d 20 28 28 28 63 61 |calc_crc| = (((ca|
|00004e90| 6c 63 5f 63 72 63 26 30 | 78 66 66 29 20 3c 3c 20 |lc_crc&0|xff) << |
|00004ea0| 38 29 20 7c 20 2a 63 2b | 2b 29 20 5e 20 6d 61 67 |8) | *c+|+) ^ mag|
|00004eb0| 69 63 5b 63 61 6c 63 5f | 63 72 63 20 3e 3e 20 38 |ic[calc_|crc >> 8|
|00004ec0| 5d 3b 0a 20 20 20 20 20 | 20 20 20 69 66 20 28 21 |];. | if (!|
|00004ed0| 6e 62 79 74 65 73 29 20 | 62 72 65 61 6b 3b 0a 20 |nbytes) |break;. |
|00004ee0| 20 20 20 20 20 20 20 65 | 6d 70 74 79 5f 68 71 78 | e|mpty_hqx|
|00004ef0| 62 75 66 28 29 3b 0a 20 | 20 20 20 20 20 20 20 7d |buf();. | }|
|00004f00| 0a 20 20 20 20 62 75 66 | 5f 70 74 72 20 3d 20 63 |. buf|_ptr = c|
|00004f10| 3b 0a 0a 20 20 20 20 66 | 73 65 65 6b 28 62 69 6e |;.. f|seek(bin|
|00004f20| 66 69 6c 65 2c 20 65 78 | 74 72 61 5f 62 79 74 65 |file, ex|tra_byte|
|00004f30| 73 2c 20 31 29 3b 0a 20 | 20 20 20 63 61 6c 63 5f |s, 1);. | calc_|
|00004f40| 63 72 63 20 3d 20 28 28 | 63 61 6c 63 5f 63 72 63 |crc = ((|calc_crc|
|00004f50| 26 30 78 66 66 29 20 3c | 3c 20 38 29 20 5e 20 6d |&0xff) <|< 8) ^ m|
|00004f60| 61 67 69 63 5b 63 61 6c | 63 5f 63 72 63 20 3e 3e |agic[cal|c_crc >>|
|00004f70| 20 38 5d 3b 0a 20 20 20 | 20 63 61 6c 63 5f 63 72 | 8];. | calc_cr|
|00004f80| 63 20 3d 20 28 28 63 61 | 6c 63 5f 63 72 63 26 30 |c = ((ca|lc_crc&0|
|00004f90| 78 66 66 29 20 3c 3c 20 | 38 29 20 5e 20 6d 61 67 |xff) << |8) ^ mag|
|00004fa0| 69 63 5b 63 61 6c 63 5f | 63 72 63 20 3e 3e 20 38 |ic[calc_|crc >> 8|
|00004fb0| 5d 3b 0a 20 20 20 20 72 | 65 74 75 72 6e 20 28 77 |];. r|eturn (w|
|00004fc0| 6f 72 64 29 20 63 61 6c | 63 5f 63 72 63 3b 0a 20 |ord) cal|c_crc;. |
|00004fd0| 20 20 20 7d 0a 0a 2f 2a | 20 45 73 73 65 6e 74 69 | }../*| Essenti|
|00004fe0| 61 6c 73 20 66 6f 72 20 | 42 69 6e 68 65 78 20 38 |als for |Binhex 8|
|00004ff0| 74 6f 36 20 72 75 6e 20 | 6c 65 6e 67 74 68 20 65 |to6 run |length e|
|00005000| 6e 63 6f 64 69 6e 67 20 | 2a 2f 0a 23 64 65 66 69 |ncoding |*/.#defi|
|00005010| 6e 65 20 52 55 4e 43 48 | 41 52 20 30 78 39 30 0a |ne RUNCH|AR 0x90.|
|00005020| 23 64 65 66 69 6e 65 20 | 4d 41 58 52 55 4e 20 32 |#define |MAXRUN 2|
|00005030| 35 35 0a 23 64 65 66 69 | 6e 65 20 49 53 5f 4c 45 |55.#defi|ne IS_LE|
|00005040| 47 41 4c 20 3c 30 78 34 | 30 0a 23 64 65 66 69 6e |GAL <0x4|0.#defin|
|00005050| 65 20 49 53 4e 54 5f 4c | 45 47 41 4c 20 3e 30 78 |e ISNT_L|EGAL >0x|
|00005060| 33 66 0a 23 64 65 66 69 | 6e 65 20 44 4f 4e 45 20 |3f.#defi|ne DONE |
|00005070| 30 78 37 46 20 2f 2a 20 | 74 72 36 38 5b 27 3a 27 |0x7F /* |tr68[':'|
|00005080| 5d 20 3d 20 44 4f 4e 45 | 2c 20 73 69 6e 63 65 20 |] = DONE|, since |
|00005090| 42 69 6e 68 65 78 20 74 | 65 72 6d 69 6e 61 74 6f |Binhex t|erminato|
|000050a0| 72 20 69 73 20 27 3a 27 | 20 2a 2f 0a 23 64 65 66 |r is ':'| */.#def|
|000050b0| 69 6e 65 20 53 4b 49 50 | 20 30 78 37 45 20 2f 2a |ine SKIP| 0x7E /*|
|000050c0| 20 74 72 36 38 5b 27 5c | 6e 27 7c 27 5c 72 27 5d | tr68['\|n'|'\r']|
|000050d0| 20 3d 20 53 4b 49 50 2c | 20 69 2e 20 65 2e 20 65 | = SKIP,| i. e. e|
|000050e0| 6e 64 20 6f 66 20 6c 69 | 6e 65 20 63 68 61 72 2e |nd of li|ne char.|
|000050f0| 20 20 2a 2f 0a 23 64 65 | 66 69 6e 65 20 46 41 49 | */.#de|fine FAI|
|00005100| 4c 20 30 78 37 44 20 2f | 2a 20 63 68 61 72 61 63 |L 0x7D /|* charac|
|00005110| 74 65 72 20 69 6c 6c 65 | 67 61 6c 20 69 6e 20 62 |ter ille|gal in b|
|00005120| 69 6e 68 65 78 20 66 69 | 6c 65 20 2a 2f 0a 0a 62 |inhex fi|le */..b|
|00005130| 79 74 65 20 74 72 38 36 | 5b 5d 20 3d 0a 20 20 20 |yte tr86|[] =. |
|00005140| 20 20 20 20 20 22 21 5c | 22 23 24 25 26 27 28 29 | "!\|"#$%&'()|
|00005150| 2a 2b 2c 2d 30 31 32 33 | 34 35 36 38 39 40 41 42 |*+,-0123|45689@AB|
|00005160| 43 44 45 46 47 48 49 4a | 4b 4c 4d 4e 50 51 52 53 |CDEFGHIJ|KLMNPQRS|
|00005170| 54 55 56 58 59 5a 5b 60 | 61 62 63 64 65 66 68 69 |TUVXYZ[`|abcdefhi|
|00005180| 6a 6b 6c 6d 70 71 72 22 | 3b 20 0a 62 79 74 65 20 |jklmpqr"|; .byte |
|00005190| 74 72 36 38 5b 5d 20 3d | 20 7b 0a 20 20 20 20 46 |tr68[] =| {. F|
|000051a0| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|000051b0| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|000051c0| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 0a 20 |L, FAIL,| FAIL,. |
|000051d0| 20 20 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 53 | FAIL,| FAIL, S|
|000051e0| 4b 49 50 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |KIP, FAI|L, FAIL,|
|000051f0| 20 53 4b 49 50 2c 20 46 | 41 49 4c 2c 20 46 41 49 | SKIP, F|AIL, FAI|
|00005200| 4c 2c 0a 20 20 20 20 46 | 41 49 4c 2c 20 46 41 49 |L,. F|AIL, FAI|
|00005210| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |L, FAIL,| FAIL, F|
|00005220| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|00005230| 20 46 41 49 4c 2c 0a 20 | 20 20 20 46 41 49 4c 2c | FAIL,. | FAIL,|
|00005240| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|00005250| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |L, FAIL,| FAIL, F|
|00005260| 41 49 4c 2c 20 46 41 49 | 4c 2c 0a 20 20 20 20 46 |AIL, FAI|L,. F|
|00005270| 41 49 4c 2c 20 30 78 30 | 30 2c 20 30 78 30 31 2c |AIL, 0x0|0, 0x01,|
|00005280| 20 30 78 30 32 2c 20 30 | 78 30 33 2c 20 30 78 30 | 0x02, 0|x03, 0x0|
|00005290| 34 2c 20 30 78 30 35 2c | 20 30 78 30 36 2c 0a 20 |4, 0x05,| 0x06,. |
|000052a0| 20 20 20 30 78 30 37 2c | 20 30 78 30 38 2c 20 30 | 0x07,| 0x08, 0|
|000052b0| 78 30 39 2c 20 30 78 30 | 41 2c 20 30 78 30 42 2c |x09, 0x0|A, 0x0B,|
|000052c0| 20 30 78 30 43 2c 20 46 | 41 49 4c 2c 20 46 41 49 | 0x0C, F|AIL, FAI|
|000052d0| 4c 2c 0a 20 20 20 20 30 | 78 30 44 2c 20 30 78 30 |L,. 0|x0D, 0x0|
|000052e0| 45 2c 20 30 78 30 46 2c | 20 30 78 31 30 2c 20 30 |E, 0x0F,| 0x10, 0|
|000052f0| 78 31 31 2c 20 30 78 31 | 32 2c 20 30 78 31 33 2c |x11, 0x1|2, 0x13,|
|00005300| 20 46 41 49 4c 2c 0a 20 | 20 20 20 30 78 31 34 2c | FAIL,. | 0x14,|
|00005310| 20 30 78 31 35 2c 20 44 | 4f 4e 45 2c 20 46 41 49 | 0x15, D|ONE, FAI|
|00005320| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |L, FAIL,| FAIL, F|
|00005330| 41 49 4c 2c 20 46 41 49 | 4c 2c 0a 20 20 20 20 30 |AIL, FAI|L,. 0|
|00005340| 78 31 36 2c 20 30 78 31 | 37 2c 20 30 78 31 38 2c |x16, 0x1|7, 0x18,|
|00005350| 20 30 78 31 39 2c 20 30 | 78 31 41 2c 20 30 78 31 | 0x19, 0|x1A, 0x1|
|00005360| 42 2c 20 30 78 31 43 2c | 20 30 78 31 44 2c 0a 20 |B, 0x1C,| 0x1D,. |
|00005370| 20 20 20 30 78 31 45 2c | 20 30 78 31 46 2c 20 30 | 0x1E,| 0x1F, 0|
|00005380| 78 32 30 2c 20 30 78 32 | 31 2c 20 30 78 32 32 2c |x20, 0x2|1, 0x22,|
|00005390| 20 30 78 32 33 2c 20 30 | 78 32 34 2c 20 46 41 49 | 0x23, 0|x24, FAI|
|000053a0| 4c 2c 0a 20 20 20 20 30 | 78 32 35 2c 20 30 78 32 |L,. 0|x25, 0x2|
|000053b0| 36 2c 20 30 78 32 37 2c | 20 30 78 32 38 2c 20 30 |6, 0x27,| 0x28, 0|
|000053c0| 78 32 39 2c 20 30 78 32 | 41 2c 20 30 78 32 42 2c |x29, 0x2|A, 0x2B,|
|000053d0| 20 46 41 49 4c 2c 0a 20 | 20 20 20 30 78 32 43 2c | FAIL,. | 0x2C,|
|000053e0| 20 30 78 32 44 2c 20 30 | 78 32 45 2c 20 30 78 32 | 0x2D, 0|x2E, 0x2|
|000053f0| 46 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |F, FAIL,| FAIL, F|
|00005400| 41 49 4c 2c 20 46 41 49 | 4c 2c 0a 20 20 20 20 30 |AIL, FAI|L,. 0|
|00005410| 78 33 30 2c 20 30 78 33 | 31 2c 20 30 78 33 32 2c |x30, 0x3|1, 0x32,|
|00005420| 20 30 78 33 33 2c 20 30 | 78 33 34 2c 20 30 78 33 | 0x33, 0|x34, 0x3|
|00005430| 35 2c 20 30 78 33 36 2c | 20 46 41 49 4c 2c 0a 20 |5, 0x36,| FAIL,. |
|00005440| 20 20 20 30 78 33 37 2c | 20 30 78 33 38 2c 20 30 | 0x37,| 0x38, 0|
|00005450| 78 33 39 2c 20 30 78 33 | 41 2c 20 30 78 33 42 2c |x39, 0x3|A, 0x3B,|
|00005460| 20 30 78 33 43 2c 20 46 | 41 49 4c 2c 20 46 41 49 | 0x3C, F|AIL, FAI|
|00005470| 4c 2c 0a 20 20 20 20 30 | 78 33 44 2c 20 30 78 33 |L,. 0|x3D, 0x3|
|00005480| 45 2c 20 30 78 33 46 2c | 20 46 41 49 4c 2c 20 46 |E, 0x3F,| FAIL, F|
|00005490| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|000054a0| 20 46 41 49 4c 2c 0a 20 | 20 20 20 46 41 49 4c 2c | FAIL,. | FAIL,|
|000054b0| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|000054c0| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |L, FAIL,| FAIL, F|
|000054d0| 41 49 4c 2c 20 46 41 49 | 4c 2c 0a 20 20 20 20 46 |AIL, FAI|L,. F|
|000054e0| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|000054f0| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|00005500| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 0a 20 |L, FAIL,| FAIL,. |
|00005510| 20 20 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 | FAIL,| FAIL, F|
|00005520| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|00005530| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|00005540| 4c 2c 0a 20 20 20 20 46 | 41 49 4c 2c 20 46 41 49 |L,. F|AIL, FAI|
|00005550| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |L, FAIL,| FAIL, F|
|00005560| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|00005570| 20 46 41 49 4c 2c 0a 20 | 20 20 20 46 41 49 4c 2c | FAIL,. | FAIL,|
|00005580| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|00005590| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |L, FAIL,| FAIL, F|
|000055a0| 41 49 4c 2c 20 46 41 49 | 4c 2c 0a 20 20 20 20 46 |AIL, FAI|L,. F|
|000055b0| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|000055c0| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|000055d0| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 0a 20 |L, FAIL,| FAIL,. |
|000055e0| 20 20 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 | FAIL,| FAIL, F|
|000055f0| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|00005600| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|00005610| 4c 2c 0a 20 20 20 20 46 | 41 49 4c 2c 20 46 41 49 |L,. F|AIL, FAI|
|00005620| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |L, FAIL,| FAIL, F|
|00005630| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|00005640| 20 46 41 49 4c 2c 0a 20 | 20 20 20 46 41 49 4c 2c | FAIL,. | FAIL,|
|00005650| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|00005660| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |L, FAIL,| FAIL, F|
|00005670| 41 49 4c 2c 20 46 41 49 | 4c 2c 0a 20 20 20 20 46 |AIL, FAI|L,. F|
|00005680| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|00005690| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|000056a0| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 0a 20 |L, FAIL,| FAIL,. |
|000056b0| 20 20 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 | FAIL,| FAIL, F|
|000056c0| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|000056d0| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|000056e0| 4c 2c 0a 20 20 20 20 46 | 41 49 4c 2c 20 46 41 49 |L,. F|AIL, FAI|
|000056f0| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |L, FAIL,| FAIL, F|
|00005700| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|00005710| 20 46 41 49 4c 2c 0a 20 | 20 20 20 46 41 49 4c 2c | FAIL,. | FAIL,|
|00005720| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|00005730| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |L, FAIL,| FAIL, F|
|00005740| 41 49 4c 2c 20 46 41 49 | 4c 2c 0a 20 20 20 20 46 |AIL, FAI|L,. F|
|00005750| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|00005760| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|00005770| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 0a 20 |L, FAIL,| FAIL,. |
|00005780| 20 20 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 | FAIL,| FAIL, F|
|00005790| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|000057a0| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|000057b0| 4c 2c 0a 20 20 20 20 46 | 41 49 4c 2c 20 46 41 49 |L,. F|AIL, FAI|
|000057c0| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |L, FAIL,| FAIL, F|
|000057d0| 41 49 4c 2c 20 46 41 49 | 4c 2c 20 46 41 49 4c 2c |AIL, FAI|L, FAIL,|
|000057e0| 20 46 41 49 4c 2c 0a 20 | 20 20 20 46 41 49 4c 2c | FAIL,. | FAIL,|
|000057f0| 20 46 41 49 4c 2c 20 46 | 41 49 4c 2c 20 46 41 49 | FAIL, F|AIL, FAI|
|00005800| 4c 2c 20 46 41 49 4c 2c | 20 46 41 49 4c 2c 20 46 |L, FAIL,| FAIL, F|
|00005810| 41 49 4c 2c 20 46 41 49 | 4c 2c 0a 20 20 20 20 7d |AIL, FAI|L,. }|
|00005820| 3b 0a 0a 2f 2a 0a 20 2a | 20 20 54 68 69 73 20 70 |;../*. *| This p|
|00005830| 72 6f 63 65 64 75 72 65 | 20 74 72 61 6e 73 70 61 |rocedure| transpa|
|00005840| 72 65 6e 74 6c 79 20 72 | 65 61 64 73 20 61 6e 64 |rently r|eads and|
|00005850| 20 64 65 63 6f 64 65 73 | 20 74 68 65 20 68 71 78 | decodes| the hqx|
|00005860| 20 69 6e 70 75 74 2e 20 | 20 49 74 20 64 6f 65 73 | input. | It does|
|00005870| 20 72 75 6e 20 0a 20 2a | 20 20 6c 65 6e 67 74 68 | run . *| length|
|00005880| 20 61 6e 64 20 36 20 74 | 6f 20 38 20 64 65 63 6f | and 6 t|o 8 deco|
|00005890| 64 69 6e 67 2e 0a 20 2a | 2f 0a 23 64 65 66 69 6e |ding.. *|/.#defin|
|000058a0| 65 20 52 45 41 44 49 4e | 47 20 30 0a 23 64 65 66 |e READIN|G 0.#def|
|000058b0| 69 6e 65 20 53 4b 49 50 | 50 49 4e 47 20 31 0a 23 |ine SKIP|PING 1.#|
|000058c0| 64 65 66 69 6e 65 20 46 | 49 4e 44 5f 53 54 41 52 |define F|IND_STAR|
|000058d0| 54 5f 43 4f 4c 4f 4e 20 | 32 0a 0a 66 69 6c 6c 5f |T_COLON |2..fill_|
|000058e0| 68 71 78 62 75 66 28 29 | 0a 7b 20 20 20 72 65 67 |hqxbuf()|.{ reg|
|000058f0| 69 73 74 65 72 20 75 6c | 6f 6e 67 20 63 2c 20 6e |ister ul|ong c, n|
|00005900| 69 62 62 6c 65 3b 0a 20 | 20 20 20 72 65 67 69 73 |ibble;. | regis|
|00005910| 74 65 72 20 69 6e 74 20 | 6e 6f 74 5f 69 6e 5f 61 |ter int |not_in_a|
|00005920| 5f 72 75 6e 20 3d 20 54 | 52 55 45 2c 20 73 74 61 |_run = T|RUE, sta|
|00005930| 74 65 36 38 3b 0a 20 20 | 20 20 72 65 67 69 73 74 |te68;. | regist|
|00005940| 65 72 20 62 79 74 65 20 | 2a 66 61 73 74 5f 62 75 |er byte |*fast_bu|
|00005950| 66 2c 20 2a 66 61 73 74 | 5f 6c 69 6e 65 3b 0a 20 |f, *fast|_line;. |
|00005960| 20 20 20 73 74 61 74 69 | 63 20 69 6e 74 20 73 74 | stati|c int st|
|00005970| 61 74 75 73 20 3d 20 46 | 49 4e 44 5f 53 54 41 52 |atus = F|IND_STAR|
|00005980| 54 5f 43 4f 4c 4f 4e 3b | 0a 0a 20 20 20 20 62 75 |T_COLON;|.. bu|
|00005990| 66 5f 70 74 72 20 3d 20 | 66 61 73 74 5f 62 75 66 |f_ptr = |fast_buf|
|000059a0| 20 3d 20 62 75 66 5f 73 | 74 61 72 74 3b 0a 20 20 | = buf_s|tart;. |
|000059b0| 20 20 66 61 73 74 5f 6c | 69 6e 65 20 3d 20 6c 69 | fast_l|ine = li|
|000059c0| 6e 65 5f 70 74 72 3b 0a | 20 20 20 20 73 74 61 74 |ne_ptr;.| stat|
|000059d0| 65 36 38 20 3d 20 73 61 | 76 65 5f 73 74 61 74 65 |e68 = sa|ve_state|
|000059e0| 3b 0a 20 20 20 20 6e 69 | 62 62 6c 65 20 3d 20 73 |;. ni|bble = s|
|000059f0| 61 76 65 5f 6e 69 62 62 | 6c 65 3b 0a 20 20 20 20 |ave_nibb|le;. |
|00005a00| 69 66 20 28 73 61 76 65 | 5f 72 75 6e 5f 6c 65 6e |if (save|_run_len|
|00005a10| 67 74 68 20 3e 20 30 29 | 20 7b 0a 20 20 20 20 20 |gth > 0)| {. |
|00005a20| 20 20 20 63 20 3d 20 73 | 61 76 65 5f 72 75 6e 5f | c = s|ave_run_|
|00005a30| 6c 65 6e 67 74 68 3b 0a | 20 20 20 20 20 20 20 20 |length;.| |
|00005a40| 73 61 76 65 5f 72 75 6e | 5f 6c 65 6e 67 74 68 20 |save_run|_length |
|00005a50| 3d 20 30 3b 0a 20 20 20 | 20 20 20 20 20 67 6f 74 |= 0;. | got|
|00005a60| 6f 20 63 6f 6e 74 69 6e | 75 65 5f 72 75 6e 3b 0a |o contin|ue_run;.|
|00005a70| 20 20 20 20 20 20 20 20 | 7d 0a 20 20 20 20 77 68 | |}. wh|
|00005a80| 69 6c 65 20 28 66 61 73 | 74 5f 62 75 66 20 3c 20 |ile (fas|t_buf < |
|00005a90| 62 75 66 5f 65 6e 64 29 | 20 7b 0a 20 20 20 20 20 |buf_end)| {. |
|00005aa0| 20 20 20 6e 65 78 74 5f | 63 68 61 72 3a 0a 20 20 | next_|char:. |
|00005ab0| 20 20 20 20 20 20 69 66 | 20 28 28 63 20 3d 20 2a | if| ((c = *|
|00005ac0| 66 61 73 74 5f 6c 69 6e | 65 2b 2b 29 20 49 53 4e |fast_lin|e++) ISN|
|00005ad0| 54 5f 4c 45 47 41 4c 29 | 20 7b 0a 20 20 20 20 20 |T_LEGAL)| {. |
|00005ae0| 20 20 20 20 20 20 20 69 | 66 20 28 63 20 3d 3d 20 | i|f (c == |
|00005af0| 44 4f 4e 45 29 20 62 72 | 65 61 6b 3b 0a 20 20 20 |DONE) br|eak;. |
|00005b00| 20 20 20 20 20 20 20 20 | 20 6e 65 78 74 5f 6c 69 | | next_li|
|00005b10| 6e 65 3a 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |ne:. | |
|00005b20| 69 66 20 28 21 66 67 65 | 74 73 28 6c 69 6e 65 5f |if (!fge|ts(line_|
|00005b30| 73 74 61 72 74 2c 20 4d | 41 58 4c 49 4e 45 2c 20 |start, M|AXLINE, |
|00005b40| 68 71 78 66 69 6c 65 29 | 20 26 26 20 21 6e 65 77 |hqxfile)| && !new|
|00005b50| 5f 69 6e 5f 68 71 78 5f | 66 69 6c 65 28 29 29 0a |_in_hqx_|file()).|
|00005b60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005b70| 65 72 72 6f 72 28 22 50 | 72 65 6d 61 74 75 72 65 |error("P|remature|
|00005b80| 20 45 4f 46 20 69 6e 20 | 25 73 5c 6e 22 2c 20 68 | EOF in |%s\n", h|
|00005b90| 71 78 66 6e 61 6d 65 29 | 3b 0a 20 20 20 20 20 20 |qxfname)|;. |
|00005ba0| 20 20 20 20 20 20 6c 69 | 6e 65 5f 70 74 72 20 3d | li|ne_ptr =|
|00005bb0| 20 6c 69 6e 65 5f 73 74 | 61 72 74 3b 0a 20 20 20 | line_st|art;. |
|00005bc0| 20 20 20 20 20 20 20 20 | 20 73 63 61 6e 5f 6c 69 | | scan_li|
|00005bd0| 6e 65 3a 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |ne:. | |
|00005be0| 66 61 73 74 5f 6c 69 6e | 65 20 3d 20 6c 69 6e 65 |fast_lin|e = line|
|00005bf0| 5f 70 74 72 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |_ptr;. | |
|00005c00| 20 20 77 68 69 6c 65 20 | 28 28 2a 66 61 73 74 5f | while |((*fast_|
|00005c10| 6c 69 6e 65 2b 2b 20 3d | 20 74 72 36 38 5b 2a 66 |line++ =| tr68[*f|
|00005c20| 61 73 74 5f 6c 69 6e 65 | 5d 29 20 49 53 5f 4c 45 |ast_line|]) IS_LE|
|00005c30| 47 41 4c 29 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |GAL);. | |
|00005c40| 20 20 63 20 3d 20 2a 2d | 2d 66 61 73 74 5f 6c 69 | c = *-|-fast_li|
|00005c50| 6e 65 3b 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |ne;. | |
|00005c60| 73 77 69 74 63 68 20 28 | 73 74 61 74 75 73 29 20 |switch (|status) |
|00005c70| 7b 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 63 61 |{. | ca|
|00005c80| 73 65 20 52 45 41 44 49 | 4e 47 3a 0a 20 20 20 20 |se READI|NG:. |
|00005c90| 20 20 20 20 20 20 20 20 | 20 20 20 20 69 66 20 28 | | if (|
|00005ca0| 63 20 3d 3d 20 53 4b 49 | 50 20 26 26 20 66 61 73 |c == SKI|P && fas|
|00005cb0| 74 5f 6c 69 6e 65 20 3d | 3d 20 6c 69 6e 65 5f 65 |t_line =|= line_e|
|00005cc0| 6e 64 29 20 62 72 65 61 | 6b 3b 0a 20 20 20 20 20 |nd) brea|k;. |
|00005cd0| 20 20 20 20 20 20 20 20 | 20 20 20 69 66 20 28 63 | | if (c|
|00005ce0| 20 3d 3d 20 44 4f 4e 45 | 29 20 7b 0a 20 20 20 20 | == DONE|) {. |
|00005cf0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005d00| 73 74 61 74 75 73 20 3d | 20 46 49 4e 44 5f 53 54 |status =| FIND_ST|
|00005d10| 41 52 54 5f 43 4f 4c 4f | 4e 3b 0a 20 20 20 20 20 |ART_COLO|N;. |
|00005d20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 62 | | b|
|00005d30| 72 65 61 6b 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |reak;. | |
|00005d40| 20 20 20 20 20 20 20 20 | 20 20 7d 0a 20 20 20 20 | | }. |
|00005d50| 20 20 20 20 20 20 20 20 | 20 20 20 20 73 74 61 74 | | stat|
|00005d60| 75 73 20 3d 20 53 4b 49 | 50 50 49 4e 47 3b 0a 20 |us = SKI|PPING;. |
|00005d70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 67 | | g|
|00005d80| 6f 74 6f 20 6e 65 78 74 | 5f 6c 69 6e 65 3b 0a 20 |oto next|_line;. |
|00005d90| 20 20 20 20 20 20 20 20 | 20 20 20 63 61 73 65 20 | | case |
|00005da0| 53 4b 49 50 50 49 4e 47 | 3a 0a 20 20 20 20 20 20 |SKIPPING|:. |
|00005db0| 20 20 20 20 20 20 20 20 | 20 20 69 66 20 28 63 20 | | if (c |
|00005dc0| 3d 3d 20 53 4b 49 50 20 | 26 26 20 66 61 73 74 5f |== SKIP |&& fast_|
|00005dd0| 6c 69 6e 65 20 3d 3d 20 | 6c 69 6e 65 5f 65 6e 64 |line == |line_end|
|00005de0| 29 20 7b 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |) {. | |
|00005df0| 20 20 20 20 20 20 20 20 | 73 74 61 74 75 73 20 3d | |status =|
|00005e00| 20 52 45 41 44 49 4e 47 | 3b 0a 20 20 20 20 20 20 | READING|;. |
|00005e10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 62 72 | | br|
|00005e20| 65 61 6b 3b 0a 20 20 20 | 20 20 20 20 20 20 20 20 |eak;. | |
|00005e30| 20 20 20 20 20 20 20 20 | 20 7d 0a 20 20 20 20 20 | | }. |
|00005e40| 20 20 20 20 20 20 20 20 | 20 20 20 67 6f 74 6f 20 | | goto |
|00005e50| 6e 65 78 74 5f 6c 69 6e | 65 3b 0a 20 20 20 20 20 |next_lin|e;. |
|00005e60| 20 20 20 20 20 20 20 63 | 61 73 65 20 46 49 4e 44 | c|ase FIND|
|00005e70| 5f 53 54 41 52 54 5f 43 | 4f 4c 4f 4e 3a 0a 20 20 |_START_C|OLON:. |
|00005e80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 69 66 | | if|
|00005e90| 20 28 2a 6c 69 6e 65 5f | 73 74 61 72 74 20 3d 3d | (*line_|start ==|
|00005ea0| 20 44 4f 4e 45 29 20 7b | 0a 20 20 20 20 20 20 20 | DONE) {|. |
|00005eb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 73 74 61 | | sta|
|00005ec0| 74 75 73 20 3d 20 52 45 | 41 44 49 4e 47 3b 0a 20 |tus = RE|ADING;. |
|00005ed0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005ee0| 20 20 20 6c 69 6e 65 5f | 70 74 72 2b 2b 3b 0a 20 | line_|ptr++;. |
|00005ef0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005f00| 20 20 20 67 6f 74 6f 20 | 73 63 61 6e 5f 6c 69 6e | goto |scan_lin|
|00005f10| 65 3b 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |e;. | |
|00005f20| 20 20 20 20 20 20 20 7d | 0a 20 20 20 20 20 20 20 | }|. |
|00005f30| 20 20 20 20 20 20 20 20 | 20 67 6f 74 6f 20 6e 65 | | goto ne|
|00005f40| 78 74 5f 6c 69 6e 65 3b | 0a 20 20 20 20 20 20 20 |xt_line;|. |
|00005f50| 20 20 20 20 20 20 20 20 | 20 7d 0a 20 20 20 20 20 | | }. |
|00005f60| 20 20 20 20 20 20 20 66 | 61 73 74 5f 6c 69 6e 65 | f|ast_line|
|00005f70| 20 3d 20 6c 69 6e 65 5f | 70 74 72 3b 0a 20 20 20 | = line_|ptr;. |
|00005f80| 20 20 20 20 20 20 20 20 | 20 63 20 3d 20 2a 66 61 | | c = *fa|
|00005f90| 73 74 5f 6c 69 6e 65 2b | 2b 3b 0a 20 20 20 20 20 |st_line+|+;. |
|00005fa0| 20 20 20 20 20 20 20 7d | 0a 0a 20 20 20 20 20 20 | }|.. |
|00005fb0| 20 20 2f 2a 20 46 69 6e | 61 6c 6c 79 2c 20 77 65 | /* Fin|ally, we|
|00005fc0| 20 68 61 76 65 20 74 68 | 65 20 6e 65 78 74 20 36 | have th|e next 6|
|00005fd0| 20 62 69 74 73 20 77 6f | 72 74 68 20 6f 66 20 64 | bits wo|rth of d|
|00005fe0| 61 74 61 20 2a 2f 0a 20 | 20 20 20 20 20 20 20 73 |ata */. | s|
|00005ff0| 77 69 74 63 68 20 28 73 | 74 61 74 65 36 38 2b 2b |witch (s|tate68++|
|00006000| 29 20 7b 0a 20 20 20 20 | 20 20 20 20 63 61 73 65 |) {. | case|
|00006010| 20 30 3a 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 | 0:. | |
|00006020| 6e 69 62 62 6c 65 20 3d | 20 63 3b 0a 20 20 20 20 |nibble =| c;. |
|00006030| 20 20 20 20 20 20 20 20 | 67 6f 74 6f 20 6e 65 78 | |goto nex|
|00006040| 74 5f 63 68 61 72 3b 0a | 20 20 20 20 20 20 20 20 |t_char;.| |
|00006050| 63 61 73 65 20 31 3a 0a | 20 20 20 20 20 20 20 20 |case 1:.| |
|00006060| 20 20 20 20 6e 69 62 62 | 6c 65 20 3d 20 28 6e 69 | nibb|le = (ni|
|00006070| 62 62 6c 65 20 3c 3c 20 | 36 29 20 7c 20 63 3b 0a |bble << |6) | c;.|
|00006080| 20 20 20 20 20 20 20 20 | 20 20 20 20 63 20 3d 20 | | c = |
|00006090| 6e 69 62 62 6c 65 20 3e | 3e 20 34 3b 0a 20 20 20 |nibble >|> 4;. |
|000060a0| 20 20 20 20 20 20 20 20 | 20 62 72 65 61 6b 3b 0a | | break;.|
|000060b0| 20 20 20 20 20 20 20 20 | 63 61 73 65 20 32 3a 0a | |case 2:.|
|000060c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 6e 69 62 62 | | nibb|
|000060d0| 6c 65 20 3d 20 28 6e 69 | 62 62 6c 65 20 3c 3c 20 |le = (ni|bble << |
|000060e0| 36 29 20 7c 20 63 3b 0a | 20 20 20 20 20 20 20 20 |6) | c;.| |
|000060f0| 20 20 20 20 63 20 3d 20 | 28 6e 69 62 62 6c 65 20 | c = |(nibble |
|00006100| 3e 3e 20 32 29 20 26 20 | 30 78 66 66 3b 0a 20 20 |>> 2) & |0xff;. |
|00006110| 20 20 20 20 20 20 20 20 | 20 20 62 72 65 61 6b 3b | | break;|
|00006120| 0a 20 20 20 20 20 20 20 | 20 63 61 73 65 20 33 3a |. | case 3:|
|00006130| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 63 20 3d |. | c =|
|00006140| 20 28 6e 69 62 62 6c 65 | 20 3c 3c 20 36 29 20 26 | (nibble| << 6) &|
|00006150| 20 30 78 66 66 20 7c 20 | 63 3b 0a 20 20 20 20 20 | 0xff | |c;. |
|00006160| 20 20 20 20 20 20 20 73 | 74 61 74 65 36 38 20 3d | s|tate68 =|
|00006170| 20 30 3b 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 | 0;. | |
|00006180| 62 72 65 61 6b 3b 0a 20 | 20 20 20 20 20 20 20 20 |break;. | |
|00006190| 20 20 20 7d 0a 20 20 20 | 20 20 20 20 20 69 66 20 | }. | if |
|000061a0| 28 6e 6f 74 5f 69 6e 5f | 61 5f 72 75 6e 29 0a 20 |(not_in_|a_run). |
|000061b0| 20 20 20 20 20 20 20 20 | 20 20 20 69 66 20 28 63 | | if (c|
|000061c0| 20 21 3d 20 52 55 4e 43 | 48 41 52 29 20 2a 66 61 | != RUNC|HAR) *fa|
|000061d0| 73 74 5f 62 75 66 2b 2b | 20 3d 20 63 3b 0a 20 20 |st_buf++| = c;. |
|000061e0| 20 20 20 20 20 20 20 20 | 20 20 65 6c 73 65 20 7b | | else {|
|000061f0| 6e 6f 74 5f 69 6e 5f 61 | 5f 72 75 6e 20 3d 20 46 |not_in_a|_run = F|
|00006200| 41 4c 53 45 3b 20 67 6f | 74 6f 20 6e 65 78 74 5f |ALSE; go|to next_|
|00006210| 63 68 61 72 3b 7d 0a 20 | 20 20 20 20 20 20 20 65 |char;}. | e|
|00006220| 6c 73 65 20 7b 0a 20 20 | 20 20 20 20 20 20 20 20 |lse {. | |
|00006230| 20 20 69 66 20 28 63 2d | 2d 29 20 7b 0a 20 20 20 | if (c-|-) {. |
|00006240| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 6e 6f 74 | | not|
|00006250| 5f 69 6e 5f 61 5f 72 75 | 6e 20 3d 20 62 75 66 5f |_in_a_ru|n = buf_|
|00006260| 65 6e 64 20 2d 20 66 61 | 73 74 5f 62 75 66 3b 0a |end - fa|st_buf;.|
|00006270| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00006280| 69 66 20 28 63 20 3e 20 | 6e 6f 74 5f 69 6e 5f 61 |if (c > |not_in_a|
|00006290| 5f 72 75 6e 29 20 7b 0a | 20 20 20 20 20 20 20 20 |_run) {.| |
|000062a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 73 61 76 65 | | save|
|000062b0| 5f 72 75 6e 5f 6c 65 6e | 67 74 68 20 3d 20 63 20 |_run_len|gth = c |
|000062c0| 2d 20 6e 6f 74 5f 69 6e | 5f 61 5f 72 75 6e 3b 0a |- not_in|_a_run;.|
|000062d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000062e0| 20 20 20 20 63 20 3d 20 | 6e 6f 74 5f 69 6e 5f 61 | c = |not_in_a|
|000062f0| 5f 72 75 6e 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |_run;. | |
|00006300| 20 20 20 20 20 20 20 20 | 20 20 7d 0a 20 20 20 20 | | }. |
|00006310| 20 20 20 20 20 20 20 20 | 20 20 20 20 63 6f 6e 74 | | cont|
|00006320| 69 6e 75 65 5f 72 75 6e | 3a 0a 20 20 20 20 20 20 |inue_run|:. |
|00006330| 20 20 20 20 20 20 20 20 | 20 20 6e 6f 74 5f 69 6e | | not_in|
|00006340| 5f 61 5f 72 75 6e 20 3d | 20 66 61 73 74 5f 62 75 |_a_run =| fast_bu|
|00006350| 66 5b 2d 31 5d 3b 0a 20 | 20 20 20 20 20 20 20 20 |f[-1];. | |
|00006360| 20 20 20 20 20 20 20 77 | 68 69 6c 65 20 28 63 2d | w|hile (c-|
|00006370| 2d 29 20 2a 66 61 73 74 | 5f 62 75 66 2b 2b 20 3d |-) *fast|_buf++ =|
|00006380| 20 6e 6f 74 5f 69 6e 5f | 61 5f 72 75 6e 3b 0a 20 | not_in_|a_run;. |
|00006390| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 7d | | }|
|000063a0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 65 6c 73 |. | els|
|000063b0| 65 20 2a 66 61 73 74 5f | 62 75 66 2b 2b 20 3d 20 |e *fast_|buf++ = |
|000063c0| 52 55 4e 43 48 41 52 3b | 0a 20 20 20 20 20 20 20 |RUNCHAR;|. |
|000063d0| 20 20 20 20 20 6e 6f 74 | 5f 69 6e 5f 61 5f 72 75 | not|_in_a_ru|
|000063e0| 6e 20 3d 20 54 52 55 45 | 3b 0a 20 20 20 20 20 20 |n = TRUE|;. |
|000063f0| 20 20 20 20 20 20 7d 0a | 20 20 20 20 20 20 20 20 | }.| |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.