home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: SHell self-extracting ARchive
(archive/shar).
You can browse this item here: mcvert16.shr
Confidence | Program | Detection | Match Type | Support
|
---|
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
| POSIX shell script text executable
| default
| |
99%
| file
| C source text
| default
| |
98%
| file
| a /bin/sh script, ASCII text executable
| default (weak)
| |
100%
| TrID
| Perl script
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/329 Shell Archive Format
| default
| |
100%
| gt2
| Shell Skript: '/bin/sh'
| default (weak)
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| binwalkID
| Executable script, shebang: "/bin/sh"
| default (weak)
| |
100%
| xdgMime
| application/x-shellscript
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 23 21 20 2f 62 69 6e 2f | 73 68 0a 23 20 54 68 69 |#! /bin/|sh.# Thi|
|00000010| 73 20 69 73 20 61 20 73 | 68 65 6c 6c 20 61 72 63 |s is a s|hell arc|
|00000020| 68 69 76 65 2c 20 6d 65 | 61 6e 69 6e 67 3a 0a 23 |hive, me|aning:.#|
|00000030| 20 31 2e 20 52 65 6d 6f | 76 65 20 65 76 65 72 79 | 1. Remo|ve every|
|00000040| 74 68 69 6e 67 20 61 62 | 6f 76 65 20 74 68 65 20 |thing ab|ove the |
|00000050| 23 21 20 2f 62 69 6e 2f | 73 68 20 6c 69 6e 65 2e |#! /bin/|sh line.|
|00000060| 0a 23 20 32 2e 20 53 61 | 76 65 20 74 68 65 20 72 |.# 2. Sa|ve the r|
|00000070| 65 73 75 6c 74 69 6e 67 | 20 74 65 78 74 20 69 6e |esulting| text in|
|00000080| 20 61 20 66 69 6c 65 2e | 0a 23 20 33 2e 20 45 78 | a file.|.# 3. Ex|
|00000090| 65 63 75 74 65 20 74 68 | 65 20 66 69 6c 65 20 77 |ecute th|e file w|
|000000a0| 69 74 68 20 2f 62 69 6e | 2f 73 68 20 28 6e 6f 74 |ith /bin|/sh (not|
|000000b0| 20 63 73 68 29 20 74 6f | 20 63 72 65 61 74 65 20 | csh) to| create |
|000000c0| 74 68 65 20 66 69 6c 65 | 73 3a 0a 23 09 6d 63 76 |the file|s:.#.mcv|
|000000d0| 65 72 74 2e 63 0a 23 09 | 68 71 78 69 66 79 2e 63 |ert.c.#.|hqxify.c|
|000000e0| 0a 23 09 75 6e 70 61 63 | 6b 2e 63 0a 23 09 6d 61 |.#.unpac|k.c.#.ma|
|000000f0| 63 74 79 70 65 73 2e 68 | 0a 23 09 6d 63 76 65 72 |ctypes.h|.#.mcver|
|00000100| 74 2e 31 0a 23 09 4d 61 | 6b 65 66 69 6c 65 0a 23 |t.1.#.Ma|kefile.#|
|00000110| 20 54 68 69 73 20 61 72 | 63 68 69 76 65 20 63 72 | This ar|chive cr|
|00000120| 65 61 74 65 64 3a 20 4d | 6f 6e 20 41 70 72 20 31 |eated: M|on Apr 1|
|00000130| 35 20 31 34 3a 30 32 3a | 33 31 20 31 39 39 31 0a |5 14:02:|31 1991.|
|00000140| 65 78 70 6f 72 74 20 50 | 41 54 48 3b 20 50 41 54 |export P|ATH; PAT|
|00000150| 48 3d 2f 62 69 6e 3a 24 | 50 41 54 48 0a 69 66 20 |H=/bin:$|PATH.if |
|00000160| 74 65 73 74 20 2d 66 20 | 27 6d 63 76 65 72 74 2e |test -f |'mcvert.|
|00000170| 63 27 0a 74 68 65 6e 0a | 09 65 63 68 6f 20 73 68 |c'.then.|.echo sh|
|00000180| 61 72 3a 20 77 69 6c 6c | 20 6e 6f 74 20 6f 76 65 |ar: will| not ove|
|00000190| 72 2d 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |r-write |existing|
|000001a0| 20 66 69 6c 65 20 22 27 | 6d 63 76 65 72 74 2e 63 | file "'|mcvert.c|
|000001b0| 27 22 0a 65 6c 73 65 0a | 63 61 74 20 3c 3c 20 5c |'".else.|cat << \|
|000001c0| 53 48 41 52 5f 45 4f 46 | 20 3e 20 27 6d 63 76 65 |SHAR_EOF| > 'mcve|
|000001d0| 72 74 2e 63 27 0a 2f 2a | 20 6d 63 76 65 72 74 2e |rt.c'./*| mcvert.|
|000001e0| 63 20 2d 20 76 65 72 73 | 69 6f 6e 20 31 2e 30 35 |c - vers|ion 1.05|
|000001f0| 20 2d 20 31 30 20 4a 61 | 6e 75 61 72 79 2c 20 31 | - 10 Ja|nuary, 1|
|00000200| 39 39 30 0a 20 2a 20 57 | 72 69 74 74 65 6e 20 62 |990. * W|ritten b|
|00000210| 79 20 44 6f 75 67 20 4d | 6f 6f 72 65 20 2d 20 52 |y Doug M|oore - R|
|00000220| 69 63 65 20 55 6e 69 76 | 65 72 73 69 74 79 20 2d |ice Univ|ersity -|
|00000230| 20 64 6f 75 67 6d 40 72 | 69 63 65 2e 65 64 75 20 | dougm@r|ice.edu |
|00000240| 2d 20 41 70 72 69 6c 20 | 27 38 37 0a 20 2a 20 53 |- April |'87. * S|
|00000250| 75 6e 20 62 75 67 20 66 | 69 78 65 73 2c 20 61 73 |un bug f|ixes, as|
|00000260| 73 6f 72 74 65 64 20 73 | 74 75 66 66 20 2d 20 4a |sorted s|tuff - J|
|00000270| 69 6d 20 53 61 73 61 6b | 69 2c 20 4d 61 72 63 68 |im Sasak|i, March|
|00000280| 20 27 38 39 0a 20 2a 20 | 43 68 61 6e 67 65 64 20 | '89. * |Changed |
|00000290| 64 65 66 61 75 6c 74 20 | 6d 61 78 5f 6c 69 6e 65 |default |max_line|
|000002a0| 5f 73 69 7a 65 20 66 72 | 6f 6d 20 32 30 30 30 20 |_size fr|om 2000 |
|000002b0| 74 6f 20 75 6e 6c 69 6d | 69 74 65 64 20 2d 20 44 |to unlim|ited - D|
|000002c0| 6f 75 67 20 4d 6f 6f 72 | 65 2c 20 41 70 72 69 6c |oug Moor|e, April|
|000002d0| 2c 20 27 38 39 0a 20 2a | 20 53 75 6e 20 33 2f 36 |, '89. *| Sun 3/6|
|000002e0| 30 20 64 6f 65 73 6e 27 | 74 20 6c 69 6b 65 20 6f |0 doesn'|t like o|
|000002f0| 64 64 2d 73 69 7a 65 64 | 20 73 74 72 75 63 74 73 |dd-sized| structs|
|00000300| 2e 20 20 42 75 67 20 66 | 69 78 65 64 20 2d 20 44 |. Bug f|ixed - D|
|00000310| 6f 75 67 20 4d 6f 6f 72 | 65 2c 20 41 70 72 69 6c |oug Moor|e, April|
|00000320| 2c 20 27 38 39 0a 20 2a | 20 20 20 20 20 20 20 20 |, '89. *| |
|00000330| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000340| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000350| 20 20 20 20 20 20 2d 20 | 61 69 64 65 64 20 62 79 | - |aided by|
|00000360| 20 53 70 65 6e 63 65 72 | 20 57 2e 20 54 68 6f 6d | Spencer| W. Thom|
|00000370| 61 73 0a 20 2a 20 44 69 | 64 6e 27 74 20 68 61 6e |as. * Di|dn't han|
|00000380| 64 6c 65 20 70 72 6f 70 | 65 72 6c 79 20 6d 61 6e |dle prop|erly man|
|00000390| 79 20 68 71 78 20 66 69 | 6c 65 73 20 63 6f 6d 62 |y hqx fi|les comb|
|000003a0| 69 6e 65 64 20 69 6e 20 | 6f 6e 65 20 66 69 6c 65 |ined in |one file|
|000003b0| 2e 20 20 42 75 67 20 66 | 69 78 65 64 20 2d 0a 20 |. Bug f|ixed -. |
|000003c0| 2a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |* | |
|000003d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000003e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 44 6f 75 67 | | Doug|
|000003f0| 20 4d 6f 6f 72 65 2c 20 | 4a 75 6e 65 2c 20 27 38 | Moore, |June, '8|
|00000400| 39 0a 20 2a 20 4d 6f 64 | 69 66 69 65 64 20 74 6f |9. * Mod|ified to|
|00000410| 20 68 61 6e 64 6c 65 20 | 4d 61 63 42 69 6e 61 72 | handle |MacBinar|
|00000420| 79 49 49 20 73 70 65 63 | 69 66 69 63 61 74 69 6f |yII spec|ificatio|
|00000430| 6e 2e 20 4a 69 6d 20 56 | 61 6e 20 56 65 72 74 68 |n. Jim V|an Verth|
|00000440| 2c 20 53 65 70 74 2c 20 | 27 38 39 0a 20 2a 0a 20 |, Sept, |'89. *. |
|00000450| 2a 20 46 69 78 65 64 20 | 61 20 62 75 67 20 77 68 |* Fixed |a bug wh|
|00000460| 65 6e 20 74 68 65 72 65 | 20 61 72 65 20 62 6c 61 |en there| are bla|
|00000470| 6e 6b 20 6c 69 6e 65 73 | 20 69 6e 20 68 71 78 20 |nk lines| in hqx |
|00000480| 64 61 74 61 2c 20 61 73 | 20 68 61 70 70 65 6e 73 |data, as| happens|
|00000490| 20 77 68 65 6e 20 6e 65 | 77 6c 69 6e 65 0a 20 2a | when ne|wline. *|
|000004a0| 20 67 65 74 20 74 72 61 | 6e 73 6c 61 74 65 64 20 | get tra|nslated |
|000004b0| 74 6f 20 43 52 4c 46 20 | 61 6e 64 20 74 68 65 6e |to CRLF |and then|
|000004c0| 20 74 6f 20 5c 6e 5c 6e | 2c 20 63 6f 6d 6d 6f 6e | to \n\n|, common|
|000004d0| 20 66 6f 72 20 73 6f 6d | 65 20 66 69 6c 65 20 74 | for som|e file t|
|000004e0| 72 61 6e 73 66 65 72 73 | 2e 0a 20 2a 20 54 68 65 |ransfers|.. * The|
|000004f0| 20 6c 61 73 74 20 68 71 | 78 20 6c 69 6e 65 20 77 | last hq|x line w|
|00000500| 6f 75 6c 64 20 62 65 20 | 6c 6f 73 74 20 69 66 20 |ould be |lost if |
|00000510| 74 68 65 20 70 72 65 76 | 69 6f 75 73 20 6c 69 6e |the prev|ious lin|
|00000520| 65 20 77 61 73 20 62 6c | 61 6e 6b 20 6f 72 20 6a |e was bl|ank or j|
|00000530| 75 6e 6b 2e 0a 20 2a 09 | 47 6c 65 6e 6e 20 54 72 |unk.. *.|Glenn Tr|
|00000540| 65 77 69 74 74 2c 20 53 | 74 61 6e 66 6f 72 64 20 |ewitt, S|tanford |
|00000550| 55 6e 69 76 65 72 73 69 | 74 79 2c 20 31 39 39 30 |Universi|ty, 1990|
|00000560| 09 28 31 2e 30 35 29 0a | 20 2a 0a 20 2a 20 46 69 |.(1.05).| *. * Fi|
|00000570| 78 65 64 20 61 20 62 75 | 67 20 74 68 61 74 20 6f |xed a bu|g that o|
|00000580| 63 63 75 72 72 65 64 20 | 77 68 65 6e 20 65 78 74 |ccurred |when ext|
|00000590| 72 61 63 74 69 6e 67 20 | 64 61 74 61 20 6f 72 20 |racting |data or |
|000005a0| 72 65 73 6f 75 72 63 65 | 0a 20 2a 20 66 6f 72 6b |resource|. * fork|
|000005b0| 73 20 6f 6e 20 61 20 53 | 75 6e 20 34 2e 20 20 49 |s on a S|un 4. I|
|000005c0| 74 20 77 61 73 20 61 20 | 62 79 74 65 20 61 6c 69 |t was a |byte ali|
|000005d0| 67 6e 6d 65 6e 74 20 70 | 72 6f 62 6c 65 6d 2e 0a |gnment p|roblem..|
|000005e0| 20 2a 20 52 69 63 6b 20 | 5a 61 63 63 6f 6e 65 2c | * Rick |Zaccone,|
|000005f0| 20 7a 61 63 63 6f 6e 65 | 40 62 75 63 6b 6e 65 6c | zaccone|@bucknel|
|00000600| 6c 2e 65 64 75 2e 20 20 | 41 70 72 69 6c 20 31 39 |l.edu. |April 19|
|00000610| 39 31 2e 20 20 56 65 72 | 73 69 6f 6e 20 31 2e 36 |91. Ver|sion 1.6|
|00000620| 0a 20 2a 0a 20 2a 20 54 | 68 69 73 20 70 72 6f 67 |. *. * T|his prog|
|00000630| 72 61 6d 20 6d 61 79 20 | 62 65 20 66 72 65 65 6c |ram may |be freel|
|00000640| 79 20 64 69 73 74 72 69 | 62 75 74 65 64 20 66 6f |y distri|buted fo|
|00000650| 72 20 6e 6f 6e 2d 70 72 | 6f 66 69 74 20 70 75 72 |r non-pr|ofit pur|
|00000660| 70 6f 73 65 73 2e 20 20 | 49 74 20 6d 61 79 20 6e |poses. |It may n|
|00000670| 6f 74 0a 20 2a 20 62 65 | 20 73 6f 6c 64 2c 20 62 |ot. * be| sold, b|
|00000680| 79 20 69 74 73 65 6c 66 | 20 6f 72 20 61 73 20 70 |y itself| or as p|
|00000690| 61 72 74 20 6f 66 20 61 | 20 63 6f 6c 6c 65 63 74 |art of a| collect|
|000006a0| 69 6f 6e 20 6f 66 20 73 | 6f 66 74 77 61 72 65 2e |ion of s|oftware.|
|000006b0| 20 20 49 74 20 6d 61 79 | 20 62 65 20 66 72 65 65 | It may| be free|
|000006c0| 6c 79 0a 20 2a 20 6d 6f | 64 69 66 69 65 64 20 61 |ly. * mo|dified a|
|000006d0| 73 20 6c 6f 6e 67 20 61 | 73 20 6e 6f 20 6d 6f 64 |s long a|s no mod|
|000006e0| 69 66 69 65 64 20 76 65 | 72 73 69 6f 6e 20 69 73 |ified ve|rsion is|
|000006f0| 20 64 69 73 74 72 69 62 | 75 74 65 64 2e 20 20 4d | distrib|uted. M|
|00000700| 6f 64 69 66 69 63 61 74 | 69 6f 6e 73 20 6f 66 0a |odificat|ions of.|
|00000710| 20 2a 20 69 6e 74 65 72 | 65 73 74 20 74 6f 20 61 | * inter|est to a|
|00000720| 6c 6c 20 63 61 6e 20 62 | 65 20 69 6e 63 6f 72 70 |ll can b|e incorp|
|00000730| 6f 72 61 74 65 64 20 69 | 6e 74 6f 20 74 68 65 20 |orated i|nto the |
|00000740| 70 72 6f 67 72 61 6d 20 | 62 79 20 73 65 6e 64 69 |program |by sendi|
|00000750| 6e 67 20 74 68 65 6d 20 | 74 6f 20 6d 65 0a 20 2a |ng them |to me. *|
|00000760| 20 66 6f 72 20 64 69 73 | 74 72 69 62 75 74 69 6f | for dis|tributio|
|00000770| 6e 2e 20 20 50 61 72 74 | 73 20 6f 66 20 74 68 65 |n. Part|s of the|
|00000780| 20 63 6f 64 65 20 63 61 | 6e 20 62 65 20 75 73 65 | code ca|n be use|
|00000790| 64 20 69 6e 20 6f 74 68 | 65 72 20 70 72 6f 67 72 |d in oth|er progr|
|000007a0| 61 6d 73 2e 20 20 49 20 | 61 6d 20 6e 6f 74 0a 20 |ams. I |am not. |
|000007b0| 2a 20 72 65 73 70 6f 6e | 73 69 62 6c 65 20 66 6f |* respon|sible fo|
|000007c0| 72 20 61 6e 79 20 64 61 | 6d 61 67 65 20 63 61 75 |r any da|mage cau|
|000007d0| 73 65 64 20 62 79 20 74 | 68 69 73 20 70 72 6f 67 |sed by t|his prog|
|000007e0| 72 61 6d 2e 20 20 49 20 | 68 6f 70 65 20 79 6f 75 |ram. I |hope you|
|000007f0| 20 65 6e 6a 6f 79 20 69 | 74 2e 0a 20 2a 2f 0a 0a | enjoy i|t.. */..|
|00000800| 23 69 6e 63 6c 75 64 65 | 20 22 6d 61 63 74 79 70 |#include| "mactyp|
|00000810| 65 73 2e 68 22 0a 0a 23 | 64 65 66 69 6e 65 20 48 |es.h"..#|define H|
|00000820| 51 58 20 30 0a 23 64 65 | 66 69 6e 65 20 54 45 58 |QX 0.#de|fine TEX|
|00000830| 54 20 31 0a 23 64 65 66 | 69 6e 65 20 44 41 54 41 |T 1.#def|ine DATA|
|00000840| 20 32 0a 23 64 65 66 69 | 6e 65 20 52 53 52 43 20 | 2.#defi|ne RSRC |
|00000850| 33 0a 23 64 65 66 69 6e | 65 20 48 4f 53 54 20 34 |3.#defin|e HOST 4|
|00000860| 0a 23 64 65 66 69 6e 65 | 20 46 4f 52 57 41 52 44 |.#define| FORWARD|
|00000870| 53 20 30 0a 23 64 65 66 | 69 6e 65 20 42 41 43 4b |S 0.#def|ine BACK|
|00000880| 57 41 52 44 53 20 31 0a | 0a 46 49 4c 45 20 2a 76 |WARDS 1.|.FILE *v|
|00000890| 65 72 62 6f 73 65 3b 0a | 63 68 61 72 20 2a 2a 68 |erbose;.|char **h|
|000008a0| 71 78 6e 61 6d 65 73 2c | 20 2a 2a 68 71 78 6e 61 |qxnames,| **hqxna|
|000008b0| 6d 65 73 5f 6c 65 66 74 | 3b 0a 63 68 61 72 20 2a |mes_left|;.char *|
|000008c0| 64 69 72 2c 20 2a 65 78 | 74 2c 20 2a 74 65 78 74 |dir, *ex|t, *text|
|000008d0| 5f 61 75 74 68 6f 72 3b | 0a 63 68 61 72 20 2a 6d |_author;|.char *m|
|000008e0| 61 78 6c 69 6e 65 73 5f | 73 74 72 3b 0a 69 6e 74 |axlines_|str;.int|
|000008f0| 20 6d 61 78 6c 69 6e 65 | 73 3b 0a 0a 6d 61 69 6e | maxline|s;..main|
|00000900| 28 61 72 67 63 2c 20 61 | 72 67 76 29 0a 69 6e 74 |(argc, a|rgv).int|
|00000910| 20 61 72 67 63 3b 0a 63 | 68 61 72 20 2a 2a 61 72 | argc;.c|har **ar|
|00000920| 67 76 3b 0a 7b 20 20 20 | 63 68 61 72 20 2a 66 6c |gv;.{ |char *fl|
|00000930| 61 67 73 2c 20 2a 67 65 | 74 65 6e 76 28 29 3b 0a |ags, *ge|tenv();.|
|00000940| 20 20 20 20 69 6e 74 20 | 64 69 72 65 63 74 69 6f | int |directio|
|00000950| 6e 2c 20 6d 6f 64 65 2c | 20 75 6e 70 69 74 5f 66 |n, mode,| unpit_f|
|00000960| 6c 61 67 3b 0a 0a 20 20 | 20 20 61 72 67 76 2b 2b |lag;.. | argv++|
|00000970| 3b 0a 20 20 20 20 61 72 | 67 63 2d 2d 3b 0a 20 20 |;. ar|gc--;. |
|00000980| 20 20 76 65 72 62 6f 73 | 65 20 3d 20 73 74 64 65 | verbos|e = stde|
|00000990| 72 72 3b 0a 20 20 20 20 | 64 69 72 65 63 74 69 6f |rr;. |directio|
|000009a0| 6e 20 3d 20 46 4f 52 57 | 41 52 44 53 3b 0a 20 20 |n = FORW|ARDS;. |
|000009b0| 20 20 6d 6f 64 65 20 3d | 20 48 51 58 3b 0a 20 20 | mode =| HQX;. |
|000009c0| 20 20 75 6e 70 69 74 5f | 66 6c 61 67 20 3d 20 30 | unpit_|flag = 0|
|000009d0| 3b 0a 0a 20 20 20 20 69 | 66 20 28 28 74 65 78 74 |;.. i|f ((text|
|000009e0| 5f 61 75 74 68 6f 72 20 | 3d 20 67 65 74 65 6e 76 |_author |= getenv|
|000009f0| 28 22 4d 41 43 5f 45 44 | 49 54 4f 52 22 29 29 20 |("MAC_ED|ITOR")) |
|00000a00| 20 20 20 3d 3d 20 4e 55 | 4c 4c 29 20 20 20 20 74 | == NU|LL) t|
|00000a10| 65 78 74 5f 61 75 74 68 | 6f 72 20 3d 20 22 4d 41 |ext_auth|or = "MA|
|00000a20| 43 41 22 3b 0a 20 20 20 | 20 69 66 20 28 28 65 78 |CA";. | if ((ex|
|00000a30| 74 20 3d 20 20 20 20 20 | 20 20 20 20 67 65 74 65 |t = | gete|
|00000a40| 6e 76 28 22 4d 41 43 5f | 45 58 54 22 29 29 20 20 |nv("MAC_|EXT")) |
|00000a50| 20 20 20 20 20 3d 3d 20 | 4e 55 4c 4c 29 20 20 20 | == |NULL) |
|00000a60| 20 65 78 74 20 3d 20 22 | 2e 62 69 6e 22 3b 0a 20 | ext = "|.bin";. |
|00000a70| 20 20 20 69 66 20 28 28 | 64 69 72 20 3d 20 20 20 | if ((|dir = |
|00000a80| 20 20 20 20 20 20 67 65 | 74 65 6e 76 28 22 4d 41 | ge|tenv("MA|
|00000a90| 43 5f 44 4c 4f 41 44 5f | 44 49 52 22 29 29 20 3d |C_DLOAD_|DIR")) =|
|00000aa0| 3d 20 4e 55 4c 4c 29 20 | 20 20 20 64 69 72 20 3d |= NULL) | dir =|
|00000ab0| 20 22 2e 22 3b 0a 20 20 | 20 20 69 66 20 28 28 6d | ".";. | if ((m|
|00000ac0| 61 78 6c 69 6e 65 73 5f | 73 74 72 20 3d 20 67 65 |axlines_|str = ge|
|00000ad0| 74 65 6e 76 28 22 4d 41 | 43 5f 4c 49 4e 45 5f 4c |tenv("MA|C_LINE_L|
|00000ae0| 49 4d 49 54 22 29 29 20 | 3d 3d 20 4e 55 4c 4c 29 |IMIT")) |== NULL)|
|00000af0| 20 20 6d 61 78 6c 69 6e | 65 73 20 3d 20 30 3b 0a | maxlin|es = 0;.|
|00000b00| 20 20 20 20 65 6c 73 65 | 09 09 09 09 09 09 09 09 | else|........|
|00000b10| 09 09 20 6d 61 78 6c 69 | 6e 65 73 20 3d 20 61 74 |.. maxli|nes = at|
|00000b20| 6f 69 28 6d 61 78 6c 69 | 6e 65 73 5f 73 74 72 29 |oi(maxli|nes_str)|
|00000b30| 3b 0a 20 20 20 20 0a 20 | 20 20 20 2f 2a 20 4d 61 |;. . | /* Ma|
|00000b40| 6b 65 20 63 6f 6d 6d 61 | 6e 64 20 6c 69 6e 65 20 |ke comma|nd line |
|00000b50| 61 72 67 75 6d 65 6e 74 | 73 20 67 6c 6f 62 61 6c |argument|s global|
|00000b60| 6c 79 20 61 63 63 65 73 | 73 69 62 6c 65 20 2a 2f |ly acces|sible */|
|00000b70| 0a 20 20 20 20 68 71 78 | 6e 61 6d 65 73 20 3d 20 |. hqx|names = |
|00000b80| 28 63 68 61 72 20 2a 2a | 29 20 63 61 6c 6c 6f 63 |(char **|) calloc|
|00000b90| 28 61 72 67 63 2b 31 2c | 20 73 69 7a 65 6f 66 28 |(argc+1,| sizeof(|
|00000ba0| 63 68 61 72 20 2a 29 29 | 3b 0a 20 20 20 20 68 71 |char *))|;. hq|
|00000bb0| 78 6e 61 6d 65 73 5f 6c | 65 66 74 20 3d 20 68 71 |xnames_l|eft = hq|
|00000bc0| 78 6e 61 6d 65 73 3b 0a | 20 20 20 20 77 68 69 6c |xnames;.| whil|
|00000bd0| 65 20 28 61 72 67 63 2d | 2d 29 20 20 2a 68 71 78 |e (argc-|-) *hqx|
|00000be0| 6e 61 6d 65 73 5f 6c 65 | 66 74 2b 2b 20 3d 20 2a |names_le|ft++ = *|
|00000bf0| 61 72 67 76 2b 2b 3b 0a | 20 20 20 20 2a 68 71 78 |argv++;.| *hqx|
|00000c00| 6e 61 6d 65 73 5f 6c 65 | 66 74 20 3d 20 22 2d 22 |names_le|ft = "-"|
|00000c10| 3b 0a 20 20 20 20 68 71 | 78 6e 61 6d 65 73 5f 6c |;. hq|xnames_l|
|00000c20| 65 66 74 20 3d 20 68 71 | 78 6e 61 6d 65 73 3b 0a |eft = hq|xnames;.|
|00000c30| 0a 20 20 20 20 77 68 69 | 6c 65 20 28 73 74 72 63 |. whi|le (strc|
|00000c40| 6d 70 28 2a 68 71 78 6e | 61 6d 65 73 5f 6c 65 66 |mp(*hqxn|ames_lef|
|00000c50| 74 2c 20 22 2d 22 29 29 | 20 7b 0a 20 20 20 20 20 |t, "-"))| {. |
|00000c60| 20 20 20 69 66 20 28 68 | 71 78 6e 61 6d 65 73 5f | if (h|qxnames_|
|00000c70| 6c 65 66 74 5b 30 5d 5b | 30 5d 20 3d 3d 20 27 2d |left[0][|0] == '-|
|00000c80| 27 29 20 7b 0a 20 20 20 | 20 20 20 20 20 20 20 20 |') {. | |
|00000c90| 20 66 6c 61 67 73 20 3d | 20 2a 68 71 78 6e 61 6d | flags =| *hqxnam|
|00000ca0| 65 73 5f 6c 65 66 74 2b | 2b 3b 0a 20 20 20 20 20 |es_left+|+;. |
|00000cb0| 20 20 20 20 20 20 20 77 | 68 69 6c 65 20 28 2a 2b | w|hile (*+|
|00000cc0| 2b 66 6c 61 67 73 29 0a | 20 20 20 20 20 20 20 20 |+flags).| |
|00000cd0| 20 20 20 20 20 20 20 20 | 73 77 69 74 63 68 20 28 | |switch (|
|00000ce0| 2a 66 6c 61 67 73 29 20 | 7b 0a 20 20 20 20 20 20 |*flags) |{. |
|00000cf0| 20 20 20 20 20 20 20 20 | 20 20 63 61 73 65 20 27 | | case '|
|00000d00| 78 27 3a 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |x':. | |
|00000d10| 20 20 20 20 20 20 20 20 | 6d 6f 64 65 20 3d 20 48 | |mode = H|
|00000d20| 51 58 3b 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |QX;. | |
|00000d30| 20 20 20 20 20 20 20 20 | 62 72 65 61 6b 3b 0a 20 | |break;. |
|00000d40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 63 | | c|
|00000d50| 61 73 65 20 27 75 27 3a | 0a 20 20 20 20 20 20 20 |ase 'u':|. |
|00000d60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 6d 6f 64 | | mod|
|00000d70| 65 20 3d 20 54 45 58 54 | 3b 0a 20 20 20 20 20 20 |e = TEXT|;. |
|00000d80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 62 72 | | br|
|00000d90| 65 61 6b 3b 0a 20 20 20 | 20 20 20 20 20 20 20 20 |eak;. | |
|00000da0| 20 20 20 20 20 63 61 73 | 65 20 27 64 27 3a 0a 20 | cas|e 'd':. |
|00000db0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000dc0| 20 20 20 6d 6f 64 65 20 | 3d 20 44 41 54 41 3b 0a | mode |= DATA;.|
|00000dd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000de0| 20 20 20 20 62 72 65 61 | 6b 3b 0a 20 20 20 20 20 | brea|k;. |
|00000df0| 20 20 20 20 20 20 20 20 | 20 20 20 63 61 73 65 20 | | case |
|00000e00| 27 72 27 3a 0a 20 20 20 | 20 20 20 20 20 20 20 20 |'r':. | |
|00000e10| 20 20 20 20 20 20 20 20 | 20 6d 6f 64 65 20 3d 20 | | mode = |
|00000e20| 52 53 52 43 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |RSRC;. | |
|00000e30| 20 20 20 20 20 20 20 20 | 20 20 62 72 65 61 6b 3b | | break;|
|00000e40| 0a 09 09 63 61 73 65 20 | 27 68 27 3a 0a 09 09 20 |...case |'h':... |
|00000e50| 20 20 20 6d 6f 64 65 20 | 3d 20 48 4f 53 54 3b 0a | mode |= HOST;.|
|00000e60| 09 09 20 20 20 20 62 72 | 65 61 6b 3b 0a 20 20 20 |.. br|eak;. |
|00000e70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 63 61 73 | | cas|
|00000e80| 65 20 27 44 27 3a 0a 20 | 20 20 20 20 20 20 20 20 |e 'D':. | |
|00000e90| 20 20 20 20 20 20 20 20 | 20 20 20 64 69 72 65 63 | | direc|
|00000ea0| 74 69 6f 6e 20 3d 20 46 | 4f 52 57 41 52 44 53 3b |tion = F|ORWARDS;|
|00000eb0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00000ec0| 20 20 20 20 20 62 72 65 | 61 6b 3b 0a 20 20 20 20 | bre|ak;. |
|00000ed0| 20 20 20 20 20 20 20 20 | 20 20 20 20 63 61 73 65 | | case|
|00000ee0| 20 27 55 27 3a 0a 20 20 | 20 20 20 20 20 20 20 20 | 'U':. | |
|00000ef0| 20 20 20 20 20 20 20 20 | 20 20 64 69 72 65 63 74 | | direct|
|00000f00| 69 6f 6e 20 3d 20 42 41 | 43 4b 57 41 52 44 53 3b |ion = BA|CKWARDS;|
|00000f10| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00000f20| 20 20 20 20 20 62 72 65 | 61 6b 3b 0a 20 20 20 20 | bre|ak;. |
|00000f30| 20 20 20 20 20 20 20 20 | 20 20 20 20 63 61 73 65 | | case|
|00000f40| 20 27 71 27 3a 0a 20 20 | 20 20 20 20 20 20 20 20 | 'q':. | |
|00000f50| 20 20 20 20 20 20 20 20 | 20 20 75 6e 70 69 74 5f | | unpit_|
|00000f60| 66 6c 61 67 20 3d 20 30 | 3b 0a 20 20 20 20 20 20 |flag = 0|;. |
|00000f70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 62 72 | | br|
|00000f80| 65 61 6b 3b 0a 20 20 20 | 20 20 20 20 20 20 20 20 |eak;. | |
|00000f90| 20 20 20 20 20 63 61 73 | 65 20 27 70 27 3a 0a 20 | cas|e 'p':. |
|00000fa0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000fb0| 20 20 20 75 6e 70 69 74 | 5f 66 6c 61 67 20 3d 20 | unpit|_flag = |
|00000fc0| 31 3b 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |1;. | |
|00000fd0| 20 20 20 20 20 20 20 62 | 72 65 61 6b 3b 0a 20 20 | b|reak;. |
|00000fe0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 63 61 | | ca|
|00000ff0| 73 65 20 27 73 27 3a 0a | 20 20 20 20 20 20 20 20 |se 's':.| |
|00001000| 20 20 20 20 20 20 20 20 | 20 20 20 20 76 65 72 62 | | verb|
|00001010| 6f 73 65 20 3d 20 66 6f | 70 65 6e 28 22 2f 64 65 |ose = fo|pen("/de|
|00001020| 76 2f 6e 75 6c 6c 22 2c | 20 22 77 22 29 3b 0a 20 |v/null",| "w");. |
|00001030| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001040| 20 20 20 62 72 65 61 6b | 3b 0a 20 20 20 20 20 20 | break|;. |
|00001050| 20 20 20 20 20 20 20 20 | 20 20 63 61 73 65 20 27 | | case '|
|00001060| 76 27 3a 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |v':. | |
|00001070| 20 20 20 20 20 20 20 20 | 76 65 72 62 6f 73 65 20 | |verbose |
|00001080| 3d 20 73 74 64 65 72 72 | 3b 0a 20 20 20 20 20 20 |= stderr|;. |
|00001090| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 62 72 | | br|
|000010a0| 65 61 6b 3b 0a 20 20 20 | 20 20 20 20 20 20 20 20 |eak;. | |
|000010b0| 20 20 20 20 20 64 65 66 | 61 75 6c 74 3a 0a 20 20 | def|ault:. |
|000010c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000010d0| 20 20 65 72 72 6f 72 28 | 0a 20 20 20 20 20 20 20 | error(|. |
|000010e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 22 55 73 | | "Us|
|000010f0| 61 67 65 3a 20 6d 63 76 | 65 72 74 20 5b 20 2d 5b |age: mcv|ert [ -[|
|00001100| 72 7c 64 7c 75 7c 78 7c | 68 5d 20 5b 44 7c 55 5d |r|d|u|x||h] [D|U]|
|00001110| 20 5b 70 7c 71 5d 20 5b | 73 7c 76 5d 20 5d 20 66 | [p|q] [|s|v] ] f|
|00001120| 69 6c 65 6e 61 6d 65 2e | 2e 2e 22 2c 0a 20 20 20 |ilename.|..",. |
|00001130| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001140| 20 4e 55 4c 4c 29 3b 0a | 20 20 20 20 20 20 20 20 | NULL);.| |
|00001150| 20 20 20 20 20 20 20 20 | 20 20 20 20 7d 0a 20 20 | | }. |
|00001160| 20 20 20 20 20 20 20 20 | 20 20 7d 0a 0a 20 20 20 | | }.. |
|00001170| 20 20 20 20 20 69 66 20 | 28 64 69 72 65 63 74 69 | if |(directi|
|00001180| 6f 6e 20 3d 3d 20 42 41 | 43 4b 57 41 52 44 53 29 |on == BA|CKWARDS)|
|00001190| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 69 66 20 |. | if |
|000011a0| 28 6d 6f 64 65 20 3d 3d | 20 48 51 58 20 26 26 20 |(mode ==| HQX && |
|000011b0| 75 6e 70 69 74 5f 66 6c | 61 67 29 20 72 65 5f 68 |unpit_fl|ag) re_h|
|000011c0| 71 78 28 29 3b 2f 2a 20 | 6e 6f 20 72 65 5f 70 69 |qx();/* |no re_pi|
|000011d0| 74 28 29 20 79 65 74 20 | 2a 2f 0a 20 20 20 20 20 |t() yet |*/. |
|000011e0| 20 20 20 20 20 20 20 65 | 6c 73 65 20 69 66 20 28 | e|lse if (|
|000011f0| 6d 6f 64 65 20 3d 3d 20 | 48 51 58 29 20 72 65 5f |mode == |HQX) re_|
|00001200| 68 71 78 28 29 3b 0a 20 | 20 20 20 20 20 20 20 20 |hqx();. | |
|00001210| 20 20 20 65 6c 73 65 20 | 72 65 5f 6f 74 68 65 72 | else |re_other|
|00001220| 28 6d 6f 64 65 29 3b 0a | 20 20 20 20 20 20 20 20 |(mode);.| |
|00001230| 65 6c 73 65 0a 20 20 20 | 20 20 20 20 20 20 20 20 |else. | |
|00001240| 20 69 66 20 28 6d 6f 64 | 65 20 3d 3d 20 48 51 58 | if (mod|e == HQX|
|00001250| 29 20 75 6e 5f 68 71 78 | 28 75 6e 70 69 74 5f 66 |) un_hqx|(unpit_f|
|00001260| 6c 61 67 29 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |lag);. | |
|00001270| 20 20 65 6c 73 65 20 75 | 6e 5f 6f 74 68 65 72 28 | else u|n_other(|
|00001280| 6d 6f 64 65 29 3b 0a 20 | 20 20 20 20 20 20 20 7d |mode);. | }|
|00001290| 0a 20 20 20 20 7d 0a 0a | 2f 2a 20 41 6e 20 61 72 |. }..|/* An ar|
|000012a0| 72 61 79 20 75 73 65 66 | 75 6c 20 66 6f 72 20 43 |ray usef|ul for C|
|000012b0| 52 43 20 63 61 6c 63 75 | 6c 61 74 69 6f 6e 73 20 |RC calcu|lations |
|000012c0| 74 68 61 74 20 75 73 65 | 20 30 78 31 30 32 31 20 |that use| 0x1021 |
|000012d0| 61 73 20 74 68 65 20 22 | 73 65 65 64 22 20 2a 2f |as the "|seed" */|
|000012e0| 0a 77 6f 72 64 20 6d 61 | 67 69 63 5b 5d 20 3d 20 |.word ma|gic[] = |
|000012f0| 7b 0a 20 20 20 20 30 78 | 30 30 30 30 2c 20 20 30 |{. 0x|0000, 0|
|00001300| 78 31 30 32 31 2c 20 20 | 30 78 32 30 34 32 2c 20 |x1021, |0x2042, |
|00001310| 20 30 78 33 30 36 33 2c | 20 20 30 78 34 30 38 34 | 0x3063,| 0x4084|
|00001320| 2c 20 20 30 78 35 30 61 | 35 2c 20 20 30 78 36 30 |, 0x50a|5, 0x60|
|00001330| 63 36 2c 20 20 30 78 37 | 30 65 37 2c 0a 20 20 20 |c6, 0x7|0e7,. |
|00001340| 20 30 78 38 31 30 38 2c | 20 20 30 78 39 31 32 39 | 0x8108,| 0x9129|
|00001350| 2c 20 20 30 78 61 31 34 | 61 2c 20 20 30 78 62 31 |, 0xa14|a, 0xb1|
|00001360| 36 62 2c 20 20 30 78 63 | 31 38 63 2c 20 20 30 78 |6b, 0xc|18c, 0x|
|00001370| 64 31 61 64 2c 20 20 30 | 78 65 31 63 65 2c 20 20 |d1ad, 0|xe1ce, |
|00001380| 30 78 66 31 65 66 2c 0a | 20 20 20 20 30 78 31 32 |0xf1ef,.| 0x12|
|00001390| 33 31 2c 20 20 30 78 30 | 32 31 30 2c 20 20 30 78 |31, 0x0|210, 0x|
|000013a0| 33 32 37 33 2c 20 20 30 | 78 32 32 35 32 2c 20 20 |3273, 0|x2252, |
|000013b0| 30 78 35 32 62 35 2c 20 | 20 30 78 34 32 39 34 2c |0x52b5, | 0x4294,|
|000013c0| 20 20 30 78 37 32 66 37 | 2c 20 20 30 78 36 32 64 | 0x72f7|, 0x62d|
|000013d0| 36 2c 0a 20 20 20 20 30 | 78 39 33 33 39 2c 20 20 |6,. 0|x9339, |
|000013e0| 30 78 38 33 31 38 2c 20 | 20 30 78 62 33 37 62 2c |0x8318, | 0xb37b,|
|000013f0| 20 20 30 78 61 33 35 61 | 2c 20 20 30 78 64 33 62 | 0xa35a|, 0xd3b|
|00001400| 64 2c 20 20 30 78 63 33 | 39 63 2c 20 20 30 78 66 |d, 0xc3|9c, 0xf|
|00001410| 33 66 66 2c 20 20 30 78 | 65 33 64 65 2c 0a 20 20 |3ff, 0x|e3de,. |
|00001420| 20 20 30 78 32 34 36 32 | 2c 20 20 30 78 33 34 34 | 0x2462|, 0x344|
|00001430| 33 2c 20 20 30 78 30 34 | 32 30 2c 20 20 30 78 31 |3, 0x04|20, 0x1|
|00001440| 34 30 31 2c 20 20 30 78 | 36 34 65 36 2c 20 20 30 |401, 0x|64e6, 0|
|00001450| 78 37 34 63 37 2c 20 20 | 30 78 34 34 61 34 2c 20 |x74c7, |0x44a4, |
|00001460| 20 30 78 35 34 38 35 2c | 0a 20 20 20 20 30 78 61 | 0x5485,|. 0xa|
|00001470| 35 36 61 2c 20 20 30 78 | 62 35 34 62 2c 20 20 30 |56a, 0x|b54b, 0|
|00001480| 78 38 35 32 38 2c 20 20 | 30 78 39 35 30 39 2c 20 |x8528, |0x9509, |
|00001490| 20 30 78 65 35 65 65 2c | 20 20 30 78 66 35 63 66 | 0xe5ee,| 0xf5cf|
|000014a0| 2c 20 20 30 78 63 35 61 | 63 2c 20 20 30 78 64 35 |, 0xc5a|c, 0xd5|
|000014b0| 38 64 2c 0a 20 20 20 20 | 30 78 33 36 35 33 2c 20 |8d,. |0x3653, |
|000014c0| 20 30 78 32 36 37 32 2c | 20 20 30 78 31 36 31 31 | 0x2672,| 0x1611|
|000014d0| 2c 20 20 30 78 30 36 33 | 30 2c 20 20 30 78 37 36 |, 0x063|0, 0x76|
|000014e0| 64 37 2c 20 20 30 78 36 | 36 66 36 2c 20 20 30 78 |d7, 0x6|6f6, 0x|
|000014f0| 35 36 39 35 2c 20 20 30 | 78 34 36 62 34 2c 0a 20 |5695, 0|x46b4,. |
|00001500| 20 20 20 30 78 62 37 35 | 62 2c 20 20 30 78 61 37 | 0xb75|b, 0xa7|
|00001510| 37 61 2c 20 20 30 78 39 | 37 31 39 2c 20 20 30 78 |7a, 0x9|719, 0x|
|00001520| 38 37 33 38 2c 20 20 30 | 78 66 37 64 66 2c 20 20 |8738, 0|xf7df, |
|00001530| 30 78 65 37 66 65 2c 20 | 20 30 78 64 37 39 64 2c |0xe7fe, | 0xd79d,|
|00001540| 20 20 30 78 63 37 62 63 | 2c 0a 20 20 20 20 30 78 | 0xc7bc|,. 0x|
|00001550| 34 38 63 34 2c 20 20 30 | 78 35 38 65 35 2c 20 20 |48c4, 0|x58e5, |
|00001560| 30 78 36 38 38 36 2c 20 | 20 30 78 37 38 61 37 2c |0x6886, | 0x78a7,|
|00001570| 20 20 30 78 30 38 34 30 | 2c 20 20 30 78 31 38 36 | 0x0840|, 0x186|
|00001580| 31 2c 20 20 30 78 32 38 | 30 32 2c 20 20 30 78 33 |1, 0x28|02, 0x3|
|00001590| 38 32 33 2c 0a 20 20 20 | 20 30 78 63 39 63 63 2c |823,. | 0xc9cc,|
|000015a0| 20 20 30 78 64 39 65 64 | 2c 20 20 30 78 65 39 38 | 0xd9ed|, 0xe98|
|000015b0| 65 2c 20 20 30 78 66 39 | 61 66 2c 20 20 30 78 38 |e, 0xf9|af, 0x8|
|000015c0| 39 34 38 2c 20 20 30 78 | 39 39 36 39 2c 20 20 30 |948, 0x|9969, 0|
|000015d0| 78 61 39 30 61 2c 20 20 | 30 78 62 39 32 62 2c 0a |xa90a, |0xb92b,.|
|000015e0| 20 20 20 20 30 78 35 61 | 66 35 2c 20 20 30 78 34 | 0x5a|f5, 0x4|
|000015f0| 61 64 34 2c 20 20 30 78 | 37 61 62 37 2c 20 20 30 |ad4, 0x|7ab7, 0|
|00001600| 78 36 61 39 36 2c 20 20 | 30 78 31 61 37 31 2c 20 |x6a96, |0x1a71, |
|00001610| 20 30 78 30 61 35 30 2c | 20 20 30 78 33 61 33 33 | 0x0a50,| 0x3a33|
|00001620| 2c 20 20 30 78 32 61 31 | 32 2c 0a 20 20 20 20 30 |, 0x2a1|2,. 0|
|00001630| 78 64 62 66 64 2c 20 20 | 30 78 63 62 64 63 2c 20 |xdbfd, |0xcbdc, |
|00001640| 20 30 78 66 62 62 66 2c | 20 20 30 78 65 62 39 65 | 0xfbbf,| 0xeb9e|
|00001650| 2c 20 20 30 78 39 62 37 | 39 2c 20 20 30 78 38 62 |, 0x9b7|9, 0x8b|
|00001660| 35 38 2c 20 20 30 78 62 | 62 33 62 2c 20 20 30 78 |58, 0xb|b3b, 0x|
|00001670| 61 62 31 61 2c 0a 20 20 | 20 20 30 78 36 63 61 36 |ab1a,. | 0x6ca6|
|00001680| 2c 20 20 30 78 37 63 38 | 37 2c 20 20 30 78 34 63 |, 0x7c8|7, 0x4c|
|00001690| 65 34 2c 20 20 30 78 35 | 63 63 35 2c 20 20 30 78 |e4, 0x5|cc5, 0x|
|000016a0| 32 63 32 32 2c 20 20 30 | 78 33 63 30 33 2c 20 20 |2c22, 0|x3c03, |
|000016b0| 30 78 30 63 36 30 2c 20 | 20 30 78 31 63 34 31 2c |0x0c60, | 0x1c41,|
|000016c0| 0a 20 20 20 20 30 78 65 | 64 61 65 2c 20 20 30 78 |. 0xe|dae, 0x|
|000016d0| 66 64 38 66 2c 20 20 30 | 78 63 64 65 63 2c 20 20 |fd8f, 0|xcdec, |
|000016e0| 30 78 64 64 63 64 2c 20 | 20 30 78 61 64 32 61 2c |0xddcd, | 0xad2a,|
|000016f0| 20 20 30 78 62 64 30 62 | 2c 20 20 30 78 38 64 36 | 0xbd0b|, 0x8d6|
|00001700| 38 2c 20 20 30 78 39 64 | 34 39 2c 0a 20 20 20 20 |8, 0x9d|49,. |
|00001710| 30 78 37 65 39 37 2c 20 | 20 30 78 36 65 62 36 2c |0x7e97, | 0x6eb6,|
|00001720| 20 20 30 78 35 65 64 35 | 2c 20 20 30 78 34 65 66 | 0x5ed5|, 0x4ef|
|00001730| 34 2c 20 20 30 78 33 65 | 31 33 2c 20 20 30 78 32 |4, 0x3e|13, 0x2|
|00001740| 65 33 32 2c 20 20 30 78 | 31 65 35 31 2c 20 20 30 |e32, 0x|1e51, 0|
|00001750| 78 30 65 37 30 2c 0a 20 | 20 20 20 30 78 66 66 39 |x0e70,. | 0xff9|
|00001760| 66 2c 20 20 30 78 65 66 | 62 65 2c 20 20 30 78 64 |f, 0xef|be, 0xd|
|00001770| 66 64 64 2c 20 20 30 78 | 63 66 66 63 2c 20 20 30 |fdd, 0x|cffc, 0|
|00001780| 78 62 66 31 62 2c 20 20 | 30 78 61 66 33 61 2c 20 |xbf1b, |0xaf3a, |
|00001790| 20 30 78 39 66 35 39 2c | 20 20 30 78 38 66 37 38 | 0x9f59,| 0x8f78|
|000017a0| 2c 0a 20 20 20 20 30 78 | 39 31 38 38 2c 20 20 30 |,. 0x|9188, 0|
|000017b0| 78 38 31 61 39 2c 20 20 | 30 78 62 31 63 61 2c 20 |x81a9, |0xb1ca, |
|000017c0| 20 30 78 61 31 65 62 2c | 20 20 30 78 64 31 30 63 | 0xa1eb,| 0xd10c|
|000017d0| 2c 20 20 30 78 63 31 32 | 64 2c 20 20 30 78 66 31 |, 0xc12|d, 0xf1|
|000017e0| 34 65 2c 20 20 30 78 65 | 31 36 66 2c 0a 20 20 20 |4e, 0xe|16f,. |
|000017f0| 20 30 78 31 30 38 30 2c | 20 20 30 78 30 30 61 31 | 0x1080,| 0x00a1|
|00001800| 2c 20 20 30 78 33 30 63 | 32 2c 20 20 30 78 32 30 |, 0x30c|2, 0x20|
|00001810| 65 33 2c 20 20 30 78 35 | 30 30 34 2c 20 20 30 78 |e3, 0x5|004, 0x|
|00001820| 34 30 32 35 2c 20 20 30 | 78 37 30 34 36 2c 20 20 |4025, 0|x7046, |
|00001830| 30 78 36 30 36 37 2c 0a | 20 20 20 20 30 78 38 33 |0x6067,.| 0x83|
|00001840| 62 39 2c 20 20 30 78 39 | 33 39 38 2c 20 20 30 78 |b9, 0x9|398, 0x|
|00001850| 61 33 66 62 2c 20 20 30 | 78 62 33 64 61 2c 20 20 |a3fb, 0|xb3da, |
|00001860| 30 78 63 33 33 64 2c 20 | 20 30 78 64 33 31 63 2c |0xc33d, | 0xd31c,|
|00001870| 20 20 30 78 65 33 37 66 | 2c 20 20 30 78 66 33 35 | 0xe37f|, 0xf35|
|00001880| 65 2c 0a 20 20 20 20 30 | 78 30 32 62 31 2c 20 20 |e,. 0|x02b1, |
|00001890| 30 78 31 32 39 30 2c 20 | 20 30 78 32 32 66 33 2c |0x1290, | 0x22f3,|
|000018a0| 20 20 30 78 33 32 64 32 | 2c 20 20 30 78 34 32 33 | 0x32d2|, 0x423|
|000018b0| 35 2c 20 20 30 78 35 32 | 31 34 2c 20 20 30 78 36 |5, 0x52|14, 0x6|
|000018c0| 32 37 37 2c 20 20 30 78 | 37 32 35 36 2c 0a 20 20 |277, 0x|7256,. |
|000018d0| 20 20 30 78 62 35 65 61 | 2c 20 20 30 78 61 35 63 | 0xb5ea|, 0xa5c|
|000018e0| 62 2c 20 20 30 78 39 35 | 61 38 2c 20 20 30 78 38 |b, 0x95|a8, 0x8|
|000018f0| 35 38 39 2c 20 20 30 78 | 66 35 36 65 2c 20 20 30 |589, 0x|f56e, 0|
|00001900| 78 65 35 34 66 2c 20 20 | 30 78 64 35 32 63 2c 20 |xe54f, |0xd52c, |
|00001910| 20 30 78 63 35 30 64 2c | 0a 20 20 20 20 30 78 33 | 0xc50d,|. 0x3|
|00001920| 34 65 32 2c 20 20 30 78 | 32 34 63 33 2c 20 20 30 |4e2, 0x|24c3, 0|
|00001930| 78 31 34 61 30 2c 20 20 | 30 78 30 34 38 31 2c 20 |x14a0, |0x0481, |
|00001940| 20 30 78 37 34 36 36 2c | 20 20 30 78 36 34 34 37 | 0x7466,| 0x6447|
|00001950| 2c 20 20 30 78 35 34 32 | 34 2c 20 20 30 78 34 34 |, 0x542|4, 0x44|
|00001960| 30 35 2c 0a 20 20 20 20 | 30 78 61 37 64 62 2c 20 |05,. |0xa7db, |
|00001970| 20 30 78 62 37 66 61 2c | 20 20 30 78 38 37 39 39 | 0xb7fa,| 0x8799|
|00001980| 2c 20 20 30 78 39 37 62 | 38 2c 20 20 30 78 65 37 |, 0x97b|8, 0xe7|
|00001990| 35 66 2c 20 20 30 78 66 | 37 37 65 2c 20 20 30 78 |5f, 0xf|77e, 0x|
|000019a0| 63 37 31 64 2c 20 20 30 | 78 64 37 33 63 2c 0a 20 |c71d, 0|xd73c,. |
|000019b0| 20 20 20 30 78 32 36 64 | 33 2c 20 20 30 78 33 36 | 0x26d|3, 0x36|
|000019c0| 66 32 2c 20 20 30 78 30 | 36 39 31 2c 20 20 30 78 |f2, 0x0|691, 0x|
|000019d0| 31 36 62 30 2c 20 20 30 | 78 36 36 35 37 2c 20 20 |16b0, 0|x6657, |
|000019e0| 30 78 37 36 37 36 2c 20 | 20 30 78 34 36 31 35 2c |0x7676, | 0x4615,|
|000019f0| 20 20 30 78 35 36 33 34 | 2c 0a 20 20 20 20 30 78 | 0x5634|,. 0x|
|00001a00| 64 39 34 63 2c 20 20 30 | 78 63 39 36 64 2c 20 20 |d94c, 0|xc96d, |
|00001a10| 30 78 66 39 30 65 2c 20 | 20 30 78 65 39 32 66 2c |0xf90e, | 0xe92f,|
|00001a20| 20 20 30 78 39 39 63 38 | 2c 20 20 30 78 38 39 65 | 0x99c8|, 0x89e|
|00001a30| 39 2c 20 20 30 78 62 39 | 38 61 2c 20 20 30 78 61 |9, 0xb9|8a, 0xa|
|00001a40| 39 61 62 2c 0a 20 20 20 | 20 30 78 35 38 34 34 2c |9ab,. | 0x5844,|
|00001a50| 20 20 30 78 34 38 36 35 | 2c 20 20 30 78 37 38 30 | 0x4865|, 0x780|
|00001a60| 36 2c 20 20 30 78 36 38 | 32 37 2c 20 20 30 78 31 |6, 0x68|27, 0x1|
|00001a70| 38 63 30 2c 20 20 30 78 | 30 38 65 31 2c 20 20 30 |8c0, 0x|08e1, 0|
|00001a80| 78 33 38 38 32 2c 20 20 | 30 78 32 38 61 33 2c 0a |x3882, |0x28a3,.|
|00001a90| 20 20 20 20 30 78 63 62 | 37 64 2c 20 20 30 78 64 | 0xcb|7d, 0xd|
|00001aa0| 62 35 63 2c 20 20 30 78 | 65 62 33 66 2c 20 20 30 |b5c, 0x|eb3f, 0|
|00001ab0| 78 66 62 31 65 2c 20 20 | 30 78 38 62 66 39 2c 20 |xfb1e, |0x8bf9, |
|00001ac0| 20 30 78 39 62 64 38 2c | 20 20 30 78 61 62 62 62 | 0x9bd8,| 0xabbb|
|00001ad0| 2c 20 20 30 78 62 62 39 | 61 2c 0a 20 20 20 20 30 |, 0xbb9|a,. 0|
|00001ae0| 78 34 61 37 35 2c 20 20 | 30 78 35 61 35 34 2c 20 |x4a75, |0x5a54, |
|00001af0| 20 30 78 36 61 33 37 2c | 20 20 30 78 37 61 31 36 | 0x6a37,| 0x7a16|
|00001b00| 2c 20 20 30 78 30 61 66 | 31 2c 20 20 30 78 31 61 |, 0x0af|1, 0x1a|
|00001b10| 64 30 2c 20 20 30 78 32 | 61 62 33 2c 20 20 30 78 |d0, 0x2|ab3, 0x|
|00001b20| 33 61 39 32 2c 0a 20 20 | 20 20 30 78 66 64 32 65 |3a92,. | 0xfd2e|
|00001b30| 2c 20 20 30 78 65 64 30 | 66 2c 20 20 30 78 64 64 |, 0xed0|f, 0xdd|
|00001b40| 36 63 2c 20 20 30 78 63 | 64 34 64 2c 20 20 30 78 |6c, 0xc|d4d, 0x|
|00001b50| 62 64 61 61 2c 20 20 30 | 78 61 64 38 62 2c 20 20 |bdaa, 0|xad8b, |
|00001b60| 30 78 39 64 65 38 2c 20 | 20 30 78 38 64 63 39 2c |0x9de8, | 0x8dc9,|
|00001b70| 0a 20 20 20 20 30 78 37 | 63 32 36 2c 20 20 30 78 |. 0x7|c26, 0x|
|00001b80| 36 63 30 37 2c 20 20 30 | 78 35 63 36 34 2c 20 20 |6c07, 0|x5c64, |
|00001b90| 30 78 34 63 34 35 2c 20 | 20 30 78 33 63 61 32 2c |0x4c45, | 0x3ca2,|
|00001ba0| 20 20 30 78 32 63 38 33 | 2c 20 20 30 78 31 63 65 | 0x2c83|, 0x1ce|
|00001bb0| 30 2c 20 20 30 78 30 63 | 63 31 2c 0a 20 20 20 20 |0, 0x0c|c1,. |
|00001bc0| 30 78 65 66 31 66 2c 20 | 20 30 78 66 66 33 65 2c |0xef1f, | 0xff3e,|
|00001bd0| 20 20 30 78 63 66 35 64 | 2c 20 20 30 78 64 66 37 | 0xcf5d|, 0xdf7|
|00001be0| 63 2c 20 20 30 78 61 66 | 39 62 2c 20 20 30 78 62 |c, 0xaf|9b, 0xb|
|00001bf0| 66 62 61 2c 20 20 30 78 | 38 66 64 39 2c 20 20 30 |fba, 0x|8fd9, 0|
|00001c00| 78 39 66 66 38 2c 0a 20 | 20 20 20 30 78 36 65 31 |x9ff8,. | 0x6e1|
|00001c10| 37 2c 20 20 30 78 37 65 | 33 36 2c 20 20 30 78 34 |7, 0x7e|36, 0x4|
|00001c20| 65 35 35 2c 20 20 30 78 | 35 65 37 34 2c 20 20 30 |e55, 0x|5e74, 0|
|00001c30| 78 32 65 39 33 2c 20 20 | 30 78 33 65 62 32 2c 20 |x2e93, |0x3eb2, |
|00001c40| 20 30 78 30 65 64 31 2c | 20 20 30 78 31 65 66 30 | 0x0ed1,| 0x1ef0|
|00001c50| 0a 20 20 20 20 7d 3b 0a | 0a 0a 2f 2a 0a 20 2a 20 |. };.|../*. * |
|00001c60| 63 61 6c 63 5f 63 72 63 | 28 29 20 2d 2d 0a 20 2a |calc_crc|() --. *|
|00001c70| 20 20 20 43 6f 6d 70 75 | 74 65 20 74 68 65 20 4d | Compu|te the M|
|00001c80| 61 63 42 69 6e 61 72 79 | 20 49 49 2d 73 74 79 6c |acBinary| II-styl|
|00001c90| 65 20 43 52 43 20 66 6f | 72 20 74 68 65 20 64 61 |e CRC fo|r the da|
|00001ca0| 74 61 20 70 6f 69 6e 74 | 65 64 20 74 6f 20 62 79 |ta point|ed to by|
|00001cb0| 20 70 2c 20 77 69 74 68 | 20 74 68 65 0a 20 2a 20 | p, with| the. * |
|00001cc0| 20 20 63 72 63 20 73 65 | 65 64 65 64 20 74 6f 20 | crc se|eded to |
|00001cd0| 73 65 65 64 2e 0a 20 2a | 0a 20 2a 20 20 20 4d 6f |seed.. *|. * Mo|
|00001ce0| 64 69 66 69 65 64 20 62 | 79 20 4a 69 6d 20 56 61 |dified b|y Jim Va|
|00001cf0| 6e 20 56 65 72 74 68 20 | 74 6f 20 75 73 65 20 74 |n Verth |to use t|
|00001d00| 68 65 20 6d 61 67 69 63 | 20 61 72 72 61 79 20 66 |he magic| array f|
|00001d10| 6f 72 20 65 66 66 69 63 | 69 65 6e 63 79 2e 0a 20 |or effic|iency.. |
|00001d20| 2a 2f 0a 73 68 6f 72 74 | 20 63 61 6c 63 5f 6d 62 |*/.short| calc_mb|
|00001d30| 5f 63 72 63 28 70 2c 20 | 6c 65 6e 2c 20 73 65 65 |_crc(p, |len, see|
|00001d40| 64 29 0a 75 6e 73 69 67 | 6e 65 64 20 63 68 61 72 |d).unsig|ned char|
|00001d50| 20 2a 70 3b 0a 6c 6f 6e | 67 20 6c 65 6e 3b 0a 73 | *p;.lon|g len;.s|
|00001d60| 68 6f 72 74 20 73 65 65 | 64 3b 0a 7b 0a 20 20 73 |hort see|d;.{. s|
|00001d70| 68 6f 72 74 20 68 6f 6c | 64 3b 20 20 20 20 20 20 |hort hol|d; |
|00001d80| 2f 2a 20 63 72 63 20 63 | 6f 6d 70 75 74 65 64 20 |/* crc c|omputed |
|00001d90| 73 6f 20 66 61 72 20 2a | 2f 0a 20 20 6c 6f 6e 67 |so far *|/. long|
|00001da0| 20 20 69 3b 20 20 20 20 | 20 20 20 20 20 2f 2a 20 | i; | /* |
|00001db0| 69 6e 64 65 78 20 69 6e | 74 6f 20 64 61 74 61 20 |index in|to data |
|00001dc0| 2a 2f 0a 0a 20 20 65 78 | 74 65 72 6e 20 75 6e 73 |*/.. ex|tern uns|
|00001dd0| 69 67 6e 65 64 20 73 68 | 6f 72 74 20 6d 61 67 69 |igned sh|ort magi|
|00001de0| 63 5b 5d 3b 20 20 20 2f | 2a 20 74 68 65 20 6d 61 |c[]; /|* the ma|
|00001df0| 67 69 63 20 61 72 72 61 | 79 20 2a 2f 0a 0a 20 20 |gic arra|y */.. |
|00001e00| 68 6f 6c 64 20 3d 20 73 | 65 65 64 3b 20 20 20 20 |hold = s|eed; |
|00001e10| 20 2f 2a 20 73 74 61 72 | 74 20 77 69 74 68 20 73 | /* star|t with s|
|00001e20| 65 65 64 20 2a 2f 0a 20 | 20 66 6f 72 20 28 69 20 |eed */. | for (i |
|00001e30| 3d 20 30 3b 20 69 20 3c | 20 6c 65 6e 3b 20 69 2b |= 0; i <| len; i+|
|00001e40| 2b 2c 20 70 2b 2b 29 20 | 7b 0a 20 20 20 20 68 6f |+, p++) |{. ho|
|00001e50| 6c 64 20 5e 3d 20 28 2a | 70 20 3c 3c 20 38 29 3b |ld ^= (*|p << 8);|
|00001e60| 0a 20 20 20 20 68 6f 6c | 64 20 3d 20 28 68 6f 6c |. hol|d = (hol|
|00001e70| 64 20 3c 3c 20 38 29 20 | 5e 20 6d 61 67 69 63 5b |d << 8) |^ magic[|
|00001e80| 28 75 6e 73 69 67 6e 65 | 64 20 63 68 61 72 29 28 |(unsigne|d char)(|
|00001e90| 68 6f 6c 64 20 3e 3e 20 | 38 29 5d 3b 0a 20 20 7d |hold >> |8)];. }|
|00001ea0| 0a 0a 20 20 72 65 74 75 | 72 6e 20 28 68 6f 6c 64 |.. retu|rn (hold|
|00001eb0| 29 3b 0a 7d 20 2f 2a 20 | 63 61 6c 63 5f 63 72 63 |);.} /* |calc_crc|
|00001ec0| 28 29 20 2a 2f 0a 0a 0a | 2f 2a 20 52 65 70 6f 72 |() */...|/* Repor|
|00001ed0| 74 20 61 20 66 61 74 61 | 6c 20 65 72 72 6f 72 20 |t a fata|l error |
|00001ee0| 2a 2f 0a 65 72 72 6f 72 | 28 6d 73 67 2c 20 6e 61 |*/.error|(msg, na|
|00001ef0| 6d 65 29 0a 63 68 61 72 | 20 6d 73 67 5b 5d 2c 20 |me).char| msg[], |
|00001f00| 6e 61 6d 65 5b 5d 3b 0a | 7b 20 20 20 66 70 72 69 |name[];.|{ fpri|
|00001f10| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 6d 73 67 2c |ntf(stde|rr, msg,|
|00001f20| 20 6e 61 6d 65 29 3b 0a | 20 20 20 20 70 75 74 63 | name);.| putc|
|00001f30| 28 27 5c 6e 27 2c 20 73 | 74 64 65 72 72 29 3b 0a |('\n', s|tderr);.|
|00001f40| 20 20 20 20 65 78 69 74 | 28 31 29 3b 0a 20 20 20 | exit|(1);. |
|00001f50| 20 7d 0a 0a 2f 2a 20 72 | 65 70 6c 61 63 65 20 69 | }../* r|eplace i|
|00001f60| 6c 6c 65 67 61 6c 20 55 | 6e 69 78 20 63 68 61 72 |llegal U|nix char|
|00001f70| 61 63 74 65 72 73 20 69 | 6e 20 66 69 6c 65 20 6e |acters i|n file n|
|00001f80| 61 6d 65 20 2a 2f 0a 2f | 2a 20 6d 61 6b 65 20 73 |ame */./|* make s|
|00001f90| 75 72 65 20 68 6f 73 74 | 20 66 69 6c 65 20 6e 61 |ure host| file na|
|00001fa0| 6d 65 20 64 6f 65 73 6e | 27 74 20 67 65 74 20 74 |me doesn|'t get t|
|00001fb0| 72 75 6e 63 61 74 65 64 | 20 62 65 79 6f 6e 64 20 |runcated| beyond |
|00001fc0| 72 65 63 6f 67 6e 69 74 | 69 6f 6e 20 2a 2f 0a 75 |recognit|ion */.u|
|00001fd0| 6e 69 78 69 66 79 28 6e | 70 29 0a 72 65 67 69 73 |nixify(n|p).regis|
|00001fe0| 74 65 72 20 62 79 74 65 | 20 2a 6e 70 3b 0a 7b 20 |ter byte| *np;.{ |
|00001ff0| 20 20 72 65 67 69 73 74 | 65 72 20 75 6c 6f 6e 67 | regist|er ulong|
|00002000| 20 63 3b 0a 20 20 20 20 | 63 20 3d 20 73 74 72 6c | c;. |c = strl|
|00002010| 65 6e 28 6e 70 29 3b 0a | 20 20 20 20 69 66 20 28 |en(np);.| if (|
|00002020| 63 20 3e 20 53 59 53 4e | 41 4d 45 4c 45 4e 20 2d |c > SYSN|AMELEN -|
|00002030| 20 34 29 20 63 20 3d 20 | 53 59 53 4e 41 4d 45 4c | 4) c = |SYSNAMEL|
|00002040| 45 4e 20 2d 20 34 3b 0a | 20 20 20 20 6e 70 5b 63 |EN - 4;.| np[c|
|00002050| 5d 20 3d 20 27 5c 30 27 | 3b 0a 20 20 20 20 6e 70 |] = '\0'|;. np|
|00002060| 2d 2d 3b 0a 20 20 20 20 | 77 68 69 6c 65 20 28 63 |--;. |while (c|
|00002070| 20 3d 20 2a 2b 2b 6e 70 | 29 0a 20 20 20 20 20 20 | = *++np|). |
|00002080| 20 20 69 66 20 28 63 20 | 3c 3d 20 27 20 27 20 7c | if (c |<= ' ' ||
|00002090| 7c 20 63 20 3d 3d 20 27 | 2f 27 20 7c 7c 20 63 20 || c == '|/' || c |
|000020a0| 3e 20 27 7e 27 29 20 2a | 6e 70 20 3d 20 27 5f 27 |> '~') *|np = '_'|
|000020b0| 3b 0a 20 20 20 20 7d 0a | 0a 2f 2a 20 43 6f 6e 76 |;. }.|./* Conv|
|000020c0| 65 72 74 20 55 6e 69 78 | 20 74 69 6d 65 20 28 47 |ert Unix| time (G|
|000020d0| 4d 54 20 73 69 6e 63 65 | 20 31 2d 31 2d 31 39 37 |MT since| 1-1-197|
|000020e0| 30 29 20 74 6f 20 4d 61 | 63 0a 20 20 20 20 20 20 |0) to Ma|c. |
|000020f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002100| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 74 69 | | ti|
|00002110| 6d 65 20 28 6c 6f 63 61 | 6c 20 73 69 6e 63 65 20 |me (loca|l since |
|00002120| 31 2d 31 2d 31 39 30 34 | 29 20 2a 2f 0a 23 64 65 |1-1-1904|) */.#de|
|00002130| 66 69 6e 65 20 4d 41 43 | 54 49 4d 45 44 49 46 46 |fine MAC|TIMEDIFF|
|00002140| 20 30 78 37 63 32 35 62 | 30 38 30 20 2f 2a 20 4d | 0x7c25b|080 /* M|
|00002150| 61 63 20 74 69 6d 65 20 | 6f 66 20 30 30 3a 30 30 |ac time |of 00:00|
|00002160| 3a 30 30 20 47 4d 54 2c | 20 4a 61 6e 20 31 2c 20 |:00 GMT,| Jan 1, |
|00002170| 31 39 37 30 20 2a 2f 0a | 0a 75 6c 6f 6e 67 20 74 |1970 */.|.ulong t|
|00002180| 69 6d 65 32 6d 61 63 28 | 74 69 6d 65 29 0a 75 6c |ime2mac(|time).ul|
|00002190| 6f 6e 67 20 74 69 6d 65 | 3b 0a 7b 20 20 20 73 74 |ong time|;.{ st|
|000021a0| 72 75 63 74 20 74 69 6d | 65 62 20 74 70 3b 0a 20 |ruct tim|eb tp;. |
|000021b0| 20 20 20 66 74 69 6d 65 | 28 26 74 70 29 3b 0a 20 | ftime|(&tp);. |
|000021c0| 20 20 20 72 65 74 75 72 | 6e 20 6c 6f 6e 67 32 6d | retur|n long2m|
|000021d0| 61 63 28 74 69 6d 65 20 | 2b 20 4d 41 43 54 49 4d |ac(time |+ MACTIM|
|000021e0| 45 44 49 46 46 0a 20 20 | 20 20 20 20 20 20 20 20 |EDIFF. | |
|000021f0| 20 20 20 20 20 20 20 20 | 20 20 2d 20 36 30 20 2a | | - 60 *|
|00002200| 20 28 74 70 2e 74 69 6d | 65 7a 6f 6e 65 20 2d 20 | (tp.tim|ezone - |
|00002210| 36 30 20 2a 20 74 70 2e | 64 73 74 66 6c 61 67 29 |60 * tp.|dstflag)|
|00002220| 29 3b 0a 20 20 20 20 7d | 0a 0a 0a 2f 2a 20 54 68 |);. }|.../* Th|
|00002230| 69 73 20 70 72 6f 63 65 | 64 75 72 65 20 63 6f 70 |is proce|dure cop|
|00002240| 69 65 73 20 74 68 65 20 | 69 6e 70 75 74 20 66 69 |ies the |input fi|
|00002250| 6c 65 20 74 6f 20 74 68 | 65 20 6f 75 74 70 75 74 |le to th|e output|
|00002260| 20 66 69 6c 65 2c 20 62 | 61 73 69 63 61 6c 6c 79 | file, b|asically|
|00002270| 2c 20 61 6c 74 68 6f 75 | 67 68 0a 20 20 20 20 69 |, althou|gh. i|
|00002280| 6e 20 54 45 58 54 20 6d | 6f 64 65 20 69 74 20 63 |n TEXT m|ode it c|
|00002290| 68 61 6e 67 65 73 20 4c | 46 27 73 20 74 6f 20 43 |hanges L|F's to C|
|000022a0| 52 27 73 20 61 6e 64 20 | 69 6e 20 61 6e 79 20 6d |R's and |in any m|
|000022b0| 6f 64 65 20 69 74 20 66 | 6f 72 67 65 73 20 61 20 |ode it f|orges a |
|000022c0| 4d 61 63 20 69 6e 66 6f | 20 0a 20 20 20 20 68 65 |Mac info| . he|
|000022d0| 61 64 65 72 2e 20 20 41 | 75 74 68 6f 72 20 74 79 |ader. A|uthor ty|
|000022e0| 70 65 20 66 6f 72 20 54 | 45 58 54 20 6d 6f 64 65 |pe for T|EXT mode|
|000022f0| 20 63 61 6e 20 63 6f 6d | 65 20 66 72 6f 6d 20 74 | can com|e from t|
|00002300| 68 65 20 4d 41 43 5f 45 | 44 49 54 4f 52 20 65 6e |he MAC_E|DITOR en|
|00002310| 76 69 72 6f 6e 2d 0a 20 | 20 20 20 6d 65 6e 74 20 |viron-. | ment |
|00002320| 76 61 72 69 61 62 6c 65 | 20 69 66 20 69 74 20 69 |variable| if it i|
|00002330| 73 20 64 65 66 69 6e 65 | 64 2e 20 2a 2f 0a 0a 75 |s define|d. */..u|
|00002340| 6e 5f 6f 74 68 65 72 28 | 6d 6f 64 65 29 0a 69 6e |n_other(|mode).in|
|00002350| 74 20 6d 6f 64 65 3b 0a | 7b 20 20 20 72 65 67 69 |t mode;.|{ regi|
|00002360| 73 74 65 72 20 75 6c 6f | 6e 67 20 62 3b 0a 20 20 |ster ulo|ng b;. |
|00002370| 20 20 72 65 67 69 73 74 | 65 72 20 75 6c 6f 6e 67 | regist|er ulong|
|00002380| 20 6e 63 68 61 72 73 3b | 0a 20 20 20 20 63 68 61 | nchars;|. cha|
|00002390| 72 20 74 78 74 66 6e 61 | 6d 65 5b 42 49 4e 4e 41 |r txtfna|me[BINNA|
|000023a0| 4d 45 4c 45 4e 5d 2c 20 | 62 69 6e 66 6e 61 6d 65 |MELEN], |binfname|
|000023b0| 5b 42 49 4e 4e 41 4d 45 | 4c 45 4e 5d 3b 0a 20 20 |[BINNAME|LEN];. |
|000023c0| 20 20 46 49 4c 45 20 2a | 74 78 74 66 69 6c 65 2c | FILE *|txtfile,|
|000023d0| 20 2a 62 69 6e 66 69 6c | 65 3b 20 0a 20 20 20 20 | *binfil|e; . |
|000023e0| 63 68 61 72 20 2a 73 75 | 66 66 69 78 3b 0a 20 20 |char *su|ffix;. |
|000023f0| 20 20 73 74 72 75 63 74 | 20 73 74 61 74 20 73 74 | struct| stat st|
|00002400| 62 75 66 3b 0a 20 20 20 | 20 69 6e 66 6f 5f 68 65 |buf;. | info_he|
|00002410| 61 64 65 72 20 69 6e 66 | 6f 3b 0a 20 20 20 20 69 |ader inf|o;. i|
|00002420| 6e 74 20 65 78 74 72 61 | 5f 63 68 61 72 73 3b 0a |nt extra|_chars;.|
|00002430| 20 20 20 20 75 6c 6f 6e | 67 20 64 6c 65 6e 2c 20 | ulon|g dlen, |
|00002440| 72 6c 65 6e 2c 20 6d 74 | 69 6d 2c 20 63 74 69 6d |rlen, mt|im, ctim|
|00002450| 3b 0a 20 20 20 20 73 68 | 6f 72 74 20 63 72 63 2c |;. sh|ort crc,|
|00002460| 20 63 61 6c 63 5f 6d 62 | 5f 63 72 63 28 29 3b 0a | calc_mb|_crc();.|
|00002470| 0a 20 20 20 20 69 66 20 | 28 6d 6f 64 65 20 3d 3d |. if |(mode ==|
|00002480| 20 44 41 54 41 29 20 73 | 75 66 66 69 78 20 3d 20 | DATA) s|uffix = |
|00002490| 22 2e 64 61 74 61 22 3b | 0a 20 20 20 20 65 6c 73 |".data";|. els|
|000024a0| 65 20 69 66 20 28 6d 6f | 64 65 20 3d 3d 20 52 53 |e if (mo|de == RS|
|000024b0| 52 43 29 20 73 75 66 66 | 69 78 20 3d 20 22 2e 72 |RC) suff|ix = ".r|
|000024c0| 73 72 63 22 3b 0a 20 20 | 20 20 65 6c 73 65 20 73 |src";. | else s|
|000024d0| 75 66 66 69 78 20 3d 20 | 22 2e 74 65 78 74 22 3b |uffix = |".text";|
|000024e0| 0a 0a 20 20 20 20 77 68 | 69 6c 65 20 28 68 71 78 |.. wh|ile (hqx|
|000024f0| 6e 61 6d 65 73 5f 6c 65 | 66 74 5b 30 5d 5b 30 5d |names_le|ft[0][0]|
|00002500| 20 21 3d 20 27 2d 27 29 | 20 7b 0a 0a 20 20 20 20 | != '-')| {.. |
|00002510| 20 20 20 20 73 74 72 63 | 70 79 28 74 78 74 66 6e | strc|py(txtfn|
|00002520| 61 6d 65 2c 20 2a 68 71 | 78 6e 61 6d 65 73 5f 6c |ame, *hq|xnames_l|
|00002530| 65 66 74 2b 2b 29 3b 0a | 20 20 20 20 20 20 20 20 |eft++);.| |
|00002540| 69 66 20 28 21 28 74 78 | 74 66 69 6c 65 20 3d 20 |if (!(tx|tfile = |
|00002550| 66 6f 70 65 6e 28 74 78 | 74 66 6e 61 6d 65 2c 20 |fopen(tx|tfname, |
|00002560| 22 72 22 29 29 29 20 7b | 0a 20 20 20 20 20 20 20 |"r"))) {|. |
|00002570| 20 20 20 20 20 2f 2a 20 | 4d 61 79 62 65 20 77 65 | /* |Maybe we|
|00002580| 20 61 72 65 20 73 75 70 | 70 6f 73 65 64 20 74 6f | are sup|posed to|
|00002590| 20 66 69 67 75 72 65 20 | 6f 75 74 20 74 68 65 20 | figure |out the |
|000025a0| 73 75 66 66 69 78 20 6f | 75 72 73 65 6c 76 65 73 |suffix o|urselves|
|000025b0| 3f 20 2a 2f 0a 20 20 20 | 20 20 20 20 20 20 20 20 |? */. | |
|000025c0| 20 73 74 72 63 61 74 28 | 74 78 74 66 6e 61 6d 65 | strcat(|txtfname|
|000025d0| 2c 20 73 75 66 66 69 78 | 29 3b 0a 20 20 20 20 20 |, suffix|);. |
|000025e0| 20 20 20 20 20 20 20 69 | 66 20 28 21 28 74 78 74 | i|f (!(txt|
|000025f0| 66 69 6c 65 20 3d 20 66 | 6f 70 65 6e 28 74 78 74 |file = f|open(txt|
|00002600| 66 6e 61 6d 65 2c 20 22 | 72 22 29 29 29 0a 20 20 |fname, "|r"))). |
|00002610| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 65 72 | | er|
|00002620| 72 6f 72 28 22 43 61 6e | 6e 6f 74 20 6f 70 65 6e |ror("Can|not open|
|00002630| 20 25 73 22 2c 20 74 78 | 74 66 6e 61 6d 65 29 3b | %s", tx|tfname);|
|00002640| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 7d 0a 0a |. | }..|
|00002650| 20 20 20 20 20 20 20 20 | 69 66 20 28 73 74 61 74 | |if (stat|
|00002660| 28 74 78 74 66 6e 61 6d | 65 2c 20 26 73 74 62 75 |(txtfnam|e, &stbu|
|00002670| 66 29 29 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |f)). | |
|00002680| 65 72 72 6f 72 28 22 43 | 61 6e 6e 6f 74 20 72 65 |error("C|annot re|
|00002690| 61 64 20 25 73 22 2c 20 | 74 78 74 66 6e 61 6d 65 |ad %s", |txtfname|
|000026a0| 29 3b 0a 0a 20 20 20 20 | 20 20 20 20 2f 2a 20 73 |);.. | /* s|
|000026b0| 74 75 66 66 20 68 65 61 | 64 65 72 20 64 61 74 61 |tuff hea|der data|
|000026c0| 20 69 6e 74 6f 20 74 68 | 65 20 69 6e 66 6f 20 68 | into th|e info h|
|000026d0| 65 61 64 65 72 20 2a 2f | 0a 20 20 20 20 20 20 20 |eader */|. |
|000026e0| 20 62 7a 65 72 6f 28 26 | 69 6e 66 6f 2c 20 73 69 | bzero(&|info, si|
|000026f0| 7a 65 6f 66 28 69 6e 66 | 6f 5f 68 65 61 64 65 72 |zeof(inf|o_header|
|00002700| 29 29 3b 0a 20 20 20 20 | 20 20 20 20 69 6e 66 6f |));. | info|
|00002710| 2e 6e 6c 65 6e 20 3d 20 | 73 74 72 6c 65 6e 28 74 |.nlen = |strlen(t|
|00002720| 78 74 66 6e 61 6d 65 29 | 3b 0a 20 20 20 20 20 20 |xtfname)|;. |
|00002730| 20 20 69 6e 66 6f 2e 6e | 6c 65 6e 20 3d 20 28 69 | info.n|len = (i|
|00002740| 6e 66 6f 2e 6e 6c 65 6e | 20 3e 20 4e 41 4d 45 4c |nfo.nlen| > NAMEL|
|00002750| 45 4e 29 20 3f 20 4e 41 | 4d 45 4c 45 4e 20 3a 20 |EN) ? NA|MELEN : |
|00002760| 69 6e 66 6f 2e 6e 6c 65 | 6e 3b 0a 09 69 6e 66 6f |info.nle|n;..info|
|00002770| 2e 6e 61 6d 65 5b 69 6e | 66 6f 2e 6e 6c 65 6e 5d |.name[in|fo.nlen]|
|00002780| 20 3d 20 27 5c 30 27 3b | 0a 20 20 20 20 20 20 20 | = '\0';|. |
|00002790| 20 73 74 72 63 70 79 28 | 69 6e 66 6f 2e 6e 61 6d | strcpy(|info.nam|
|000027a0| 65 2c 20 74 78 74 66 6e | 61 6d 65 29 3b 20 20 20 |e, txtfn|ame); |
|000027b0| 20 20 20 20 20 20 20 20 | 2f 2a 20 6e 61 6d 65 20 | |/* name |
|000027c0| 2a 2f 0a 20 20 20 20 20 | 20 20 20 6d 74 69 6d 20 |*/. | mtim |
|000027d0| 3d 20 74 69 6d 65 32 6d | 61 63 28 73 74 62 75 66 |= time2m|ac(stbuf|
|000027e0| 2e 73 74 5f 6d 74 69 6d | 65 29 3b 0a 20 20 20 20 |.st_mtim|e);. |
|000027f0| 20 20 20 20 63 74 69 6d | 20 3d 20 74 69 6d 65 32 | ctim| = time2|
|00002800| 6d 61 63 28 73 74 62 75 | 66 2e 73 74 5f 63 74 69 |mac(stbu|f.st_cti|
|00002810| 6d 65 29 3b 0a 20 20 20 | 20 20 20 20 20 62 63 6f |me);. | bco|
|00002820| 70 79 28 26 6d 74 69 6d | 2c 20 69 6e 66 6f 2e 6d |py(&mtim|, info.m|
|00002830| 74 69 6d 2c 20 34 29 3b | 0a 20 20 20 20 20 20 20 |tim, 4);|. |
|00002840| 20 62 63 6f 70 79 28 26 | 63 74 69 6d 2c 20 69 6e | bcopy(&|ctim, in|
|00002850| 66 6f 2e 63 74 69 6d 2c | 20 34 29 3b 0a 09 69 6e |fo.ctim,| 4);..in|
|00002860| 66 6f 2e 75 70 6c 6f 61 | 64 76 65 72 73 20 3d 20 |fo.uploa|dvers = |
|00002870| 27 5c 32 30 31 27 3b 0a | 09 69 6e 66 6f 2e 72 65 |'\201';.|.info.re|
|00002880| 61 64 76 65 72 73 20 3d | 20 27 5c 32 30 31 27 3b |advers =| '\201';|
|00002890| 0a 0a 20 20 20 20 20 20 | 20 20 69 66 20 28 6d 6f |.. | if (mo|
|000028a0| 64 65 20 3d 3d 20 52 53 | 52 43 29 20 7b 0a 20 20 |de == RS|RC) {. |
|000028b0| 20 20 20 20 20 20 20 20 | 20 20 2f 2a 20 64 6c 65 | | /* dle|
|000028c0| 6e 20 69 73 20 61 6c 72 | 65 61 64 79 20 7a 65 72 |n is alr|eady zer|
|000028d0| 6f 20 2a 2f 0a 20 20 20 | 20 20 20 20 20 20 20 20 |o */. | |
|000028e0| 20 72 6c 65 6e 20 3d 20 | 6c 6f 6e 67 32 6d 61 63 | rlen = |long2mac|
|000028f0| 28 73 74 62 75 66 2e 73 | 74 5f 73 69 7a 65 29 3b |(stbuf.s|t_size);|
|00002900| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 62 63 6f |. | bco|
|00002910| 70 79 28 26 72 6c 65 6e | 2c 20 69 6e 66 6f 2e 72 |py(&rlen|, info.r|
|00002920| 6c 65 6e 2c 20 34 29 3b | 0a 20 20 20 20 20 20 20 |len, 4);|. |
|00002930| 20 20 20 20 20 62 63 6f | 70 79 28 22 41 50 50 4c | bco|py("APPL|
|00002940| 22 2c 20 69 6e 66 6f 2e | 74 79 70 65 2c 20 34 29 |", info.|type, 4)|
|00002950| 3b 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 62 63 |;. | bc|
|00002960| 6f 70 79 28 22 43 43 4f | 4d 22 2c 20 69 6e 66 6f |opy("CCO|M", info|
|00002970| 2e 61 75 74 68 2c 20 34 | 29 3b 0a 20 20 20 20 20 |.auth, 4|);. |
|00002980| 20 20 20 20 20 20 20 7d | 0a 20 20 20 20 20 20 20 | }|. |
|00002990| 20 65 6c 73 65 20 7b 0a | 20 20 20 20 20 20 20 20 | else {.| |
|000029a0| 20 20 20 20 64 6c 65 6e | 20 3d 20 6c 6f 6e 67 32 | dlen| = long2|
|000029b0| 6d 61 63 28 73 74 62 75 | 66 2e 73 74 5f 73 69 7a |mac(stbu|f.st_siz|
|000029c0| 65 29 3b 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |e);. | |
|000029d0| 62 63 6f 70 79 28 26 64 | 6c 65 6e 2c 20 69 6e 66 |bcopy(&d|len, inf|
|000029e0| 6f 2e 64 6c 65 6e 2c 20 | 34 29 3b 0a 20 20 20 20 |o.dlen, |4);. |
|000029f0| 20 20 20 20 20 20 20 20 | 2f 2a 20 72 6c 65 6e 20 | |/* rlen |
|00002a00| 69 73 20 61 6c 72 65 61 | 64 79 20 7a 65 72 6f 20 |is alrea|dy zero |
|00002a10| 2a 2f 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 62 |*/. | b|
|00002a20| 63 6f 70 79 28 22 54 45 | 58 54 22 2c 20 69 6e 66 |copy("TE|XT", inf|
|00002a30| 6f 2e 74 79 70 65 2c 20 | 34 29 3b 0a 20 20 20 20 |o.type, |4);. |
|00002a40| 20 20 20 20 20 20 20 20 | 69 66 20 28 6d 6f 64 65 | |if (mode|
|00002a50| 20 3d 3d 20 44 41 54 41 | 29 20 62 63 6f 70 79 28 | == DATA|) bcopy(|
|00002a60| 22 3f 3f 3f 3f 22 2c 20 | 69 6e 66 6f 2e 61 75 74 |"????", |info.aut|
|00002a70| 68 2c 20 34 29 3b 0a 20 | 20 20 20 20 20 20 20 20 |h, 4);. | |
|00002a80| 20 20 20 65 6c 73 65 20 | 62 63 6f 70 79 28 74 65 | else |bcopy(te|
|00002a90| 78 74 5f 61 75 74 68 6f | 72 2c 20 69 6e 66 6f 2e |xt_autho|r, info.|
|00002aa0| 61 75 74 68 2c 20 34 29 | 3b 0a 20 20 20 20 20 20 |auth, 4)|;. |
|00002ab0| 20 20 20 20 20 20 7d 0a | 0a 09 2f 2a 20 63 61 6c | }.|../* cal|
|00002ac0| 63 75 6c 61 74 65 20 43 | 52 43 20 2a 2f 0a 09 63 |culate C|RC */..c|
|00002ad0| 72 63 20 3d 20 63 61 6c | 63 5f 6d 62 5f 63 72 63 |rc = cal|c_mb_crc|
|00002ae0| 28 26 69 6e 66 6f 2c 20 | 31 32 34 2c 20 30 29 3b |(&info, |124, 0);|
|00002af0| 0a 09 69 6e 66 6f 2e 63 | 72 63 5b 30 5d 20 3d 20 |..info.c|rc[0] = |
|00002b00| 28 63 68 61 72 29 20 28 | 63 72 63 20 3e 3e 20 38 |(char) (|crc >> 8|
|00002b10| 29 3b 0a 09 69 6e 66 6f | 2e 63 72 63 5b 31 5d 20 |);..info|.crc[1] |
|00002b20| 3d 20 28 63 68 61 72 29 | 20 63 72 63 3b 0a 0a 20 |= (char)| crc;.. |
|00002b30| 20 20 20 20 20 20 20 2f | 2a 20 43 72 65 61 74 65 | /|* Create|
|00002b40| 20 74 68 65 20 2e 62 69 | 6e 20 66 69 6c 65 20 61 | the .bi|n file a|
|00002b50| 6e 64 20 77 72 69 74 65 | 20 74 68 65 20 69 6e 66 |nd write| the inf|
|00002b60| 6f 20 74 6f 20 69 74 20 | 2a 2f 0a 20 20 20 20 20 |o to it |*/. |
|00002b70| 20 20 20 73 70 72 69 6e | 74 66 28 62 69 6e 66 6e | sprin|tf(binfn|
|00002b80| 61 6d 65 2c 20 22 25 73 | 2f 25 73 25 73 22 2c 20 |ame, "%s|/%s%s", |
|00002b90| 64 69 72 2c 20 74 78 74 | 66 6e 61 6d 65 2c 20 65 |dir, txt|fname, e|
|00002ba0| 78 74 29 3b 0a 20 20 20 | 20 20 20 20 20 69 66 20 |xt);. | if |
|00002bb0| 28 28 62 69 6e 66 69 6c | 65 20 3d 20 66 6f 70 65 |((binfil|e = fope|
|00002bc0| 6e 28 62 69 6e 66 6e 61 | 6d 65 2c 20 22 77 22 29 |n(binfna|me, "w")|
|00002bd0| 29 20 3d 3d 20 4e 55 4c | 4c 29 0a 20 20 20 20 20 |) == NUL|L). |
|00002be0| 20 20 20 20 20 20 20 65 | 72 72 6f 72 28 22 43 61 | e|rror("Ca|
|00002bf0| 6e 6e 6f 74 20 6f 70 65 | 6e 20 25 73 22 2c 20 62 |nnot ope|n %s", b|
|00002c00| 69 6e 66 6e 61 6d 65 29 | 3b 0a 20 20 20 20 20 20 |infname)|;. |
|00002c10| 20 20 66 70 72 69 6e 74 | 66 28 76 65 72 62 6f 73 | fprint|f(verbos|
|00002c20| 65 2c 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |e,. | |
|00002c30| 20 20 20 22 43 6f 6e 76 | 65 72 74 69 6e 67 20 20 | "Conv|erting |
|00002c40| 20 20 20 25 2d 33 30 73 | 20 74 79 70 65 20 3d 20 | %-30s| type = |
|00002c50| 5c 22 25 34 2e 34 73 5c | 22 2c 20 61 75 74 68 6f |\"%4.4s\|", autho|
|00002c60| 72 20 3d 20 5c 22 25 34 | 2e 34 73 5c 22 5c 6e 22 |r = \"%4|.4s\"\n"|
|00002c70| 2c 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |,. | |
|00002c80| 20 20 74 78 74 66 6e 61 | 6d 65 2c 20 69 6e 66 6f | txtfna|me, info|
|00002c90| 2e 74 79 70 65 2c 20 69 | 6e 66 6f 2e 61 75 74 68 |.type, i|nfo.auth|
|00002ca0| 29 3b 0a 20 20 20 20 20 | 20 20 20 66 77 72 69 74 |);. | fwrit|
|00002cb0| 65 28 26 69 6e 66 6f 2c | 20 73 69 7a 65 6f 66 28 |e(&info,| sizeof(|
|00002cc0| 69 6e 66 6f 29 2c 20 31 | 2c 20 62 69 6e 66 69 6c |info), 1|, binfil|
|00002cd0| 65 29 3b 0a 0a 20 20 20 | 20 20 20 20 20 6e 63 68 |e);.. | nch|
|00002ce0| 61 72 73 20 3d 20 73 74 | 62 75 66 2e 73 74 5f 73 |ars = st|buf.st_s|
|00002cf0| 69 7a 65 3b 0a 20 20 20 | 20 20 20 20 20 65 78 74 |ize;. | ext|
|00002d00| 72 61 5f 63 68 61 72 73 | 20 3d 20 31 32 37 20 2d |ra_chars| = 127 -|
|00002d10| 20 28 6e 63 68 61 72 73 | 2b 31 32 37 29 20 25 20 | (nchars|+127) % |
|00002d20| 31 32 38 3b 0a 20 20 20 | 20 20 20 20 20 69 66 20 |128;. | if |
|00002d30| 28 6d 6f 64 65 20 3d 3d | 20 54 45 58 54 29 20 77 |(mode ==| TEXT) w|
|00002d40| 68 69 6c 65 20 28 6e 63 | 68 61 72 73 2d 2d 29 20 |hile (nc|hars--) |
|00002d50| 7b 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 62 20 |{. | b |
|00002d60| 3d 20 67 65 74 63 28 74 | 78 74 66 69 6c 65 29 3b |= getc(t|xtfile);|
|00002d70| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 69 66 20 |. | if |
|00002d80| 28 62 20 3d 3d 20 4c 46 | 29 20 62 20 3d 20 43 52 |(b == LF|) b = CR|
|00002d90| 3b 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 70 75 |;. | pu|
|00002da0| 74 63 28 62 2c 20 62 69 | 6e 66 69 6c 65 29 3b 0a |tc(b, bi|nfile);.|
|00002db0| 20 20 20 20 20 20 20 20 | 20 20 20 20 7d 0a 20 20 | | }. |
|00002dc0| 20 20 20 20 20 20 65 6c | 73 65 20 77 68 69 6c 65 | el|se while|
|00002dd0| 20 28 6e 63 68 61 72 73 | 2d 2d 29 20 70 75 74 63 | (nchars|--) putc|
|00002de0| 28 67 65 74 63 28 74 78 | 74 66 69 6c 65 29 2c 20 |(getc(tx|tfile), |
|00002df0| 62 69 6e 66 69 6c 65 29 | 3b 0a 0a 20 20 20 20 20 |binfile)|;.. |
|00002e00| 20 20 20 77 68 69 6c 65 | 20 28 65 78 74 72 61 5f | while| (extra_|
|00002e10| 63 68 61 72 73 2d 2d 29 | 20 70 75 74 63 28 30 2c |chars--)| putc(0,|
|00002e20| 20 62 69 6e 66 69 6c 65 | 29 3b 0a 20 20 20 20 20 | binfile|);. |
|00002e30| 20 20 20 66 63 6c 6f 73 | 65 28 62 69 6e 66 69 6c | fclos|e(binfil|
|00002e40| 65 29 3b 0a 20 20 20 20 | 20 20 20 20 66 63 6c 6f |e);. | fclo|
|00002e50| 73 65 28 74 78 74 66 69 | 6c 65 29 3b 0a 20 20 20 |se(txtfi|le);. |
|00002e60| 20 20 20 20 20 7d 0a 20 | 20 20 20 7d 0a 0a 2f 2a | }. | }../*|
|00002e70| 20 54 68 69 73 20 70 72 | 6f 63 65 64 75 72 65 20 | This pr|ocedure |
|00002e80| 63 6f 70 69 65 73 20 74 | 68 65 20 69 6e 70 75 74 |copies t|he input|
|00002e90| 20 66 69 6c 65 20 74 6f | 20 74 68 65 20 6f 75 74 | file to| the out|
|00002ea0| 70 75 74 20 66 69 6c 65 | 2c 20 62 61 73 69 63 61 |put file|, basica|
|00002eb0| 6c 6c 79 2c 20 61 6c 74 | 68 6f 75 67 68 0a 20 20 |lly, alt|hough. |
|00002ec0| 20 20 69 6e 20 54 45 58 | 54 20 6d 6f 64 65 20 69 | in TEX|T mode i|
|00002ed0| 74 20 63 68 61 6e 67 65 | 73 20 43 52 27 73 20 74 |t change|s CR's t|
|00002ee0| 6f 20 4c 46 27 73 20 61 | 6e 64 20 69 6e 20 61 6e |o LF's a|nd in an|
|00002ef0| 79 20 6d 6f 64 65 20 69 | 74 20 73 6b 69 70 73 20 |y mode i|t skips |
|00002f00| 6f 76 65 72 20 74 68 65 | 20 4d 61 63 0a 20 20 20 |over the| Mac. |
|00002f10| 20 69 6e 66 6f 20 68 65 | 61 64 65 72 2e 20 2a 2f | info he|ader. */|
|00002f20| 0a 0a 72 65 5f 6f 74 68 | 65 72 28 6d 6f 64 65 29 |..re_oth|er(mode)|
|00002f30| 0a 69 6e 74 20 6d 6f 64 | 65 3b 0a 7b 20 20 20 72 |.int mod|e;.{ r|
|00002f40| 65 67 69 73 74 65 72 20 | 75 6c 6f 6e 67 20 62 3b |egister |ulong b;|
|00002f50| 0a 20 20 20 20 72 65 67 | 69 73 74 65 72 20 75 6c |. reg|ister ul|
|00002f60| 6f 6e 67 20 6e 63 68 61 | 72 73 3b 0a 20 20 20 20 |ong ncha|rs;. |
|00002f70| 75 6c 6f 6e 67 20 74 65 | 6d 70 3b 0a 20 20 20 20 |ulong te|mp;. |
|00002f80| 63 68 61 72 20 74 78 74 | 66 6e 61 6d 65 5b 42 49 |char txt|fname[BI|
|00002f90| 4e 4e 41 4d 45 4c 45 4e | 5d 2c 20 62 69 6e 66 6e |NNAMELEN|], binfn|
|00002fa0| 61 6d 65 5b 42 49 4e 4e | 41 4d 45 4c 45 4e 5d 3b |ame[BINN|AMELEN];|
|00002fb0| 0a 20 20 20 20 46 49 4c | 45 20 2a 74 78 74 66 69 |. FIL|E *txtfi|
|00002fc0| 6c 65 2c 20 2a 62 69 6e | 66 69 6c 65 3b 20 0a 20 |le, *bin|file; . |
|00002fd0| 20 20 20 63 68 61 72 20 | 2a 73 75 66 66 69 78 3b | char |*suffix;|
|00002fe0| 0a 20 20 20 20 69 6e 66 | 6f 5f 68 65 61 64 65 72 |. inf|o_header|
|00002ff0| 20 69 6e 66 6f 3b 0a 0a | 20 20 20 20 69 66 20 28 | info;..| if (|
|00003000| 6d 6f 64 65 20 3d 3d 20 | 44 41 54 41 29 20 73 75 |mode == |DATA) su|
|00003010| 66 66 69 78 20 3d 20 22 | 2e 64 61 74 61 22 3b 0a |ffix = "|.data";.|
|00003020| 20 20 20 20 65 6c 73 65 | 20 69 66 20 28 6d 6f 64 | else| if (mod|
|00003030| 65 20 3d 3d 20 52 53 52 | 43 29 20 73 75 66 66 69 |e == RSR|C) suffi|
|00003040| 78 20 3d 20 22 2e 72 73 | 72 63 22 3b 0a 20 20 20 |x = ".rs|rc";. |
|00003050| 20 65 6c 73 65 20 73 75 | 66 66 69 78 20 3d 20 22 | else su|ffix = "|
|00003060| 2e 74 65 78 74 22 3b 0a | 0a 20 20 20 20 77 68 69 |.text";.|. whi|
|00003070| 6c 65 20 28 68 71 78 6e | 61 6d 65 73 5f 6c 65 66 |le (hqxn|ames_lef|
|00003080| 74 5b 30 5d 5b 30 5d 20 | 21 3d 20 27 2d 27 29 20 |t[0][0] |!= '-') |
|00003090| 7b 0a 0a 20 20 20 20 20 | 20 20 20 73 74 72 63 70 |{.. | strcp|
|000030a0| 79 28 62 69 6e 66 6e 61 | 6d 65 2c 20 2a 68 71 78 |y(binfna|me, *hqx|
|000030b0| 6e 61 6d 65 73 5f 6c 65 | 66 74 2b 2b 29 3b 0a 20 |names_le|ft++);. |
|000030c0| 20 20 20 20 20 20 20 69 | 66 20 28 28 62 69 6e 66 | i|f ((binf|
|000030d0| 69 6c 65 20 3d 20 66 6f | 70 65 6e 28 62 69 6e 66 |ile = fo|pen(binf|
|000030e0| 6e 61 6d 65 2c 20 22 72 | 22 29 29 20 3d 3d 20 4e |name, "r|")) == N|
|000030f0| 55 4c 4c 29 20 7b 0a 20 | 20 20 20 20 20 20 20 20 |ULL) {. | |
|00003100| 20 20 20 2f 2a 20 4d 61 | 79 62 65 20 77 65 20 61 | /* Ma|ybe we a|
|00003110| 72 65 20 73 75 70 70 6f | 73 65 64 20 74 6f 20 66 |re suppo|sed to f|
|00003120| 69 67 75 72 65 20 6f 75 | 74 20 74 68 65 20 73 75 |igure ou|t the su|
|00003130| 66 66 69 78 20 6f 75 72 | 73 65 6c 76 65 73 3f 20 |ffix our|selves? |
|00003140| 2a 2f 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 73 |*/. | s|
|00003150| 74 72 63 61 74 28 62 69 | 6e 66 6e 61 6d 65 2c 20 |trcat(bi|nfname, |
|00003160| 65 78 74 29 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |ext);. | |
|00003170| 20 20 69 66 20 28 21 28 | 62 69 6e 66 69 6c 65 20 | if (!(|binfile |
|00003180| 3d 20 66 6f 70 65 6e 28 | 62 69 6e 66 6e 61 6d 65 |= fopen(|binfname|
|00003190| 2c 20 22 72 22 29 29 29 | 0a 20 20 20 20 20 20 20 |, "r")))|. |
|000031a0| 20 20 20 20 20 20 20 20 | 20 65 72 72 6f 72 28 22 | | error("|
|000031b0| 43 61 6e 6e 6f 74 20 6f | 70 65 6e 20 25 73 22 2c |Cannot o|pen %s",|
|000031c0| 20 62 69 6e 66 6e 61 6d | 65 29 3b 0a 20 20 20 20 | binfnam|e);. |
|000031d0| 20 20 20 20 20 20 20 20 | 7d 0a 0a 20 20 20 20 20 | |}.. |
|000031e0| 20 20 20 2f 2a 20 52 65 | 61 64 20 74 68 65 20 69 | /* Re|ad the i|
|000031f0| 6e 66 6f 20 66 72 6f 6d | 20 74 68 65 20 2e 62 69 |nfo from| the .bi|
|00003200| 6e 20 66 69 6c 65 2c 20 | 63 72 65 61 74 65 20 74 |n file, |create t|
|00003210| 68 65 20 6f 75 74 70 75 | 74 20 66 69 6c 65 20 2a |he outpu|t file *|
|00003220| 2f 0a 20 20 20 20 20 20 | 20 20 66 72 65 61 64 28 |/. | fread(|
|00003230| 26 69 6e 66 6f 2c 20 73 | 69 7a 65 6f 66 28 69 6e |&info, s|izeof(in|
|00003240| 66 6f 29 2c 20 31 2c 20 | 62 69 6e 66 69 6c 65 29 |fo), 1, |binfile)|
|00003250| 3b 0a 20 20 20 20 20 20 | 20 20 73 74 72 6e 63 70 |;. | strncp|
|00003260| 79 28 74 78 74 66 6e 61 | 6d 65 2c 20 69 6e 66 6f |y(txtfna|me, info|
|00003270| 2e 6e 61 6d 65 2c 20 69 | 6e 66 6f 2e 6e 6c 65 6e |.name, i|nfo.nlen|
|00003280| 29 3b 0a 09 74 78 74 66 | 6e 61 6d 65 5b 69 6e 66 |);..txtf|name[inf|
|00003290| 6f 2e 6e 6c 65 6e 5d 20 | 3d 20 27 5c 30 27 3b 0a |o.nlen] |= '\0';.|
|000032a0| 20 20 20 20 20 20 20 20 | 66 70 72 69 6e 74 66 28 | |fprintf(|
|000032b0| 76 65 72 62 6f 73 65 2c | 0a 20 20 20 20 20 20 20 |verbose,|. |
|000032c0| 20 20 20 20 20 20 20 20 | 20 22 43 6f 6e 76 65 72 | | "Conver|
|000032d0| 74 69 6e 67 20 20 20 20 | 20 25 2d 33 30 73 20 74 |ting | %-30s t|
|000032e0| 79 70 65 20 3d 20 5c 22 | 25 34 2e 34 73 5c 22 2c |ype = \"|%4.4s\",|
|000032f0| 20 61 75 74 68 6f 72 20 | 3d 20 5c 22 25 34 2e 34 | author |= \"%4.4|
|00003300| 73 5c 22 5c 6e 22 2c 0a | 20 20 20 20 20 20 20 20 |s\"\n",.| |
|00003310| 20 20 20 20 20 20 20 20 | 74 78 74 66 6e 61 6d 65 | |txtfname|
|00003320| 2c 20 69 6e 66 6f 2e 74 | 79 70 65 2c 20 69 6e 66 |, info.t|ype, inf|
|00003330| 6f 2e 61 75 74 68 29 3b | 0a 20 20 20 20 20 20 20 |o.auth);|. |
|00003340| 20 69 66 20 28 28 74 78 | 74 66 69 6c 65 20 3d 20 | if ((tx|tfile = |
|00003350| 66 6f 70 65 6e 28 74 78 | 74 66 6e 61 6d 65 2c 20 |fopen(tx|tfname, |
|00003360| 22 72 22 29 29 20 3d 3d | 20 4e 55 4c 4c 29 20 7b |"r")) ==| NULL) {|
|00003370| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 69 66 20 |. | if |
|00003380| 28 28 74 78 74 66 69 6c | 65 20 3d 20 66 6f 70 65 |((txtfil|e = fope|
|00003390| 6e 28 74 78 74 66 6e 61 | 6d 65 2c 20 22 77 22 29 |n(txtfna|me, "w")|
|000033a0| 29 20 3d 3d 20 4e 55 4c | 4c 29 0a 20 20 20 20 20 |) == NUL|L). |
|000033b0| 20 20 20 20 20 20 20 20 | 20 20 20 65 72 72 6f 72 | | error|
|000033c0| 28 22 43 61 6e 6e 6f 74 | 20 6f 70 65 6e 20 25 73 |("Cannot| open %s|
|000033d0| 22 2c 20 74 78 74 66 6e | 61 6d 65 29 3b 0a 20 20 |", txtfn|ame);. |
|000033e0| 20 20 20 20 20 20 20 20 | 20 20 7d 0a 20 20 20 20 | | }. |
|000033f0| 20 20 20 20 65 6c 73 65 | 20 7b 0a 20 20 20 20 20 | else| {. |
|00003400| 20 20 20 20 20 20 20 66 | 63 6c 6f 73 65 28 74 78 | f|close(tx|
|00003410| 74 66 69 6c 65 29 3b 0a | 20 20 20 20 20 20 20 20 |tfile);.| |
|00003420| 20 20 20 20 73 74 72 63 | 61 74 28 74 78 74 66 6e | strc|at(txtfn|
|00003430| 61 6d 65 2c 20 73 75 66 | 66 69 78 29 3b 0a 20 20 |ame, suf|fix);. |
|00003440| 20 20 20 20 20 20 20 20 | 20 20 69 66 20 28 28 74 | | if ((t|
|00003450| 78 74 66 69 6c 65 20 3d | 20 66 6f 70 65 6e 28 74 |xtfile =| fopen(t|
|00003460| 78 74 66 6e 61 6d 65 2c | 20 22 77 22 29 29 20 3d |xtfname,| "w")) =|
|00003470| 3d 20 4e 55 4c 4c 29 0a | 20 20 20 20 20 20 20 20 |= NULL).| |
|00003480| 20 20 20 20 20 20 20 20 | 65 72 72 6f 72 28 22 43 | |error("C|
|00003490| 61 6e 6e 6f 74 20 6f 70 | 65 6e 20 25 73 22 2c 20 |annot op|en %s", |
|000034a0| 74 78 74 66 6e 61 6d 65 | 29 3b 0a 20 20 20 20 20 |txtfname|);. |
|000034b0| 20 20 20 20 20 20 20 7d | 0a 0a 09 62 63 6f 70 79 | }|...bcopy|
|000034c0| 28 69 6e 66 6f 2e 64 6c | 65 6e 2c 20 28 63 68 61 |(info.dl|en, (cha|
|000034d0| 72 20 2a 29 20 26 74 65 | 6d 70 2c 20 34 29 3b 0a |r *) &te|mp, 4);.|
|000034e0| 09 6e 63 68 61 72 73 20 | 3d 20 74 65 6d 70 3b 0a |.nchars |= temp;.|
|000034f0| 20 20 20 20 20 20 20 20 | 69 66 20 28 6d 6f 64 65 | |if (mode|
|00003500| 20 3d 3d 20 54 45 58 54 | 29 20 77 68 69 6c 65 20 | == TEXT|) while |
|00003510| 28 6e 63 68 61 72 73 2d | 2d 29 20 7b 0a 20 20 20 |(nchars-|-) {. |
|00003520| 20 20 20 20 20 20 20 20 | 20 62 20 3d 20 67 65 74 | | b = get|
|00003530| 63 28 62 69 6e 66 69 6c | 65 29 3b 0a 20 20 20 20 |c(binfil|e);. |
|00003540| 20 20 20 20 20 20 20 20 | 69 66 20 28 62 20 3d 3d | |if (b ==|
|00003550| 20 43 52 29 20 62 20 3d | 20 4c 46 3b 0a 20 20 20 | CR) b =| LF;. |
|00003560| 20 20 20 20 20 20 20 20 | 20 70 75 74 63 28 62 2c | | putc(b,|
|00003570| 20 74 78 74 66 69 6c 65 | 29 3b 0a 20 20 20 20 20 | txtfile|);. |
|00003580| 20 20 20 20 20 20 20 7d | 0a 20 20 20 20 20 20 20 | }|. |
|00003590| 20 65 6c 73 65 20 69 66 | 20 28 6d 6f 64 65 20 3d | else if| (mode =|
|000035a0| 3d 20 44 41 54 41 29 20 | 77 68 69 6c 65 20 28 6e |= DATA) |while (n|
|000035b0| 63 68 61 72 73 2d 2d 29 | 0a 20 20 20 20 20 20 20 |chars--)|. |
|000035c0| 20 20 20 20 20 70 75 74 | 63 28 67 65 74 63 28 62 | put|c(getc(b|
|000035d0| 69 6e 66 69 6c 65 29 2c | 20 74 78 74 66 69 6c 65 |infile),| txtfile|
|000035e0| 29 3b 0a 20 20 20 20 20 | 20 20 20 65 6c 73 65 20 |);. | else |
|000035f0| 7b 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 77 68 |{. | wh|
|00003600| 69 6c 65 20 28 6e 63 68 | 61 72 73 2d 2d 29 20 67 |ile (nch|ars--) g|
|00003610| 65 74 63 28 62 69 6e 66 | 69 6c 65 29 3b 0a 09 20 |etc(binf|ile);.. |
|00003620| 20 20 20 62 63 6f 70 79 | 28 69 6e 66 6f 2e 72 6c | bcopy|(info.rl|
|00003630| 65 6e 2c 20 28 63 68 61 | 72 20 2a 29 20 26 74 65 |en, (cha|r *) &te|
|00003640| 6d 70 2c 20 34 29 3b 0a | 09 20 20 20 20 6e 63 68 |mp, 4);.|. nch|
|00003650| 61 72 73 20 3d 20 74 65 | 6d 70 3b 0a 20 20 20 20 |ars = te|mp;. |
|00003660| 20 20 20 20 20 20 20 20 | 77 68 69 6c 65 20 28 6e | |while (n|
|00003670| 63 68 61 72 73 2d 2d 29 | 20 70 75 74 63 28 67 65 |chars--)| putc(ge|
|00003680| 74 63 28 62 69 6e 66 69 | 6c 65 29 2c 20 74 78 74 |tc(binfi|le), txt|
|00003690| 66 69 6c 65 29 3b 0a 20 | 20 20 20 20 20 20 20 20 |file);. | |
|000036a0| 20 20 20 7d 0a 0a 20 20 | 20 20 20 20 20 20 66 63 | }.. | fc|
|000036b0| 6c 6f 73 65 28 62 69 6e | 66 69 6c 65 29 3b 0a 20 |lose(bin|file);. |
|000036c0| 20 20 20 20 20 20 20 66 | 63 6c 6f 73 65 28 74 78 | f|close(tx|
|000036d0| 74 66 69 6c 65 29 3b 0a | 20 20 20 20 20 20 20 20 |tfile);.| |
|000036e0| 7d 0a 20 20 20 20 7d 0a | 53 48 41 52 5f 45 4f 46 |}. }.|SHAR_EOF|
|000036f0| 0a 66 69 20 23 20 65 6e | 64 20 6f 66 20 6f 76 65 |.fi # en|d of ove|
|00003700| 72 77 72 69 74 69 6e 67 | 20 63 68 65 63 6b 0a 69 |rwriting| check.i|
|00003710| 66 20 74 65 73 74 20 2d | 66 20 27 68 71 78 69 66 |f test -|f 'hqxif|
|00003720| 79 2e 63 27 0a 74 68 65 | 6e 0a 09 65 63 68 6f 20 |y.c'.the|n..echo |
|00003730| 73 68 61 72 3a 20 77 69 | 6c 6c 20 6e 6f 74 20 6f |shar: wi|ll not o|
|00003740| 76 65 72 2d 77 72 69 74 | 65 20 65 78 69 73 74 69 |ver-writ|e existi|
|00003750| 6e 67 20 66 69 6c 65 20 | 22 27 68 71 78 69 66 79 |ng file |"'hqxify|
|00003760| 2e 63 27 22 0a 65 6c 73 | 65 0a 63 61 74 20 3c 3c |.c'".els|e.cat <<|
|00003770| 20 5c 53 48 41 52 5f 45 | 4f 46 20 3e 20 27 68 71 | \SHAR_E|OF > 'hq|
|00003780| 78 69 66 79 2e 63 27 0a | 23 69 6e 63 6c 75 64 65 |xify.c'.|#include|
|00003790| 20 22 6d 61 63 74 79 70 | 65 73 2e 68 22 0a 0a 23 | "mactyp|es.h"..#|
|000037a0| 64 65 66 69 6e 65 20 48 | 51 58 42 55 46 4c 45 4e |define H|QXBUFLEN|
|000037b0| 20 35 31 32 0a 62 79 74 | 65 20 68 71 78 62 75 66 | 512.byt|e hqxbuf|
|000037c0| 5b 48 51 58 42 55 46 4c | 45 4e 2b 31 5d 2c 20 2a |[HQXBUFL|EN+1], *|
|000037d0| 62 75 66 5f 70 74 72 2c | 20 2a 62 75 66 5f 65 6e |buf_ptr,| *buf_en|
|000037e0| 64 2c 20 2a 62 75 66 5f | 73 74 61 72 74 3d 68 71 |d, *buf_|start=hq|
|000037f0| 78 62 75 66 2b 31 3b 0a | 0a 23 64 65 66 69 6e 65 |xbuf+1;.|.#define|
|00003800| 20 4d 41 58 4c 49 4e 45 | 20 32 35 35 0a 62 79 74 | MAXLINE| 255.byt|
|00003810| 65 20 6c 69 6e 65 5b 4d | 41 58 4c 49 4e 45 2b 31 |e line[M|AXLINE+1|
|00003820| 5d 2c 20 2a 6c 69 6e 65 | 5f 70 74 72 2c 20 2a 6c |], *line|_ptr, *l|
|00003830| 69 6e 65 5f 65 6e 64 2c | 20 2a 6c 69 6e 65 5f 73 |ine_end,| *line_s|
|00003840| 74 61 72 74 3d 6c 69 6e | 65 2b 31 3b 0a 0a 69 6e |tart=lin|e+1;..in|
|00003850| 74 20 6c 69 6e 65 5f 63 | 6f 75 6e 74 2c 20 66 69 |t line_c|ount, fi|
|00003860| 6c 65 5f 63 6f 75 6e 74 | 3b 0a 69 6e 74 20 73 61 |le_count|;.int sa|
|00003870| 76 65 5f 73 74 61 74 65 | 2c 20 74 6f 74 61 6c 5f |ve_state|, total_|
|00003880| 62 79 74 65 73 2c 20 73 | 61 76 65 5f 72 75 6e 5f |bytes, s|ave_run_|
|00003890| 6c 65 6e 67 74 68 3b 0a | 77 6f 72 64 20 73 61 76 |length;.|word sav|
|000038a0| 65 5f 6e 69 62 62 6c 65 | 3b 0a 63 68 61 72 20 62 |e_nibble|;.char b|
|000038b0| 69 6e 66 6e 61 6d 65 5b | 42 49 4e 4e 41 4d 45 4c |infname[|BINNAMEL|
|000038c0| 45 4e 5d 2c 20 68 71 78 | 66 6e 61 6d 65 5b 42 49 |EN], hqx|fname[BI|
|000038d0| 4e 4e 41 4d 45 4c 45 4e | 5d 3b 0a 46 49 4c 45 20 |NNAMELEN|];.FILE |
|000038e0| 2a 68 71 78 66 69 6c 65 | 2c 20 2a 62 69 6e 66 69 |*hqxfile|, *binfi|
|000038f0| 6c 65 3b 0a 0a 2f 2a 20 | 54 68 69 73 20 72 6f 75 |le;../* |This rou|
|00003900| 74 69 6e 65 20 72 65 61 | 64 73 20 74 68 65 20 68 |tine rea|ds the h|
|00003910| 65 61 64 65 72 20 6f 66 | 20 61 20 68 71 78 65 64 |eader of| a hqxed|
|00003920| 20 66 69 6c 65 20 61 6e | 64 20 61 70 70 72 6f 70 | file an|d approp|
|00003930| 72 69 61 74 65 6c 79 20 | 74 77 69 64 64 6c 65 73 |riately |twiddles|
|00003940| 20 69 74 2c 0a 20 20 20 | 20 64 65 74 65 72 6d 69 | it,. | determi|
|00003950| 6e 65 73 20 69 66 20 69 | 74 20 68 61 73 20 43 52 |nes if i|t has CR|
|00003960| 43 20 70 72 6f 62 6c 65 | 6d 73 2c 20 63 72 65 61 |C proble|ms, crea|
|00003970| 74 65 73 20 74 68 65 20 | 2e 62 69 6e 20 66 69 6c |tes the |.bin fil|
|00003980| 65 2c 20 61 6e 64 20 70 | 75 74 73 20 74 68 65 20 |e, and p|uts the |
|00003990| 69 6e 66 6f 0a 20 20 20 | 20 69 6e 74 6f 20 74 68 |info. | into th|
|000039a0| 65 20 2e 62 69 6e 20 66 | 69 6c 65 2e 0a 20 20 20 |e .bin f|ile.. |
|000039b0| 20 4f 75 74 70 75 74 20 | 69 73 20 68 71 78 5f 64 | Output |is hqx_d|
|000039c0| 61 74 61 6c 65 6e 2c 20 | 68 71 78 5f 72 73 72 63 |atalen, |hqx_rsrc|
|000039d0| 6c 65 6e 2c 20 74 79 70 | 65 2c 20 62 69 6e 66 6e |len, typ|e, binfn|
|000039e0| 61 6d 65 2c 20 62 69 6e | 66 69 6c 65 20 2a 2f 0a |ame, bin|file */.|
|000039f0| 0a 68 71 78 5f 74 6f 5f | 62 69 6e 5f 68 64 72 28 |.hqx_to_|bin_hdr(|
|00003a00| 74 79 70 65 2c 20 68 71 | 78 5f 64 61 74 61 6c 65 |type, hq|x_datale|
|00003a10| 6e 2c 20 68 71 78 5f 72 | 73 72 63 6c 65 6e 29 0a |n, hqx_r|srclen).|
|00003a20| 63 68 61 72 20 2a 74 79 | 70 65 3b 0a 75 6c 6f 6e |char *ty|pe;.ulon|
|00003a30| 67 20 2a 68 71 78 5f 64 | 61 74 61 6c 65 6e 2c 20 |g *hqx_d|atalen, |
|00003a40| 2a 68 71 78 5f 72 73 72 | 63 6c 65 6e 3b 0a 7b 20 |*hqx_rsr|clen;.{ |
|00003a50| 20 20 72 65 67 69 73 74 | 65 72 20 62 79 74 65 20 | regist|er byte |
|00003a60| 2a 68 71 78 5f 70 74 72 | 2c 20 2a 68 71 78 5f 65 |*hqx_ptr|, *hqx_e|
|00003a70| 6e 64 3b 0a 20 20 20 20 | 72 65 67 69 73 74 65 72 |nd;. |register|
|00003a80| 20 75 6c 6f 6e 67 20 63 | 61 6c 63 5f 63 72 63 3b | ulong c|alc_crc;|
|00003a90| 0a 20 20 20 20 68 71 78 | 5f 62 75 66 20 2a 68 71 |. hqx|_buf *hq|
|00003aa0| 78 5f 62 6c 6f 63 6b 3b | 0a 20 20 20 20 68 71 78 |x_block;|. hqx|
|00003ab0| 5f 68 65 61 64 65 72 20 | 2a 68 71 78 3b 0a 20 20 |_header |*hqx;. |
|00003ac0| 20 20 69 6e 66 6f 5f 68 | 65 61 64 65 72 20 69 6e | info_h|eader in|
|00003ad0| 66 6f 3b 0a 20 20 20 20 | 75 6c 6f 6e 67 20 6d 74 |fo;. |ulong mt|
|00003ae0| 69 6d 3b 0a 20 20 20 20 | 73 68 6f 72 74 20 63 72 |im;. |short cr|
|00003af0| 63 3b 0a 0a 20 20 20 20 | 65 78 74 65 72 6e 20 77 |c;.. |extern w|
|00003b00| 6f 72 64 20 6d 61 67 69 | 63 5b 5d 3b 0a 20 20 20 |ord magi|c[];. |
|00003b10| 20 65 78 74 65 72 6e 20 | 46 49 4c 45 20 2a 76 65 | extern |FILE *ve|
|00003b20| 72 62 6f 73 65 3b 0a 20 | 20 20 20 65 78 74 65 72 |rbose;. | exter|
|00003b30| 6e 20 63 68 61 72 20 2a | 64 69 72 2c 20 2a 65 78 |n char *|dir, *ex|
|00003b40| 74 3b 0a 20 20 20 20 65 | 78 74 65 72 6e 20 73 68 |t;. e|xtern sh|
|00003b50| 6f 72 74 20 63 61 6c 63 | 5f 6d 62 5f 63 72 63 28 |ort calc|_mb_crc(|
|00003b60| 29 3b 0a 0a 20 20 20 20 | 2f 2a 20 72 65 61 64 20 |);.. |/* read |
|00003b70| 74 68 65 20 68 71 78 20 | 68 65 61 64 65 72 2c 20 |the hqx |header, |
|00003b80| 61 73 73 75 6d 69 6e 67 | 20 74 68 61 74 20 49 20 |assuming| that I |
|00003b90| 77 6f 6e 27 74 20 65 78 | 68 61 75 73 74 20 68 71 |won't ex|haust hq|
|00003ba0| 78 62 75 66 20 69 6e 20 | 73 6f 20 64 6f 69 6e 67 |xbuf in |so doing|
|00003bb0| 20 2a 2f 0a 20 20 20 20 | 66 69 6c 6c 5f 68 71 78 | */. |fill_hqx|
|00003bc0| 62 75 66 28 29 3b 0a 20 | 20 20 20 68 71 78 5f 62 |buf();. | hqx_b|
|00003bd0| 6c 6f 63 6b 20 3d 20 28 | 68 71 78 5f 62 75 66 20 |lock = (|hqx_buf |
|00003be0| 2a 29 20 62 75 66 5f 70 | 74 72 3b 0a 20 20 20 20 |*) buf_p|tr;. |
|00003bf0| 68 71 78 20 3d 20 28 68 | 71 78 5f 68 65 61 64 65 |hqx = (h|qx_heade|
|00003c00| 72 20 2a 29 20 28 68 71 | 78 5f 62 6c 6f 63 6b 2d |r *) (hq|x_block-|
|00003c10| 3e 6e 61 6d 65 20 2b 20 | 68 71 78 5f 62 6c 6f 63 |>name + |hqx_bloc|
|00003c20| 6b 2d 3e 6e 6c 65 6e 29 | 3b 0a 20 20 20 20 68 71 |k->nlen)|;. hq|
|00003c30| 78 5f 70 74 72 20 3d 20 | 62 75 66 5f 70 74 72 3b |x_ptr = |buf_ptr;|
|00003c40| 0a 20 20 20 20 68 71 78 | 5f 65 6e 64 20 3d 20 28 |. hqx|_end = (|
|00003c50| 62 79 74 65 20 2a 29 20 | 68 71 78 20 2b 20 73 69 |byte *) |hqx + si|
|00003c60| 7a 65 6f 66 28 68 71 78 | 5f 68 65 61 64 65 72 29 |zeof(hqx|_header)|
|00003c70| 20 2d 20 31 3b 0a 20 20 | 20 20 63 61 6c 63 5f 63 | - 1;. | calc_c|
|00003c80| 72 63 20 3d 20 30 3b 0a | 20 20 20 20 77 68 69 6c |rc = 0;.| whil|
|00003c90| 65 20 28 68 71 78 5f 70 | 74 72 20 3c 20 68 71 78 |e (hqx_p|tr < hqx|
|00003ca0| 5f 65 6e 64 29 0a 20 20 | 20 20 20 20 20 20 63 61 |_end). | ca|
|00003cb0| 6c 63 5f 63 72 63 20 3d | 20 28 28 28 63 61 6c 63 |lc_crc =| (((calc|
|00003cc0| 5f 63 72 63 26 30 78 66 | 66 29 20 3c 3c 20 38 29 |_crc&0xf|f) << 8)|
|00003cd0| 20 7c 20 2a 68 71 78 5f | 70 74 72 2b 2b 29 20 5e | | *hqx_|ptr++) ^|
|00003ce0| 20 6d 61 67 69 63 5b 63 | 61 6c 63 5f 63 72 63 20 | magic[c|alc_crc |
|00003cf0| 3e 3e 20 38 5d 3b 0a 20 | 20 20 20 63 61 6c 63 5f |>> 8];. | calc_|
|00003d00| 63 72 63 20 3d 20 28 28 | 63 61 6c 63 5f 63 72 63 |crc = ((|calc_crc|
|00003d10| 26 30 78 66 66 29 20 3c | 3c 20 38 29 20 5e 20 6d |&0xff) <|< 8) ^ m|
|00003d20| 61 67 69 63 5b 63 61 6c | 63 5f 63 72 63 20 3e 3e |agic[cal|c_crc >>|
|00003d30| 20 38 5d 3b 0a 20 20 20 | 20 63 61 6c 63 5f 63 72 | 8];. | calc_cr|
|00003d40| 63 20 3d 20 28 28 63 61 | 6c 63 5f 63 72 63 26 30 |c = ((ca|lc_crc&0|
|00003d50| 78 66 66 29 20 3c 3c 20 | 38 29 20 5e 20 6d 61 67 |xff) << |8) ^ mag|
|00003d60| 69 63 5b 63 61 6c 63 5f | 63 72 63 20 3e 3e 20 38 |ic[calc_|crc >> 8|
|00003d70| 5d 3b 0a 20 20 20 20 62 | 75 66 5f 70 74 72 20 3d |];. b|uf_ptr =|
|00003d80| 20 68 71 78 5f 70 74 72 | 3b 0a 0a 20 20 20 20 2f | hqx_ptr|;.. /|
|00003d90| 2a 20 73 74 75 66 66 20 | 74 68 65 20 68 71 78 20 |* stuff |the hqx |
|00003da0| 68 65 61 64 65 72 20 64 | 61 74 61 20 69 6e 74 6f |header d|ata into|
|00003db0| 20 74 68 65 20 69 6e 66 | 6f 20 68 65 61 64 65 72 | the inf|o header|
|00003dc0| 20 2a 2f 0a 20 20 20 20 | 62 7a 65 72 6f 28 26 69 | */. |bzero(&i|
|00003dd0| 6e 66 6f 2c 20 73 69 7a | 65 6f 66 28 69 6e 66 6f |nfo, siz|eof(info|
|00003de0| 5f 68 65 61 64 65 72 29 | 29 3b 0a 20 20 20 20 69 |_header)|);. i|
|00003df0| 6e 66 6f 2e 6e 6c 65 6e | 20 3d 20 68 71 78 5f 62 |nfo.nlen| = hqx_b|
|00003e00| 6c 6f 63 6b 2d 3e 6e 6c | 65 6e 3b 0a 20 20 20 20 |lock->nl|en;. |
|00003e10| 73 74 72 6e 63 70 79 28 | 69 6e 66 6f 2e 6e 61 6d |strncpy(|info.nam|
|00003e20| 65 2c 20 68 71 78 5f 62 | 6c 6f 63 6b 2d 3e 6e 61 |e, hqx_b|lock->na|
|00003e30| 6d 65 2c 20 69 6e 66 6f | 2e 6e 6c 65 6e 29 3b 20 |me, info|.nlen); |
|00003e40| 20 20 20 20 2f 2a 20 6e | 61 6d 65 20 2a 2f 0a 20 | /* n|ame */. |
|00003e50| 20 20 20 62 63 6f 70 79 | 28 68 71 78 2d 3e 74 79 | bcopy|(hqx->ty|
|00003e60| 70 65 2c 20 69 6e 66 6f | 2e 74 79 70 65 2c 20 39 |pe, info|.type, 9|
|00003e70| 29 3b 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f |); | /|
|00003e80| 2a 20 74 79 70 65 2c 20 | 61 75 74 68 6f 72 2c 20 |* type, |author, |
|00003e90| 66 6c 61 67 20 2a 2f 0a | 20 20 20 20 69 6e 66 6f |flag */.| info|
|00003ea0| 2e 66 6c 61 67 73 20 20 | 26 3d 20 30 78 37 65 3b |.flags |&= 0x7e;|
|00003eb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003ec0| 20 20 20 20 20 20 20 20 | 2f 2a 20 72 65 73 65 74 | |/* reset|
|00003ed0| 20 6c 6f 63 6b 20 62 69 | 74 2c 20 69 6e 69 74 20 | lock bi|t, init |
|00003ee0| 62 69 74 20 2a 2f 0a 20 | 20 20 20 69 66 20 28 68 |bit */. | if (h|
|00003ef0| 71 78 2d 3e 70 72 6f 74 | 65 63 74 20 26 20 30 78 |qx->prot|ect & 0x|
|00003f00| 34 30 29 20 69 6e 66 6f | 2e 70 72 6f 74 65 63 74 |40) info|.protect|
|00003f10| 20 3d 20 31 3b 20 20 2f | 2a 20 63 6f 70 79 20 70 | = 1; /|* copy p|
|00003f20| 72 6f 74 65 63 74 20 62 | 69 74 20 2a 2f 0a 20 20 |rotect b|it */. |
|00003f30| 20 20 62 63 6f 70 79 28 | 68 71 78 2d 3e 64 6c 65 | bcopy(|hqx->dle|
|00003f40| 6e 2c 20 69 6e 66 6f 2e | 64 6c 65 6e 2c 20 38 29 |n, info.|dlen, 8)|
|00003f50| 3b 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2a |; | /*|
|00003f60| 20 64 6c 65 6e 2c 20 72 | 6c 65 6e 20 2a 2f 0a 20 | dlen, r|len */. |
|00003f70| 20 20 20 6d 74 69 6d 20 | 3d 20 74 69 6d 65 32 6d | mtim |= time2m|
|00003f80| 61 63 28 74 69 6d 65 28 | 30 29 29 3b 0a 20 20 20 |ac(time(|0));. |
|00003f90| 20 62 63 6f 70 79 28 26 | 6d 74 69 6d 2c 20 69 6e | bcopy(&|mtim, in|
|00003fa0| 66 6f 2e 6d 74 69 6d 2c | 20 34 29 3b 0a 20 20 20 |fo.mtim,| 4);. |
|00003fb0| 20 62 63 6f 70 79 28 26 | 6d 74 69 6d 2c 20 69 6e | bcopy(&|mtim, in|
|00003fc0| 66 6f 2e 63 74 69 6d 2c | 20 34 29 3b 0a 20 20 20 |fo.ctim,| 4);. |
|00003fd0| 20 69 6e 66 6f 2e 75 70 | 6c 6f 61 64 76 65 72 73 | info.up|loadvers|
|00003fe0| 20 3d 20 27 5c 32 30 31 | 27 3b 0a 20 20 20 20 69 | = '\201|';. i|
|00003ff0| 6e 66 6f 2e 72 65 61 64 | 76 65 72 73 20 3d 20 27 |nfo.read|vers = '|
|00004000| 5c 32 30 31 27 3b 0a 0a | 20 20 20 20 2f 2a 20 63 |\201';..| /* c|
|00004010| 61 6c 63 75 6c 61 74 65 | 20 4d 61 63 42 69 6e 61 |alculate| MacBina|
|00004020| 72 79 20 43 52 43 20 2a | 2f 0a 20 20 20 20 63 72 |ry CRC *|/. cr|
|00004030| 63 20 3d 20 63 61 6c 63 | 5f 6d 62 5f 63 72 63 28 |c = calc|_mb_crc(|
|00004040| 26 69 6e 66 6f 2c 20 31 | 32 34 2c 20 30 29 3b 0a |&info, 1|24, 0);.|
|00004050| 20 20 20 20 69 6e 66 6f | 2e 63 72 63 5b 30 5d 20 | info|.crc[0] |
|00004060| 3d 20 28 63 68 61 72 29 | 20 28 63 72 63 20 3e 3e |= (char)| (crc >>|
|00004070| 20 38 29 3b 0a 20 20 20 | 20 69 6e 66 6f 2e 63 72 | 8);. | info.cr|
|00004080| 63 5b 31 5d 20 3d 20 28 | 63 68 61 72 29 20 63 72 |c[1] = (|char) cr|
|00004090| 63 3b 0a 0a 20 20 20 20 | 2f 2a 20 43 72 65 61 74 |c;.. |/* Creat|
|000040a0| 65 20 74 68 65 20 2e 62 | 69 6e 20 66 69 6c 65 20 |e the .b|in file |
|000040b0| 61 6e 64 20 77 72 69 74 | 65 20 74 68 65 20 69 6e |and writ|e the in|
|000040c0| 66 6f 20 74 6f 20 69 74 | 20 2a 2f 0a 20 20 20 20 |fo to it| */. |
|000040d0| 75 6e 69 78 69 66 79 28 | 68 71 78 5f 62 6c 6f 63 |unixify(|hqx_bloc|
|000040e0| 6b 2d 3e 6e 61 6d 65 29 | 3b 0a 20 20 20 20 73 70 |k->name)|;. sp|
|000040f0| 72 69 6e 74 66 28 62 69 | 6e 66 6e 61 6d 65 2c 20 |rintf(bi|nfname, |
|00004100| 22 25 73 2f 25 73 25 73 | 22 2c 20 64 69 72 2c 20 |"%s/%s%s|", dir, |
|00004110| 68 71 78 5f 62 6c 6f 63 | 6b 2d 3e 6e 61 6d 65 2c |hqx_bloc|k->name,|
|00004120| 20 65 78 74 29 3b 0a 20 | 20 20 20 66 70 72 69 6e | ext);. | fprin|
|00004130| 74 66 28 76 65 72 62 6f | 73 65 2c 0a 20 20 20 20 |tf(verbo|se,. |
|00004140| 20 20 20 20 22 43 6f 6e | 76 65 72 74 69 6e 67 20 | "Con|verting |
|00004150| 20 20 20 20 25 2d 33 30 | 73 20 74 79 70 65 20 3d | %-30|s type =|
|00004160| 20 5c 22 25 34 2e 34 73 | 5c 22 2c 20 61 75 74 68 | \"%4.4s|\", auth|
|00004170| 6f 72 20 3d 20 5c 22 25 | 34 2e 34 73 5c 22 5c 6e |or = \"%|4.4s\"\n|
|00004180| 22 2c 0a 20 20 20 20 20 | 20 20 20 68 71 78 5f 62 |",. | hqx_b|
|00004190| 6c 6f 63 6b 2d 3e 6e 61 | 6d 65 2c 20 69 6e 66 6f |lock->na|me, info|
|000041a0| 2e 74 79 70 65 2c 20 69 | 6e 66 6f 2e 61 75 74 68 |.type, i|nfo.auth|
|000041b0| 29 3b 0a 20 20 20 20 69 | 66 20 28 28 62 69 6e 66 |);. i|f ((binf|
|000041c0| 69 6c 65 20 3d 20 66 6f | 70 65 6e 28 62 69 6e 66 |ile = fo|pen(binf|
|000041d0| 6e 61 6d 65 2c 20 22 77 | 22 29 29 20 3d 3d 20 4e |name, "w|")) == N|
|000041e0| 55 4c 4c 29 0a 20 20 20 | 20 20 20 20 20 65 72 72 |ULL). | err|
|000041f0| 6f 72 28 22 43 61 6e 6e | 6f 74 20 6f 70 65 6e 20 |or("Cann|ot open |
|00004200| 25 73 22 2c 20 62 69 6e | 66 6e 61 6d 65 29 3b 0a |%s", bin|fname);.|
|00004210| 20 20 20 20 63 68 65 63 | 6b 5f 68 71 78 5f 63 72 | chec|k_hqx_cr|
|00004220| 63 28 63 61 6c 63 5f 63 | 72 63 2c 20 22 46 69 6c |c(calc_c|rc, "Fil|
|00004230| 65 20 68 65 61 64 65 72 | 20 43 52 43 20 6d 69 73 |e header| CRC mis|
|00004240| 6d 61 74 63 68 20 69 6e | 20 25 73 22 2c 20 62 69 |match in| %s", bi|
|00004250| 6e 66 6e 61 6d 65 29 3b | 0a 20 20 20 20 66 77 72 |nfname);|. fwr|
|00004260| 69 74 65 28 26 69 6e 66 | 6f 2c 20 73 69 7a 65 6f |ite(&inf|o, sizeo|
|00004270| 66 28 69 6e 66 6f 29 2c | 20 31 2c 20 62 69 6e 66 |f(info),| 1, binf|
|00004280| 69 6c 65 29 3b 0a 0a 20 | 20 20 20 2f 2a 20 47 65 |ile);.. | /* Ge|
|00004290| 74 20 61 20 63 6f 75 70 | 6c 65 20 6f 66 20 69 74 |t a coup|le of it|
|000042a0| 65 6d 73 20 77 65 27 6c | 6c 20 6e 65 65 64 20 6c |ems we'l|l need l|
|000042b0| 61 74 65 72 20 2a 2f 0a | 20 20 20 20 62 63 6f 70 |ater */.| bcop|
|000042c0| 79 28 69 6e 66 6f 2e 64 | 6c 65 6e 2c 20 68 71 78 |y(info.d|len, hqx|
|000042d0| 5f 64 61 74 61 6c 65 6e | 2c 20 34 29 3b 0a 20 20 |_datalen|, 4);. |
|000042e0| 20 20 2a 68 71 78 5f 64 | 61 74 61 6c 65 6e 20 3d | *hqx_d|atalen =|
|000042f0| 20 6d 61 63 32 6c 6f 6e | 67 28 2a 68 71 78 5f 64 | mac2lon|g(*hqx_d|
|00004300| 61 74 61 6c 65 6e 29 3b | 0a 20 20 20 20 62 63 6f |atalen);|. bco|
|00004310| 70 79 28 69 6e 66 6f 2e | 72 6c 65 6e 2c 20 68 71 |py(info.|rlen, hq|
|00004320| 78 5f 72 73 72 63 6c 65 | 6e 2c 20 34 29 3b 0a 20 |x_rsrcle|n, 4);. |
|00004330| 20 20 20 2a 68 71 78 5f | 72 73 72 63 6c 65 6e 20 | *hqx_|rsrclen |
|00004340| 3d 20 6d 61 63 32 6c 6f | 6e 67 28 2a 68 71 78 5f |= mac2lo|ng(*hqx_|
|00004350| 72 73 72 63 6c 65 6e 29 | 3b 0a 20 20 20 20 62 63 |rsrclen)|;. bc|
|00004360| 6f 70 79 28 69 6e 66 6f | 2e 74 79 70 65 2c 20 74 |opy(info|.type, t|
|00004370| 79 70 65 2c 20 34 29 3b | 0a 20 20 20 20 7d 0a 0a |ype, 4);|. }..|
|00004380| 2f 2a 20 54 68 69 73 20 | 72 6f 75 74 69 6e 65 20 |/* This |routine |
|00004390| 72 65 61 64 73 20 74 68 | 65 20 68 65 61 64 65 72 |reads th|e header|
|000043a0| 20 6f 66 20 61 20 62 69 | 6e 20 66 69 6c 65 20 61 | of a bi|n file a|
|000043b0| 6e 64 20 61 70 70 72 6f | 70 72 69 61 74 65 6c 79 |nd appro|priately|
|000043c0| 20 74 77 69 64 64 6c 65 | 73 20 69 74 2c 0a 20 20 | twiddle|s it,. |
|000043d0| 20 20 63 72 65 61 74 65 | 73 20 74 68 65 20 2e 68 | create|s the .h|
|000043e0| 71 78 20 66 69 6c 65 2c | 20 61 6e 64 20 70 75 74 |qx file,| and put|
|000043f0| 73 20 74 68 65 20 69 6e | 66 6f 20 69 6e 74 6f 20 |s the in|fo into |
|00004400| 74 68 65 20 2e 68 71 78 | 20 66 69 6c 65 2e 0a 20 |the .hqx| file.. |
|00004410| 20 20 20 4f 75 74 70 75 | 74 20 69 73 20 68 71 78 | Outpu|t is hqx|
|00004420| 5f 64 61 74 61 6c 65 6e | 2c 20 68 71 78 5f 72 73 |_datalen|, hqx_rs|
|00004430| 72 63 6c 65 6e 2c 20 74 | 79 70 65 2c 20 68 71 78 |rclen, t|ype, hqx|
|00004440| 66 6e 61 6d 65 2c 20 68 | 71 78 66 69 6c 65 20 2a |fname, h|qxfile *|
|00004450| 2f 0a 0a 62 69 6e 5f 74 | 6f 5f 68 71 78 5f 68 64 |/..bin_t|o_hqx_hd|
|00004460| 72 28 68 71 78 5f 64 61 | 74 61 6c 65 6e 2c 20 68 |r(hqx_da|talen, h|
|00004470| 71 78 5f 72 73 72 63 6c | 65 6e 29 0a 75 6c 6f 6e |qx_rsrcl|en).ulon|
|00004480| 67 20 2a 68 71 78 5f 64 | 61 74 61 6c 65 6e 2c 20 |g *hqx_d|atalen, |
|00004490| 2a 68 71 78 5f 72 73 72 | 63 6c 65 6e 3b 0a 7b 20 |*hqx_rsr|clen;.{ |
|000044a0| 20 20 72 65 67 69 73 74 | 65 72 20 62 79 74 65 20 | regist|er byte |
|000044b0| 2a 68 71 78 5f 70 74 72 | 2c 20 2a 68 71 78 5f 65 |*hqx_ptr|, *hqx_e|
|000044c0| 6e 64 3b 0a 20 20 20 20 | 72 65 67 69 73 74 65 72 |nd;. |register|
|000044d0| 20 75 6c 6f 6e 67 20 63 | 61 6c 63 5f 63 72 63 3b | ulong c|alc_crc;|
|000044e0| 0a 20 20 20 20 68 71 78 | 5f 62 75 66 20 2a 68 71 |. hqx|_buf *hq|
|000044f0| 78 5f 62 6c 6f 63 6b 3b | 0a 20 20 20 20 68 71 78 |x_block;|. hqx|
|00004500| 5f 68 65 61 64 65 72 20 | 2a 68 71 78 3b 0a 20 20 |_header |*hqx;. |
|00004510| 20 20 69 6e 66 6f 5f 68 | 65 61 64 65 72 20 69 6e | info_h|eader in|
|00004520| 66 6f 3b 0a 20 20 20 20 | 65 78 74 65 72 6e 20 77 |fo;. |extern w|
|00004530| 6f 72 64 20 6d 61 67 69 | 63 5b 5d 3b 0a 20 20 20 |ord magi|c[];. |
|00004540| 20 65 78 74 65 72 6e 20 | 46 49 4c 45 20 2a 76 65 | extern |FILE *ve|
|00004550| 72 62 6f 73 65 3b 0a 20 | 20 20 20 65 78 74 65 72 |rbose;. | exter|
|00004560| 6e 20 63 68 61 72 20 2a | 2a 68 71 78 6e 61 6d 65 |n char *|*hqxname|
|00004570| 73 5f 6c 65 66 74 3b 0a | 20 20 20 20 65 78 74 65 |s_left;.| exte|
|00004580| 72 6e 20 63 68 61 72 20 | 2a 65 78 74 3b 0a 0a 20 |rn char |*ext;.. |
|00004590| 20 20 20 73 74 72 63 70 | 79 28 62 69 6e 66 6e 61 | strcp|y(binfna|
|000045a0| 6d 65 2c 20 2a 68 71 78 | 6e 61 6d 65 73 5f 6c 65 |me, *hqx|names_le|
|000045b0| 66 74 2b 2b 29 3b 0a 20 | 20 20 20 69 66 20 28 21 |ft++);. | if (!|
|000045c0| 28 62 69 6e 66 69 6c 65 | 20 3d 20 66 6f 70 65 6e |(binfile| = fopen|
|000045d0| 28 62 69 6e 66 6e 61 6d | 65 2c 20 22 72 22 29 29 |(binfnam|e, "r"))|
|000045e0| 29 20 7b 0a 20 20 20 20 | 20 20 20 20 2f 2a 20 4d |) {. | /* M|
|000045f0| 61 79 62 65 20 77 65 20 | 61 72 65 20 73 75 70 70 |aybe we |are supp|
|00004600| 6f 73 65 64 20 74 6f 20 | 66 69 67 75 72 65 20 6f |osed to |figure o|
|00004610| 75 74 20 74 68 65 20 73 | 75 66 66 69 78 20 6f 75 |ut the s|uffix ou|
|00004620| 72 73 65 6c 76 65 73 3f | 20 2a 2f 0a 20 20 20 20 |rselves?| */. |
|00004630| 20 20 20 20 73 74 72 63 | 61 74 28 62 69 6e 66 6e | strc|at(binfn|
|00004640| 61 6d 65 2c 20 65 78 74 | 29 3b 0a 20 20 20 20 20 |ame, ext|);. |
|00004650| 20 20 20 69 66 20 28 21 | 28 62 69 6e 66 69 6c 65 | if (!|(binfile|
|00004660| 20 3d 20 66 6f 70 65 6e | 28 62 69 6e 66 6e 61 6d | = fopen|(binfnam|
|00004670| 65 2c 20 22 72 22 29 29 | 29 0a 20 20 20 20 20 20 |e, "r"))|). |
|00004680| 20 20 20 20 20 20 65 72 | 72 6f 72 28 22 43 61 6e | er|ror("Can|
|00004690| 6e 6f 74 20 6f 70 65 6e | 20 25 73 22 2c 20 62 69 |not open| %s", bi|
|000046a0| 6e 66 6e 61 6d 65 29 3b | 0a 20 20 20 20 20 20 20 |nfname);|. |
|000046b0| 20 7d 0a 20 20 20 20 69 | 66 20 28 21 66 72 65 61 | }. i|f (!frea|
|000046c0| 64 28 26 69 6e 66 6f 2c | 20 73 69 7a 65 6f 66 28 |d(&info,| sizeof(|
|000046d0| 69 6e 66 6f 29 2c 20 31 | 2c 20 62 69 6e 66 69 6c |info), 1|, binfil|
|000046e0| 65 29 29 0a 20 20 20 20 | 20 20 20 20 65 72 72 6f |e)). | erro|
|000046f0| 72 28 22 55 6e 65 78 70 | 65 63 74 65 64 20 45 4f |r("Unexp|ected EO|
|00004700| 46 20 69 6e 20 68 65 61 | 64 65 72 20 6f 66 20 25 |F in hea|der of %|
|00004710| 73 22 2c 20 62 69 6e 66 | 6e 61 6d 65 29 3b 0a 0a |s", binf|name);..|
|00004720| 20 20 20 20 2f 2a 20 73 | 74 75 66 66 20 74 68 65 | /* s|tuff the|
|00004730| 20 69 6e 66 6f 20 68 65 | 61 64 65 72 20 69 6e 74 | info he|ader int|
|00004740| 6f 20 74 68 65 20 68 71 | 78 20 68 65 61 64 65 72 |o the hq|x header|
|00004750| 20 2a 2f 0a 20 20 20 20 | 68 71 78 5f 62 6c 6f 63 | */. |hqx_bloc|
|00004760| 6b 20 3d 20 28 68 71 78 | 5f 62 75 66 20 2a 29 20 |k = (hqx|_buf *) |
|00004770| 62 75 66 5f 70 74 72 3b | 0a 20 20 20 20 68 71 78 |buf_ptr;|. hqx|
|00004780| 5f 62 6c 6f 63 6b 2d 3e | 6e 6c 65 6e 20 3d 20 69 |_block->|nlen = i|
|00004790| 6e 66 6f 2e 6e 6c 65 6e | 3b 0a 20 20 20 20 73 74 |nfo.nlen|;. st|
|000047a0| 72 6e 63 70 79 28 68 71 | 78 5f 62 6c 6f 63 6b 2d |rncpy(hq|x_block-|
|000047b0| 3e 6e 61 6d 65 2c 20 69 | 6e 66 6f 2e 6e 61 6d 65 |>name, i|nfo.name|
|000047c0| 2c 20 69 6e 66 6f 2e 6e | 6c 65 6e 29 3b 0a 20 20 |, info.n|len);. |
|000047d0| 20 20 68 71 78 20 3d 20 | 28 68 71 78 5f 68 65 61 | hqx = |(hqx_hea|
|000047e0| 64 65 72 20 2a 29 20 28 | 68 71 78 5f 62 6c 6f 63 |der *) (|hqx_bloc|
|000047f0| 6b 2d 3e 6e 61 6d 65 20 | 2b 20 68 71 78 5f 62 6c |k->name |+ hqx_bl|
|00004800| 6f 63 6b 2d 3e 6e 6c 65 | 6e 29 3b 0a 20 20 20 20 |ock->nle|n);. |
|00004810| 68 71 78 2d 3e 76 65 72 | 73 69 6f 6e 20 20 3d 20 |hqx->ver|sion = |
|00004820| 30 3b 0a 20 20 20 20 62 | 63 6f 70 79 28 69 6e 66 |0;. b|copy(inf|
|00004830| 6f 2e 74 79 70 65 2c 20 | 68 71 78 2d 3e 74 79 70 |o.type, |hqx->typ|
|00004840| 65 2c 20 39 29 3b 20 20 | 20 20 20 20 20 20 20 20 |e, 9); | |
|00004850| 20 20 20 2f 2a 20 74 79 | 70 65 2c 20 61 75 74 68 | /* ty|pe, auth|
|00004860| 6f 72 2c 20 66 6c 61 67 | 73 20 2a 2f 0a 20 20 20 |or, flag|s */. |
|00004870| 20 69 66 20 28 69 6e 66 | 6f 2e 70 72 6f 74 65 63 | if (inf|o.protec|
|00004880| 74 20 3d 20 31 29 20 68 | 71 78 2d 3e 70 72 6f 74 |t = 1) h|qx->prot|
|00004890| 65 63 74 20 3d 20 30 3b | 20 20 20 20 20 2f 2a 20 |ect = 0;| /* |
|000048a0| 70 72 6f 74 65 63 74 20 | 62 69 74 3a 20 30 78 34 |protect |bit: 0x4|
|000048b0| 30 20 2a 2f 0a 20 20 20 | 20 65 6c 73 65 20 68 71 |0 */. | else hq|
|000048c0| 78 2d 3e 70 72 6f 74 65 | 63 74 20 3d 20 30 3b 0a |x->prote|ct = 0;.|
|000048d0| 20 20 20 20 62 63 6f 70 | 79 28 69 6e 66 6f 2e 64 | bcop|y(info.d|
|000048e0| 6c 65 6e 2c 20 68 71 78 | 2d 3e 64 6c 65 6e 2c 20 |len, hqx|->dlen, |
|000048f0| 38 29 3b 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |8); | |
|00004900| 2f 2a 20 64 6c 65 6e 2c | 20 72 6c 65 6e 20 2a 2f |/* dlen,| rlen */|
|00004910| 0a 0a 20 20 20 20 2f 2a | 20 43 72 65 61 74 65 20 |.. /*| Create |
|00004920| 74 68 65 20 2e 68 71 78 | 20 66 69 6c 65 20 61 6e |the .hqx| file an|
|00004930| 64 20 77 72 69 74 65 20 | 74 68 65 20 69 6e 66 6f |d write |the info|
|00004940| 20 74 6f 20 69 74 20 2a | 2f 0a 20 20 20 20 73 74 | to it *|/. st|
|00004950| 72 6e 63 70 79 28 68 71 | 78 66 6e 61 6d 65 2c 20 |rncpy(hq|xfname, |
|00004960| 69 6e 66 6f 2e 6e 61 6d | 65 2c 20 69 6e 66 6f 2e |info.nam|e, info.|
|00004970| 6e 6c 65 6e 29 3b 0a 09 | 68 71 78 66 6e 61 6d 65 |nlen);..|hqxfname|
|00004980| 5b 69 6e 66 6f 2e 6e 6c | 65 6e 5d 20 3d 20 27 5c |[info.nl|en] = '\|
|00004990| 30 27 3b 0a 20 20 20 20 | 75 6e 69 78 69 66 79 28 |0';. |unixify(|
|000049a0| 68 71 78 66 6e 61 6d 65 | 29 3b 0a 20 20 20 20 66 |hqxfname|);. f|
|000049b0| 70 72 69 6e 74 66 28 76 | 65 72 62 6f 73 65 2c 0a |printf(v|erbose,.|
|000049c0| 20 20 20 20 20 20 20 20 | 22 43 6f 6e 76 65 72 74 | |"Convert|
|000049d0| 69 6e 67 20 20 20 20 20 | 25 2d 33 30 73 20 74 79 |ing |%-30s ty|
|000049e0| 70 65 20 3d 20 5c 22 25 | 34 2e 34 73 5c 22 2c 20 |pe = \"%|4.4s\", |
|000049f0| 61 75 74 68 6f 72 20 3d | 20 5c 22 25 34 2e 34 73 |author =| \"%4.4s|
|00004a00| 5c 22 5c 6e 22 2c 0a 20 | 20 20 20 20 20 20 20 68 |\"\n",. | h|
|00004a10| 71 78 66 6e 61 6d 65 2c | 20 69 6e 66 6f 2e 74 79 |qxfname,| info.ty|
|00004a20| 70 65 2c 20 69 6e 66 6f | 2e 61 75 74 68 29 3b 0a |pe, info|.auth);.|
|00004a30| 0a 20 20 20 20 63 61 6c | 63 5f 63 72 63 20 3d 20 |. cal|c_crc = |
|00004a40| 30 3b 0a 20 20 20 20 68 | 71 78 5f 70 74 72 20 3d |0;. h|qx_ptr =|
|00004a50| 20 28 62 79 74 65 20 2a | 29 20 68 71 78 5f 62 6c | (byte *|) hqx_bl|
|00004a60| 6f 63 6b 3b 0a 20 20 20 | 20 68 71 78 5f 65 6e 64 |ock;. | hqx_end|
|00004a70| 20 3d 20 68 71 78 5f 70 | 74 72 20 2b 20 68 71 78 | = hqx_p|tr + hqx|
|00004a80| 5f 62 6c 6f 63 6b 2d 3e | 6e 6c 65 6e 20 2b 20 73 |_block->|nlen + s|
|00004a90| 69 7a 65 6f 66 28 68 71 | 78 5f 68 65 61 64 65 72 |izeof(hq|x_header|
|00004aa0| 29 3b 0a 20 20 20 20 77 | 68 69 6c 65 20 28 68 71 |);. w|hile (hq|
|00004ab0| 78 5f 70 74 72 20 3c 20 | 68 71 78 5f 65 6e 64 29 |x_ptr < |hqx_end)|
|00004ac0| 0a 20 20 20 20 20 20 20 | 20 63 61 6c 63 5f 63 72 |. | calc_cr|
|00004ad0| 63 20 3d 20 28 28 28 63 | 61 6c 63 5f 63 72 63 26 |c = (((c|alc_crc&|
|00004ae0| 30 78 66 66 29 20 3c 3c | 20 38 29 20 7c 20 2a 68 |0xff) <<| 8) | *h|
|00004af0| 71 78 5f 70 74 72 2b 2b | 29 20 5e 20 6d 61 67 69 |qx_ptr++|) ^ magi|
|00004b00| 63 5b 63 61 6c 63 5f 63 | 72 63 20 3e 3e 20 38 5d |c[calc_c|rc >> 8]|
|00004b10| 3b 0a 20 20 20 20 63 61 | 6c 63 5f 63 72 63 20 3d |;. ca|lc_crc =|
|00004b20| 20 28 28 63 61 6c 63 5f | 63 72 63 26 30 78 66 66 | ((calc_|crc&0xff|
|00004b30| 29 20 3c 3c 20 38 29 20 | 5e 20 6d 61 67 69 63 5b |) << 8) |^ magic[|
|00004b40| 63 61 6c 63 5f 63 72 63 | 20 3e 3e 20 38 5d 3b 0a |calc_crc| >> 8];.|
|00004b50| 20 20 20 20 63 61 6c 63 | 5f 63 72 63 20 3d 20 28 | calc|_crc = (|
|00004b60| 28 63 61 6c 63 5f 63 72 | 63 26 30 78 66 66 29 20 |(calc_cr|c&0xff) |
|00004b70| 3c 3c 20 38 29 20 5e 20 | 6d 61 67 69 63 5b 63 61 |<< 8) ^ |magic[ca|
|00004b80| 6c 63 5f 63 72 63 20 3e | 3e 20 38 5d 3b 0a 20 20 |lc_crc >|> 8];. |
|00004b90| 20 20 62 75 66 5f 70 74 | 72 20 3d 20 68 71 78 5f | buf_pt|r = hqx_|
|00004ba0| 65 6e 64 3b 0a 20 20 20 | 20 77 72 69 74 65 5f 68 |end;. | write_h|
|00004bb0| 71 78 5f 63 72 63 28 63 | 61 6c 63 5f 63 72 63 29 |qx_crc(c|alc_crc)|
|00004bc0| 3b 0a 0a 20 20 20 20 2f | 2a 20 47 65 74 20 61 20 |;.. /|* Get a |
|00004bd0| 63 6f 75 70 6c 65 20 6f | 66 20 69 74 65 6d 73 20 |couple o|f items |
|00004be0| 77 65 27 6c 6c 20 6e 65 | 65 64 20 6c 61 74 65 72 |we'll ne|ed later|
|00004bf0| 20 2a 2f 0a 20 20 20 20 | 62 63 6f 70 79 28 69 6e | */. |bcopy(in|
|00004c00| 66 6f 2e 64 6c 65 6e 2c | 20 68 71 78 5f 64 61 74 |fo.dlen,| hqx_dat|
|00004c10| 61 6c 65 6e 2c 20 34 29 | 3b 0a 20 20 20 20 2a 68 |alen, 4)|;. *h|
|00004c20| 71 78 5f 64 61 74 61 6c | 65 6e 20 3d 20 6d 61 63 |qx_datal|en = mac|
|00004c30| 32 6c 6f 6e 67 28 2a 68 | 71 78 5f 64 61 74 61 6c |2long(*h|qx_datal|
|00004c40| 65 6e 29 3b 0a 20 20 20 | 20 62 63 6f 70 79 28 69 |en);. | bcopy(i|
|00004c50| 6e 66 6f 2e 72 6c 65 6e | 2c 20 68 71 78 5f 72 73 |nfo.rlen|, hqx_rs|
|00004c60| 72 63 6c 65 6e 2c 20 34 | 29 3b 0a 20 20 20 20 2a |rclen, 4|);. *|
|00004c70| 68 71 78 5f 72 73 72 63 | 6c 65 6e 20 3d 20 6d 61 |hqx_rsrc|len = ma|
|00004c80| 63 32 6c 6f 6e 67 28 2a | 68 71 78 5f 72 73 72 63 |c2long(*|hqx_rsrc|
|00004c90| 6c 65 6e 29 3b 0a 20 20 | 20 20 7d 0a 0a 0a 2f 2a |len);. | }.../*|
|00004ca0| 20 54 68 69 73 20 72 6f | 75 74 69 6e 65 20 63 6f | This ro|utine co|
|00004cb0| 70 69 65 73 20 62 79 74 | 65 73 20 66 72 6f 6d 20 |pies byt|es from |
|00004cc0| 74 68 65 20 64 65 63 6f | 64 65 64 20 69 6e 70 75 |the deco|ded inpu|
|00004cd0| 74 20 73 74 72 65 61 6d | 20 74 6f 20 74 68 65 20 |t stream| to the |
|00004ce0| 6f 75 74 70 75 74 2e 20 | 20 0a 20 20 20 20 49 74 |output. | . It|
|00004cf0| 20 61 6c 73 6f 20 70 61 | 64 73 20 74 6f 20 61 20 | also pa|ds to a |
|00004d00| 6d 75 6c 74 69 70 6c 65 | 20 6f 66 20 31 32 38 20 |multiple| of 128 |
|00004d10| 62 79 74 65 73 20 6f 6e | 20 74 68 65 20 6f 75 74 |bytes on| the out|
|00004d20| 70 75 74 2c 20 77 68 69 | 63 68 20 69 73 20 70 61 |put, whi|ch is pa|
|00004d30| 72 74 0a 20 20 20 20 6f | 66 20 74 68 65 20 2e 62 |rt. o|f the .b|
|00004d40| 69 6e 20 66 6f 72 6d 61 | 74 20 2a 2f 0a 77 6f 72 |in forma|t */.wor|
|00004d50| 64 20 68 71 78 5f 74 6f | 5f 62 69 6e 5f 66 6f 72 |d hqx_to|_bin_for|
|00004d60| 6b 28 6e 62 79 74 65 73 | 29 0a 72 65 67 69 73 74 |k(nbytes|).regist|
|00004d70| 65 72 20 75 6c 6f 6e 67 | 20 6e 62 79 74 65 73 3b |er ulong| nbytes;|
|00004d80| 0a 7b 20 20 20 72 65 67 | 69 73 74 65 72 20 62 79 |.{ reg|ister by|
|00004d90| 74 65 20 2a 63 3b 0a 20 | 20 20 20 72 65 67 69 73 |te *c;. | regis|
|00004da0| 74 65 72 20 75 6c 6f 6e | 67 20 63 61 6c 63 5f 63 |ter ulon|g calc_c|
|00004db0| 72 63 3b 0a 20 20 20 20 | 72 65 67 69 73 74 65 72 |rc;. |register|
|00004dc0| 20 69 6e 74 20 63 5f 6c | 65 6e 67 74 68 3b 0a 20 | int c_l|ength;. |
|00004dd0| 20 20 20 75 6c 6f 6e 67 | 20 65 78 74 72 61 5f 62 | ulong| extra_b|
|00004de0| 79 74 65 73 3b 0a 20 20 | 20 20 65 78 74 65 72 6e |ytes;. | extern|
|00004df0| 20 77 6f 72 64 20 6d 61 | 67 69 63 5b 5d 3b 0a 0a | word ma|gic[];..|
|00004e00| 20 20 20 20 65 78 74 72 | 61 5f 62 79 74 65 73 20 | extr|a_bytes |
|00004e10| 3d 20 31 32 37 20 2d 20 | 28 6e 62 79 74 65 73 2b |= 127 - |(nbytes+|
|00004e20| 31 32 37 29 25 31 32 38 | 3b 20 2f 2a 20 70 61 64 |127)%128|; /* pad|
|00004e30| 20 66 6f 72 6b 20 74 6f | 20 6d 75 6c 74 20 6f 66 | fork to| mult of|
|00004e40| 20 31 32 38 20 62 79 74 | 65 73 20 2a 2f 0a 20 20 | 128 byt|es */. |
|00004e50| 20 20 63 61 6c 63 5f 63 | 72 63 20 3d 20 30 3b 0a | calc_c|rc = 0;.|
|00004e60| 20 20 20 20 66 6f 72 20 | 28 3b 3b 29 20 7b 0a 20 | for |(;;) {. |
|00004e70| 20 20 20 20 20 20 20 63 | 20 3d 20 62 75 66 5f 70 | c| = buf_p|
|00004e80| 74 72 3b 0a 20 20 20 20 | 20 20 20 20 63 5f 6c 65 |tr;. | c_le|
|00004e90| 6e 67 74 68 20 3d 20 28 | 63 20 2b 20 6e 62 79 74 |ngth = (|c + nbyt|
|00004ea0| 65 73 20 3e 20 62 75 66 | 5f 65 6e 64 29 20 3f 20 |es > buf|_end) ? |
|00004eb0| 62 75 66 5f 65 6e 64 20 | 2d 20 63 20 3a 20 6e 62 |buf_end |- c : nb|
|00004ec0| 79 74 65 73 3b 0a 20 20 | 20 20 20 20 20 20 6e 62 |ytes;. | nb|
|00004ed0| 79 74 65 73 20 2d 3d 20 | 63 5f 6c 65 6e 67 74 68 |ytes -= |c_length|
|00004ee0| 3b 0a 20 20 20 20 20 20 | 20 20 66 77 72 69 74 65 |;. | fwrite|
|00004ef0| 28 63 2c 20 73 69 7a 65 | 6f 66 28 62 79 74 65 29 |(c, size|of(byte)|
|00004f00| 2c 20 63 5f 6c 65 6e 67 | 74 68 2c 20 62 69 6e 66 |, c_leng|th, binf|
|00004f10| 69 6c 65 29 3b 0a 20 20 | 20 20 20 20 20 20 77 68 |ile);. | wh|
|00004f20| 69 6c 65 20 28 63 5f 6c | 65 6e 67 74 68 2d 2d 29 |ile (c_l|ength--)|
|00004f30| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 63 61 6c |. | cal|
|00004f40| 63 5f 63 72 63 20 3d 20 | 28 28 28 63 61 6c 63 5f |c_crc = |(((calc_|
|00004f50| 63 72 63 26 30 78 66 66 | 29 20 3c 3c 20 38 29 20 |crc&0xff|) << 8) |
|00004f60| 7c 20 2a 63 2b 2b 29 20 | 5e 20 6d 61 67 69 63 5b || *c++) |^ magic[|
|00004f70| 63 61 6c 63 5f 63 72 63 | 20 3e 3e 20 38 5d 3b 0a |calc_crc| >> 8];.|
|00004f80| 20 20 20 20 20 20 20 20 | 69 66 20 28 21 6e 62 79 | |if (!nby|
|00004f90| 74 65 73 29 20 62 72 65 | 61 6b 3b 0a 20 20 20 20 |tes) bre|ak;. |
|00004fa0| 20 20 20 20 66 69 6c 6c | 5f 68 71 78 62 75 66 28 | fill|_hqxbuf(|
|00004fb0| 29 3b 0a 20 20 20 20 20 | 20 20 20 7d 0a 20 20 20 |);. | }. |
|00004fc0| 20 62 75 66 5f 70 74 72 | 20 3d 20 63 3b 0a 20 20 | buf_ptr| = c;. |
|00004fd0| 20 20 77 68 69 6c 65 20 | 28 65 78 74 72 61 5f 62 | while |(extra_b|
|00004fe0| 79 74 65 73 2d 2d 29 20 | 70 75 74 63 28 30 2c 20 |ytes--) |putc(0, |
|00004ff0| 62 69 6e 66 69 6c 65 29 | 3b 0a 20 20 20 20 63 61 |binfile)|;. ca|
|00005000| 6c 63 5f 63 72 63 20 3d | 20 28 28 63 61 6c 63 5f |lc_crc =| ((calc_|
|00005010| 63 72 63 26 30 78 66 66 | 29 20 3c 3c 20 38 29 20 |crc&0xff|) << 8) |
|00005020| 5e 20 6d 61 67 69 63 5b | 63 61 6c 63 5f 63 72 63 |^ magic[|calc_crc|
|00005030| 20 3e 3e 20 38 5d 3b 0a | 20 20 20 20 63 61 6c 63 | >> 8];.| calc|
|00005040| 5f 63 72 63 20 3d 20 28 | 28 63 61 6c 63 5f 63 72 |_crc = (|(calc_cr|
|00005050| 63 26 30 78 66 66 29 20 | 3c 3c 20 38 29 20 5e 20 |c&0xff) |<< 8) ^ |
|00005060| 6d 61 67 69 63 5b 63 61 | 6c 63 5f 63 72 63 20 3e |magic[ca|lc_crc >|
|00005070| 3e 20 38 5d 3b 0a 20 20 | 20 20 72 65 74 75 72 6e |> 8];. | return|
|00005080| 20 28 77 6f 72 64 29 20 | 63 61 6c 63 5f 63 72 63 | (word) |calc_crc|
|00005090| 3b 0a 20 20 20 20 7d 0a | 0a 2f 2a 20 54 68 69 73 |;. }.|./* This|
|000050a0| 20 72 6f 75 74 69 6e 65 | 20 63 6f 70 69 65 73 20 | routine| copies |
|000050b0| 62 79 74 65 73 20 66 72 | 6f 6d 20 74 68 65 20 69 |bytes fr|om the i|
|000050c0| 6e 70 75 74 20 73 74 72 | 65 61 6d 20 74 6f 20 74 |nput str|eam to t|
|000050d0| 68 65 20 65 6e 63 6f 64 | 65 64 20 6f 75 74 70 75 |he encod|ed outpu|
|000050e0| 74 2e 20 20 0a 20 20 20 | 20 49 74 20 61 6c 73 6f |t. . | It also|
|000050f0| 20 70 61 64 73 20 74 6f | 20 61 20 6d 75 6c 74 69 | pads to| a multi|
|00005100| 70 6c 65 20 6f 66 20 31 | 32 38 20 62 79 74 65 73 |ple of 1|28 bytes|
|00005110| 20 6f 6e 20 74 68 65 20 | 69 6e 70 75 74 2c 20 77 | on the |input, w|
|00005120| 68 69 63 68 20 69 73 20 | 70 61 72 74 0a 20 20 20 |hich is |part. |
|00005130| 20 6f 66 20 74 68 65 20 | 2e 62 69 6e 20 66 6f 72 | of the |.bin for|
|00005140| 6d 61 74 20 2a 2f 0a 77 | 6f 72 64 20 62 69 6e 5f |mat */.w|ord bin_|
|00005150| 74 6f 5f 68 71 78 5f 66 | 6f 72 6b 28 6e 62 79 74 |to_hqx_f|ork(nbyt|
|00005160| 65 73 29 0a 72 65 67 69 | 73 74 65 72 20 75 6c 6f |es).regi|ster ulo|
|00005170| 6e 67 20 6e 62 79 74 65 | 73 3b 0a 7b 20 20 20 72 |ng nbyte|s;.{ r|
|00005180| 65 67 69 73 74 65 72 20 | 62 79 74 65 20 2a 63 3b |egister |byte *c;|
|00005190| 0a 20 20 20 20 72 65 67 | 69 73 74 65 72 20 75 6c |. reg|ister ul|
|000051a0| 6f 6e 67 20 63 61 6c 63 | 5f 63 72 63 3b 0a 20 20 |ong calc|_crc;. |
|000051b0| 20 20 72 65 67 69 73 74 | 65 72 20 69 6e 74 20 63 | regist|er int c|
|000051c0| 5f 6c 65 6e 67 74 68 3b | 0a 20 20 20 20 75 6c 6f |_length;|. ulo|
|000051d0| 6e 67 20 65 78 74 72 61 | 5f 62 79 74 65 73 3b 0a |ng extra|_bytes;.|
|000051e0| 20 20 20 20 65 78 74 65 | 72 6e 20 77 6f 72 64 20 | exte|rn word |
|000051f0| 6d 61 67 69 63 5b 5d 3b | 0a 0a 20 20 20 20 65 78 |magic[];|.. ex|
|00005200| 74 72 61 5f 62 79 74 65 | 73 20 3d 20 31 32 37 20 |tra_byte|s = 127 |
|00005210| 2d 20 28 6e 62 79 74 65 | 73 2b 31 32 37 29 25 31 |- (nbyte|s+127)%1|
|00005220| 32 38 3b 20 2f 2a 20 70 | 61 64 20 66 6f 72 6b 20 |28; /* p|ad fork |
|00005230| 74 6f 20 6d 75 6c 74 20 | 6f 66 20 31 32 38 20 62 |to mult |of 128 b|
|00005240| 79 74 65 73 20 2a 2f 0a | 20 20 20 20 63 61 6c 63 |ytes */.| calc|
|00005250| 5f 63 72 63 20 3d 20 30 | 3b 0a 20 20 20 20 66 6f |_crc = 0|;. fo|
|00005260| 72 20 28 3b 3b 29 20 7b | 0a 20 20 20 20 20 20 20 |r (;;) {|. |
|00005270| 20 63 20 3d 20 62 75 66 | 5f 70 74 72 3b 0a 20 20 | c = buf|_ptr;. |
|00005280| 20 20 20 20 20 20 63 5f | 6c 65 6e 67 74 68 20 3d | c_|length =|
|00005290| 20 28 63 20 2b 20 6e 62 | 79 74 65 73 20 3e 20 62 | (c + nb|ytes > b|
|000052a0| 75 66 5f 65 6e 64 29 20 | 3f 20 62 75 66 5f 65 6e |uf_end) |? buf_en|
|000052b0| 64 20 2d 20 63 20 3a 20 | 6e 62 79 74 65 73 3b 0a |d - c : |nbytes;.|
|000052c0| 20 20 20 20 20 20 20 20 | 6e 62 79 74 65 73 20 2d | |nbytes -|
|000052d0| 3d 20 63 5f 6c 65 6e 67 | 74 68 3b 0a 20 20 20 20 |= c_leng|th;. |
|000052e0| 20 20 20 20 66 72 65 61 | 64 28 63 2c 20 73 69 7a | frea|d(c, siz|
|000052f0| 65 6f 66 28 62 79 74 65 | 29 2c 20 63 5f 6c 65 6e |eof(byte|), c_len|
|00005300| 67 74 68 2c 20 62 69 6e | 66 69 6c 65 29 3b 0a 20 |gth, bin|file);. |
|00005310| 20 20 20 20 20 20 20 62 | 75 66 5f 70 74 72 20 2b | b|uf_ptr +|
|00005320| 3d 20 63 5f 6c 65 6e 67 | 74 68 3b 0a 20 20 20 20 |= c_leng|th;. |
|00005330| 20 20 20 20 77 68 69 6c | 65 20 28 63 5f 6c 65 6e | whil|e (c_len|
|00005340| 67 74 68 2d 2d 29 0a 20 | 20 20 20 20 20 20 20 20 |gth--). | |
|00005350| 20 20 20 63 61 6c 63 5f | 63 72 63 20 3d 20 28 28 | calc_|crc = ((|
|00005360| 28 63 61 6c 63 5f 63 72 | 63 26 30 78 66 66 29 20 |(calc_cr|c&0xff) |
|00005370| 3c 3c 20 38 29 20 7c 20 | 2a 63 2b 2b 29 20 5e 20 |<< 8) | |*c++) ^ |
|00005380| 6d 61 67 69 63 5b 63 61 | 6c 63 5f 63 72 63 20 3e |magic[ca|lc_crc >|
|00005390| 3e 20 38 5d 3b 0a 20 20 | 20 20 20 20 20 20 69 66 |> 8];. | if|
|000053a0| 20 28 21 6e 62 79 74 65 | 73 29 20 62 72 65 61 6b | (!nbyte|s) break|
|000053b0| 3b 0a 20 20 20 20 20 20 | 20 20 65 6d 70 74 79 5f |;. | empty_|
|000053c0| 68 71 78 62 75 66 28 29 | 3b 0a 20 20 20 20 20 20 |hqxbuf()|;. |
|000053d0| 20 20 7d 0a 20 20 20 20 | 62 75 66 5f 70 74 72 20 | }. |buf_ptr |
|000053e0| 3d 20 63 3b 0a 0a 20 20 | 20 20 66 73 65 65 6b 28 |= c;.. | fseek(|
|000053f0| 62 69 6e 66 69 6c 65 2c | 20 65 78 74 72 61 5f 62 |binfile,| extra_b|
|00005400| 79 74 65 73 2c 20 31 29 | 3b 0a 20 20 20 20 63 61 |ytes, 1)|;. ca|
|00005410| 6c 63 5f 63 72 63 20 3d | 20 28 28 63 61 6c 63 5f |lc_crc =| ((calc_|
|00005420| 63 72 63 26 30 78 66 66 | 29 20 3c 3c 20 38 29 20 |crc&0xff|) << 8) |
|00005430| 5e 20 6d 61 67 69 63 5b | 63 61 6c 63 5f 63 72 63 |^ magic[|calc_crc|
|00005440| 20 3e 3e 20 38 5d 3b 0a | 20 20 20 20 63 61 6c 63 | >> 8];.| calc|
|00005450| 5f 63 72 63 20 3d 20 28 | 28 63 61 6c 63 5f 63 72 |_crc = (|(calc_cr|
|00005460| 63 26 30 78 66 66 29 20 | 3c 3c 20 38 29 20 5e 20 |c&0xff) |<< 8) ^ |
|00005470| 6d 61 67 69 63 5b 63 61 | 6c 63 5f 63 72 63 20 3e |magic[ca|lc_crc >|
|00005480| 3e 20 38 5d 3b 0a 20 20 | 20 20 72 65 74 75 72 6e |> 8];. | return|
|00005490| 20 28 77 6f 72 64 29 20 | 63 61 6c 63 5f 63 72 63 | (word) |calc_crc|
|000054a0| 3b 0a 20 20 20 20 7d 0a | 0a 2f 2a 20 45 73 73 65 |;. }.|./* Esse|
|000054b0| 6e 74 69 61 6c 73 20 66 | 6f 72 20 42 69 6e 68 65 |ntials f|or Binhe|
|000054c0| 78 20 38 74 6f 36 20 72 | 75 6e 20 6c 65 6e 67 74 |x 8to6 r|un lengt|
|000054d0| 68 20 65 6e 63 6f 64 69 | 6e 67 20 2a 2f 0a 23 64 |h encodi|ng */.#d|
|000054e0| 65 66 69 6e 65 20 52 55 | 4e 43 48 41 52 20 30 78 |efine RU|NCHAR 0x|
|000054f0| 39 30 0a 23 64 65 66 69 | 6e 65 20 4d 41 58 52 55 |90.#defi|ne MAXRU|
|00005500| 4e 20 32 35 35 0a 23 64 | 65 66 69 6e 65 20 49 53 |N 255.#d|efine IS|
|00005510| 5f 4c 45 47 41 4c 20 3c | 30 78 34 30 0a 23 64 65 |_LEGAL <|0x40.#de|
|00005520| 66 69 6e 65 20 49 53 4e | 54 5f 4c 45 47 41 4c 20 |fine ISN|T_LEGAL |
|00005530| 3e 30 78 33 66 0a 23 64 | 65 66 69 6e 65 20 44 4f |>0x3f.#d|efine DO|
|00005540| 4e 45 20 30 78 37 46 20 | 2f 2a 20 74 72 36 38 5b |NE 0x7F |/* tr68[|
|00005550| 27 3a 27 5d 20 3d 20 44 | 4f 4e 45 2c 20 73 69 6e |':'] = D|ONE, sin|
|00005560| 63 65 20 42 69 6e 68 65 | 78 20 74 65 72 6d 69 6e |ce Binhe|x termin|
|00005570| 61 74 6f 72 20 69 73 20 | 27 3a 27 20 2a 2f 0a 23 |ator is |':' */.#|
|00005580| 64 65 66 69 6e 65 20 53 | 4b 49 50 20 30 78 37 45 |define S|KIP 0x7E|
|00005590| 20 2f 2a 20 74 72 36 38 | 5b 27 5c 6e 27 7c 27 5c | /* tr68|['\n'|'\|
|000055a0| 72 27 5d 20 3d 20 53 4b | 49 50 2c 20 69 2e 20 65 |r'] = SK|IP, i. e|
|000055b0| 2e 20 65 6e 64 20 6f 66 | 20 6c 69 6e 65 20 63 68 |. end of| line ch|
|000055c0| 61 72 2e 20 20 2a 2f 0a | 23 64 65 66 69 6e 65 20 |ar. */.|#define |
|000055d0| 46 41 49 4c 20 30 78 37 | 44 20 2f 2a 20 63 68 61 |FAIL 0x7|D /* cha|
|000055e0| 72 61 63 74 65 72 20 69 | 6c 6c 65 67 61 6c 20 69 |racter i|llegal i|
|000055f0| 6e 20 62 69 6e 68 65 78 | 20 66 69 6c 65 20 2a 2f |n binhex| file */|
|00005600| 0a 0a 62 79 74 65 20 74 | 72 38 36 5b 5d 20 3d 0a |..byte t|r86[] =.|
|00005610| 20 20 20 20 20 20 20 20 | 22 21 5c 22 23 24 25 26 | |"!\"#$%&|
|00005620| 27 28 29 2a 2b 2c 2d 30 | 31 32 33 34 35 36 38 39 |'()*+,-0|12345689|
|00005630| 40 41 42 43 44 45 46 47 | 48 49 4a 4b 4c 4d 4e 50 |@ABCDEFG|HIJKLMNP|
|00005640| 51 52 53 54 55 56 58 59 | 5a 5b 60 61 62 63 64 65 |QRSTUVXY|Z[`abcde|
|00005650| 66 68 69 6a 6b 6c 6d 70 | 71 72 22 3b 20 0a 62 79 |fhijklmp|qr"; .by|
|00005660| 74 65 20 74 72 36 38 5b | 5d 20 3d 20 7b 0a 20 20 |te tr68[|] = {. |
|00005670| 20 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 | FAIL, |FAIL, FA|
|00005680| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005690| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|000056a0| 2c 0a 20 20 20 20 46 41 | 49 4c 2c 20 46 41 49 4c |,. FA|IL, FAIL|
|000056b0| 2c 20 53 4b 49 50 2c 20 | 46 41 49 4c 2c 20 46 41 |, SKIP, |FAIL, FA|
|000056c0| 49 4c 2c 20 53 4b 49 50 | 2c 20 46 41 49 4c 2c 20 |IL, SKIP|, FAIL, |
|000056d0| 46 41 49 4c 2c 0a 20 20 | 20 20 46 41 49 4c 2c 20 |FAIL,. | FAIL, |
|000056e0| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|000056f0| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 |, FAIL, |FAIL, FA|
|00005700| 49 4c 2c 20 46 41 49 4c | 2c 0a 20 20 20 20 46 41 |IL, FAIL|,. FA|
|00005710| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005720| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005730| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 0a 20 20 |, FAIL, |FAIL,. |
|00005740| 20 20 46 41 49 4c 2c 20 | 30 78 30 30 2c 20 30 78 | FAIL, |0x00, 0x|
|00005750| 30 31 2c 20 30 78 30 32 | 2c 20 30 78 30 33 2c 20 |01, 0x02|, 0x03, |
|00005760| 30 78 30 34 2c 20 30 78 | 30 35 2c 20 30 78 30 36 |0x04, 0x|05, 0x06|
|00005770| 2c 0a 20 20 20 20 30 78 | 30 37 2c 20 30 78 30 38 |,. 0x|07, 0x08|
|00005780| 2c 20 30 78 30 39 2c 20 | 30 78 30 41 2c 20 30 78 |, 0x09, |0x0A, 0x|
|00005790| 30 42 2c 20 30 78 30 43 | 2c 20 46 41 49 4c 2c 20 |0B, 0x0C|, FAIL, |
|000057a0| 46 41 49 4c 2c 0a 20 20 | 20 20 30 78 30 44 2c 20 |FAIL,. | 0x0D, |
|000057b0| 30 78 30 45 2c 20 30 78 | 30 46 2c 20 30 78 31 30 |0x0E, 0x|0F, 0x10|
|000057c0| 2c 20 30 78 31 31 2c 20 | 30 78 31 32 2c 20 30 78 |, 0x11, |0x12, 0x|
|000057d0| 31 33 2c 20 46 41 49 4c | 2c 0a 20 20 20 20 30 78 |13, FAIL|,. 0x|
|000057e0| 31 34 2c 20 30 78 31 35 | 2c 20 44 4f 4e 45 2c 20 |14, 0x15|, DONE, |
|000057f0| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005800| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 0a 20 20 |, FAIL, |FAIL,. |
|00005810| 20 20 30 78 31 36 2c 20 | 30 78 31 37 2c 20 30 78 | 0x16, |0x17, 0x|
|00005820| 31 38 2c 20 30 78 31 39 | 2c 20 30 78 31 41 2c 20 |18, 0x19|, 0x1A, |
|00005830| 30 78 31 42 2c 20 30 78 | 31 43 2c 20 30 78 31 44 |0x1B, 0x|1C, 0x1D|
|00005840| 2c 0a 20 20 20 20 30 78 | 31 45 2c 20 30 78 31 46 |,. 0x|1E, 0x1F|
|00005850| 2c 20 30 78 32 30 2c 20 | 30 78 32 31 2c 20 30 78 |, 0x20, |0x21, 0x|
|00005860| 32 32 2c 20 30 78 32 33 | 2c 20 30 78 32 34 2c 20 |22, 0x23|, 0x24, |
|00005870| 46 41 49 4c 2c 0a 20 20 | 20 20 30 78 32 35 2c 20 |FAIL,. | 0x25, |
|00005880| 30 78 32 36 2c 20 30 78 | 32 37 2c 20 30 78 32 38 |0x26, 0x|27, 0x28|
|00005890| 2c 20 30 78 32 39 2c 20 | 30 78 32 41 2c 20 30 78 |, 0x29, |0x2A, 0x|
|000058a0| 32 42 2c 20 46 41 49 4c | 2c 0a 20 20 20 20 30 78 |2B, FAIL|,. 0x|
|000058b0| 32 43 2c 20 30 78 32 44 | 2c 20 30 78 32 45 2c 20 |2C, 0x2D|, 0x2E, |
|000058c0| 30 78 32 46 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |0x2F, FA|IL, FAIL|
|000058d0| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 0a 20 20 |, FAIL, |FAIL,. |
|000058e0| 20 20 30 78 33 30 2c 20 | 30 78 33 31 2c 20 30 78 | 0x30, |0x31, 0x|
|000058f0| 33 32 2c 20 30 78 33 33 | 2c 20 30 78 33 34 2c 20 |32, 0x33|, 0x34, |
|00005900| 30 78 33 35 2c 20 30 78 | 33 36 2c 20 46 41 49 4c |0x35, 0x|36, FAIL|
|00005910| 2c 0a 20 20 20 20 30 78 | 33 37 2c 20 30 78 33 38 |,. 0x|37, 0x38|
|00005920| 2c 20 30 78 33 39 2c 20 | 30 78 33 41 2c 20 30 78 |, 0x39, |0x3A, 0x|
|00005930| 33 42 2c 20 30 78 33 43 | 2c 20 46 41 49 4c 2c 20 |3B, 0x3C|, FAIL, |
|00005940| 46 41 49 4c 2c 0a 20 20 | 20 20 30 78 33 44 2c 20 |FAIL,. | 0x3D, |
|00005950| 30 78 33 45 2c 20 30 78 | 33 46 2c 20 46 41 49 4c |0x3E, 0x|3F, FAIL|
|00005960| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 |, FAIL, |FAIL, FA|
|00005970| 49 4c 2c 20 46 41 49 4c | 2c 0a 20 20 20 20 46 41 |IL, FAIL|,. FA|
|00005980| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005990| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|000059a0| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 0a 20 20 |, FAIL, |FAIL,. |
|000059b0| 20 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 | FAIL, |FAIL, FA|
|000059c0| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|000059d0| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|000059e0| 2c 0a 20 20 20 20 46 41 | 49 4c 2c 20 46 41 49 4c |,. FA|IL, FAIL|
|000059f0| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 |, FAIL, |FAIL, FA|
|00005a00| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005a10| 46 41 49 4c 2c 0a 20 20 | 20 20 46 41 49 4c 2c 20 |FAIL,. | FAIL, |
|00005a20| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005a30| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 |, FAIL, |FAIL, FA|
|00005a40| 49 4c 2c 20 46 41 49 4c | 2c 0a 20 20 20 20 46 41 |IL, FAIL|,. FA|
|00005a50| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005a60| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005a70| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 0a 20 20 |, FAIL, |FAIL,. |
|00005a80| 20 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 | FAIL, |FAIL, FA|
|00005a90| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005aa0| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005ab0| 2c 0a 20 20 20 20 46 41 | 49 4c 2c 20 46 41 49 4c |,. FA|IL, FAIL|
|00005ac0| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 |, FAIL, |FAIL, FA|
|00005ad0| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005ae0| 46 41 49 4c 2c 0a 20 20 | 20 20 46 41 49 4c 2c 20 |FAIL,. | FAIL, |
|00005af0| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005b00| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 |, FAIL, |FAIL, FA|
|00005b10| 49 4c 2c 20 46 41 49 4c | 2c 0a 20 20 20 20 46 41 |IL, FAIL|,. FA|
|00005b20| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005b30| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005b40| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 0a 20 20 |, FAIL, |FAIL,. |
|00005b50| 20 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 | FAIL, |FAIL, FA|
|00005b60| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005b70| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005b80| 2c 0a 20 20 20 20 46 41 | 49 4c 2c 20 46 41 49 4c |,. FA|IL, FAIL|
|00005b90| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 |, FAIL, |FAIL, FA|
|00005ba0| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005bb0| 46 41 49 4c 2c 0a 20 20 | 20 20 46 41 49 4c 2c 20 |FAIL,. | FAIL, |
|00005bc0| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005bd0| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 |, FAIL, |FAIL, FA|
|00005be0| 49 4c 2c 20 46 41 49 4c | 2c 0a 20 20 20 20 46 41 |IL, FAIL|,. FA|
|00005bf0| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005c00| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005c10| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 0a 20 20 |, FAIL, |FAIL,. |
|00005c20| 20 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 | FAIL, |FAIL, FA|
|00005c30| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005c40| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005c50| 2c 0a 20 20 20 20 46 41 | 49 4c 2c 20 46 41 49 4c |,. FA|IL, FAIL|
|00005c60| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 |, FAIL, |FAIL, FA|
|00005c70| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005c80| 46 41 49 4c 2c 0a 20 20 | 20 20 46 41 49 4c 2c 20 |FAIL,. | FAIL, |
|00005c90| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005ca0| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 20 46 41 |, FAIL, |FAIL, FA|
|00005cb0| 49 4c 2c 20 46 41 49 4c | 2c 0a 20 20 20 20 46 41 |IL, FAIL|,. FA|
|00005cc0| 49 4c 2c 20 46 41 49 4c | 2c 20 46 41 49 4c 2c 20 |IL, FAIL|, FAIL, |
|00005cd0| 46 41 49 4c 2c 20 46 41 | 49 4c 2c 20 46 41 49 4c |FAIL, FA|IL, FAIL|
|00005ce0| 2c 20 46 41 49 4c 2c 20 | 46 41 49 4c 2c 0a 20 20 |, FAIL, |FAIL,. |
|00005cf0| 20 20 7d 3b 0a 0a 2f 2a | 0a 20 2a 20 20 54 68 69 | };../*|. * Thi|
|00005d00| 73 20 70 72 6f 63 65 64 | 75 72 65 20 74 72 61 6e |s proced|ure tran|
|00005d10| 73 70 61 72 65 6e 74 6c | 79 20 72 65 61 64 73 20 |sparentl|y reads |
|00005d20| 61 6e 64 20 64 65 63 6f | 64 65 73 20 74 68 65 20 |and deco|des the |
|00005d30| 68 71 78 20 69 6e 70 75 | 74 2e 20 20 49 74 20 64 |hqx inpu|t. It d|
|00005d40| 6f 65 73 20 72 75 6e 20 | 0a 20 2a 20 20 6c 65 6e |oes run |. * len|
|00005d50| 67 74 68 20 61 6e 64 20 | 36 20 74 6f 20 38 20 64 |gth and |6 to 8 d|
|00005d60| 65 63 6f 64 69 6e 67 2e | 0a 20 2a 2f 0a 23 64 65 |ecoding.|. */.#de|
|00005d70| 66 69 6e 65 20 52 45 41 | 44 49 4e 47 20 30 0a 23 |fine REA|DING 0.#|
|00005d80| 64 65 66 69 6e 65 20 53 | 4b 49 50 50 49 4e 47 20 |define S|KIPPING |
|00005d90| 31 0a 23 64 65 66 69 6e | 65 20 46 49 4e 44 5f 53 |1.#defin|e FIND_S|
|00005da0| 54 41 52 54 5f 43 4f 4c | 4f 4e 20 32 0a 0a 66 69 |TART_COL|ON 2..fi|
|00005db0| 6c 6c 5f 68 71 78 62 75 | 66 28 29 0a 7b 20 20 20 |ll_hqxbu|f().{ |
|00005dc0| 72 65 67 69 73 74 65 72 | 20 75 6c 6f 6e 67 20 63 |register| ulong c|
|00005dd0| 2c 20 6e 69 62 62 6c 65 | 3b 0a 20 20 20 20 72 65 |, nibble|;. re|
|00005de0| 67 69 73 74 65 72 20 69 | 6e 74 20 6e 6f 74 5f 69 |gister i|nt not_i|
|00005df0| 6e 5f 61 5f 72 75 6e 20 | 3d 20 54 52 55 45 2c 20 |n_a_run |= TRUE, |
|00005e00| 73 74 61 74 65 36 38 3b | 0a 20 20 20 20 72 65 67 |state68;|. reg|
|00005e10| 69 73 74 65 72 20 62 79 | 74 65 20 2a 66 61 73 74 |ister by|te *fast|
|00005e20| 5f 62 75 66 2c 20 2a 66 | 61 73 74 5f 6c 69 6e 65 |_buf, *f|ast_line|
|00005e30| 3b 0a 20 20 20 20 73 74 | 61 74 69 63 20 69 6e 74 |;. st|atic int|
|00005e40| 20 73 74 61 74 75 73 20 | 3d 20 46 49 4e 44 5f 53 | status |= FIND_S|
|00005e50| 54 41 52 54 5f 43 4f 4c | 4f 4e 3b 0a 0a 20 20 20 |TART_COL|ON;.. |
|00005e60| 20 62 75 66 5f 70 74 72 | 20 3d 20 66 61 73 74 5f | buf_ptr| = fast_|
|00005e70| 62 75 66 20 3d 20 62 75 | 66 5f 73 74 61 72 74 3b |buf = bu|f_start;|
|00005e80| 0a 20 20 20 20 66 61 73 | 74 5f 6c 69 6e 65 20 3d |. fas|t_line =|
|00005e90| 20 6c 69 6e 65 5f 70 74 | 72 3b 0a 20 20 20 20 73 | line_pt|r;. s|
|00005ea0| 74 61 74 65 36 38 20 3d | 20 73 61 76 65 5f 73 74 |tate68 =| save_st|
|00005eb0| 61 74 65 3b 0a 20 20 20 | 20 6e 69 62 62 6c 65 20 |ate;. | nibble |
|00005ec0| 3d 20 73 61 76 65 5f 6e | 69 62 62 6c 65 3b 0a 20 |= save_n|ibble;. |
|00005ed0| 20 20 20 69 66 20 28 73 | 61 76 65 5f 72 75 6e 5f | if (s|ave_run_|
|00005ee0| 6c 65 6e 67 74 68 20 3e | 20 30 29 20 7b 0a 20 20 |length >| 0) {. |
|00005ef0| 20 20 20 20 20 20 63 20 | 3d 20 73 61 76 65 5f 72 | c |= save_r|
|00005f00| 75 6e 5f 6c 65 6e 67 74 | 68 3b 0a 20 20 20 20 20 |un_lengt|h;. |
|00005f10| 20 20 20 73 61 76 65 5f | 72 75 6e 5f 6c 65 6e 67 | save_|run_leng|
|00005f20| 74 68 20 3d 20 30 3b 0a | 20 20 20 20 20 20 20 20 |th = 0;.| |
|00005f30| 67 6f 74 6f 20 63 6f 6e | 74 69 6e 75 65 5f 72 75 |goto con|tinue_ru|
|00005f40| 6e 3b 0a 20 20 20 20 20 | 20 20 20 7d 0a 20 20 20 |n;. | }. |
|00005f50| 20 77 68 69 6c 65 20 28 | 66 61 73 74 5f 62 75 66 | while (|fast_buf|
|00005f60| 20 3c 20 62 75 66 5f 65 | 6e 64 29 20 7b 0a 20 20 | < buf_e|nd) {. |
|00005f70| 20 20 20 20 20 20 6e 65 | 78 74 5f 63 68 61 72 3a | ne|xt_char:|
|00005f80| 0a 20 20 20 20 20 20 20 | 20 69 66 20 28 28 63 20 |. | if ((c |
|00005f90| 3d 20 2a 66 61 73 74 5f | 6c 69 6e 65 2b 2b 29 20 |= *fast_|line++) |
|00005fa0| 49 53 4e 54 5f 4c 45 47 | 41 4c 29 20 7b 0a 20 20 |ISNT_LEG|AL) {. |
|00005fb0| 20 20 20 20 20 20 20 20 | 20 20 69 66 20 28 63 20 | | if (c |
|00005fc0| 3d 3d 20 44 4f 4e 45 29 | 20 62 72 65 61 6b 3b 0a |== DONE)| break;.|
|00005fd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 6e 65 78 74 | | next|
|00005fe0| 5f 6c 69 6e 65 3a 0a 20 | 20 20 20 20 20 20 20 20 |_line:. | |
|00005ff0| 20 20 20 69 66 20 28 21 | 66 67 65 74 73 28 6c 69 | if (!|fgets(li|
|00006000| 6e 65 5f 73 74 61 72 74 | 2c 20 4d 41 58 4c 49 4e |ne_start|, MAXLIN|
|00006010| 45 2c 20 68 71 78 66 69 | 6c 65 29 20 26 26 20 21 |E, hqxfi|le) && !|
|00006020| 6e 65 77 5f 69 6e 5f 68 | 71 78 5f 66 69 6c 65 28 |new_in_h|qx_file(|
|00006030| 29 29 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |)). | |
|00006040| 20 20 20 69 66 20 28 73 | 74 61 74 75 73 20 3d 3d | if (s|tatus ==|
|00006050| 20 46 49 4e 44 5f 53 54 | 41 52 54 5f 43 4f 4c 4f | FIND_ST|ART_COLO|
|00006060| 4e 29 20 65 78 69 74 28 | 30 29 3b 0a 09 09 65 6c |N) exit(|0);...el|
|00006070| 73 65 20 65 72 72 6f 72 | 28 22 50 72 65 6d 61 74 |se error|("Premat|
|00006080| 75 72 65 20 45 4f 46 20 | 69 6e 20 25 73 5c 6e 22 |ure EOF |in %s\n"|
|00006090| 2c 20 68 71 78 66 6e 61 | 6d 65 29 3b 0a 20 20 20 |, hqxfna|me);. |
|000060a0| 20 20 20 20 20 20 20 20 | 20 6c 69 6e 65 5f 70 74 | | line_pt|
|000060b0| 72 20 3d 20 6c 69 6e 65 | 5f 73 74 61 72 74 3b 0a |r = line|_start;.|
|000060c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 73 63 61 6e | | scan|
|000060d0| 5f 6c 69 6e 65 3a 0a 20 | 20 20 20 20 20 20 20 20 |_line:. | |
|000060e0| 20 20 20 66 61 73 74 5f | 6c 69 6e 65 20 3d 20 6c | fast_|line = l|
|000060f0| 69 6e 65 5f 70 74 72 3b | 0a 09 20 20 20 20 77 68 |ine_ptr;|.. wh|
|00006100| 69 6c 65 20 28 28 2a 66 | 61 73 74 5f 6c 69 6e 65 |ile ((*f|ast_line|
|00006110| 20 3d 20 74 72 36 38 5b | 2a 66 61 73 74 5f 6c 69 | = tr68[|*fast_li|
|00006120| 6e 65 5d 29 20 49 53 5f | 4c 45 47 41 4c 29 20 66 |ne]) IS_|LEGAL) f|
|00006130| 61 73 74 5f 6c 69 6e 65 | 2b 2b 3b 0a 09 20 20 20 |ast_line|++;.. |
|00006140| 20 63 20 3d 20 2a 66 61 | 73 74 5f 6c 69 6e 65 3b | c = *fa|st_line;|
|00006150| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 73 77 69 |. | swi|
|00006160| 74 63 68 20 28 73 74 61 | 74 75 73 29 20 7b 0a 20 |tch (sta|tus) {. |
|00006170| 20 20 20 20 20 20 20 20 | 20 20 20 63 61 73 65 20 | | case |
|00006180| 52 45 41 44 49 4e 47 3a | 0a 20 20 20 20 20 20 20 |READING:|. |
|00006190| 20 20 20 20 20 20 20 20 | 20 69 66 20 28 63 20 3d | | if (c =|
|000061a0| 3d 20 53 4b 49 50 20 26 | 26 20 66 61 73 74 5f 6c |= SKIP &|& fast_l|
|000061b0| 69 6e 65 20 3d 3d 20 6c | 69 6e 65 5f 65 6e 64 29 |ine == l|ine_end)|
|000061c0| 20 62 72 65 61 6b 3b 0a | 20 20 20 20 20 20 20 20 | break;.| |
|000061d0| 20 20 20 20 20 20 20 20 | 69 66 20 28 63 20 3d 3d | |if (c ==|
|000061e0| 20 44 4f 4e 45 29 20 7b | 0a 20 20 20 20 20 20 20 | DONE) {|. |
|000061f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 73 74 61 | | sta|
|00006200| 74 75 73 20 3d 20 46 49 | 4e 44 5f 53 54 41 52 54 |tus = FI|ND_START|
|00006210| 5f 43 4f 4c 4f 4e 3b 0a | 20 20 20 20 20 20 20 20 |_COLON;.| |
|00006220| 20 20 20 20 20 20 20 20 | 20 20 20 20 62 72 65 61 | | brea|
|00006230| 6b 3b 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |k;. | |
|00006240| 20 20 20 20 20 20 20 7d | 0a 20 20 20 20 20 20 20 | }|. |
|00006250| 20 20 20 20 20 20 20 20 | 20 73 74 61 74 75 73 20 | | status |
|00006260| 3d 20 53 4b 49 50 50 49 | 4e 47 3b 0a 20 20 20 20 |= SKIPPI|NG;. |
|00006270| 20 20 20 20 20 20 20 20 | 20 20 20 20 67 6f 74 6f | | goto|
|00006280| 20 6e 65 78 74 5f 6c 69 | 6e 65 3b 0a 20 20 20 20 | next_li|ne;. |
|00006290| 20 20 20 20 20 20 20 20 | 63 61 73 65 20 53 4b 49 | |case SKI|
|000062a0| 50 50 49 4e 47 3a 0a 20 | 20 20 20 20 20 20 20 20 |PPING:. | |
|000062b0| 20 20 20 20 20 20 20 69 | 66 20 28 63 20 3d 3d 20 | i|f (c == |
|000062c0| 53 4b 49 50 20 26 26 20 | 66 61 73 74 5f 6c 69 6e |SKIP && |fast_lin|
|000062d0| 65 20 3d 3d 20 6c 69 6e | 65 5f 65 6e 64 29 20 7b |e == lin|e_end) {|
|000062e0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|000062f0| 20 20 20 20 20 73 74 61 | 74 75 73 20 3d 20 52 45 | sta|tus = RE|
|00006300| 41 44 49 4e 47 3b 0a 20 | 20 20 20 20 20 20 20 20 |ADING;. | |
|00006310| 20 20 20 20 20 20 20 20 | 20 20 20 62 72 65 61 6b | | break|
|00006320| 3b 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |;. | |
|00006330| 20 20 20 20 20 20 7d 0a | 09 09 2f 2a 20 20 47 4d | }.|../* GM|
|00006340| 54 2c 20 31 2f 39 2f 39 | 30 3a 20 41 64 64 65 64 |T, 1/9/9|0: Added|
|00006350| 20 74 68 69 73 20 63 6c | 61 75 73 65 20 74 6f 20 | this cl|ause to |
|00006360| 61 76 6f 69 64 20 6c 6f | 73 69 6e 67 20 74 68 65 |avoid lo|sing the|
|00006370| 20 6c 61 73 74 0a 09 09 | 20 2a 20 20 6c 69 6e 65 | last...| * line|
|00006380| 20 69 66 20 69 74 20 77 | 61 73 20 70 72 65 63 65 | if it w|as prece|
|00006390| 65 64 65 64 20 62 79 20 | 61 20 73 6b 69 70 70 65 |eded by |a skippe|
|000063a0| 64 20 6c 69 6e 65 2e 20 | 20 2a 2f 0a 20 20 20 20 |d line. | */. |
|000063b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 69 66 20 28 | | if (|
|000063c0| 63 20 3d 3d 20 44 4f 4e | 45 29 20 7b 0a 20 20 20 |c == DON|E) {. |
|000063d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000063e0| 20 73 74 61 74 75 73 20 | 3d 20 46 49 4e 44 5f 53 | status |= FIND_S|
|000063f0| 54 41 52 54 5f 43 4f 4c | 4f 4e 3b 0a 20 20 20 20 |TART_COL|ON;. |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.