home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1989-09-14 | 7.0 KB | [TEXT/????] |
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
You can browse this item here: buffer.c.bin
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| AMOS Picture Packer (image/amosPicturePacker)
| ext
| Supported |
1%
| dexvert
| Debian floppy split (archive/debianFloppySplit)
| ext
| Unsupported |
1%
| dexvert
| Sound Images sound sample (audio/soundImagesSoundSample)
| ext
| Unsupported |
1%
| dexvert
| DESI-III drawing (image/desiIIIDrawing)
| ext
| Unsupported |
1%
| dexvert
| MS-DOS PMODE extender executable (executable/msdosPMODEExtenderExecutable)
| ext
| Unsupported |
1%
| dexvert
| Alien Trilogytextures (other/alienTrilogyTextures)
| ext
| Unsupported |
1%
| dexvert
| APT cache data (other/aptCacheData)
| ext
| Unsupported |
1%
| dexvert
| CorelTRACE configuration (other/corelTRACEConfiguration)
| ext
| Unsupported |
1%
| dexvert
| Dreamcast Disc (other/dreamcastDisc)
| ext
| Unsupported |
1%
| dexvert
| EST flat binary (other/estFlatBinary)
| ext
| Unsupported |
1%
| dexvert
| Finale Enigma Binary Format (other/finaleEnigmaBinaryFormat)
| ext
| Unsupported |
1%
| dexvert
| Sega Genesis/Megadrive/32x ROM (other/genesisROM)
| ext
| Unsupported |
1%
| dexvert
| Myth: The Fallen Lords game archive (other/mythTheFallenLordsGameArchive)
| ext
| Unsupported |
1%
| dexvert
| Sound Images Sound Driver (other/soundImagesSoundDriver)
| ext
| Unsupported |
1%
| dexvert
| Symantec/Norton Config (other/symantecNortonConfig)
| ext
| Unsupported |
1%
| dexvert
| Vectrex ROM (other/vectrexROM)
| ext
| Unsupported |
1%
| dexvert
| BIS raP encoded format (other/bisraPEncoded)
| ext
| Unsupported |
1%
| dexvert
| Pascal Script binary (other/pascalScriptBinary)
| ext
| Unsupported |
1%
| dexvert
| 7th Level game data archive (other/seventhLevelGameDataArchive)
| ext
| Unsupported |
1%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Binary Text (image/binaryText)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary, Wed Jan 18 15:44:16 1989, modified Mon May 29 09:36:28 1989, creator '????', type ASCII, 6620 bytes "buffer.c" , at 0x1a5c 382 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 1
| default (weak)
| |
100%
| lsar
| MacBinary
| default
| |
100%
| gt2
| MAC Bilddatei
| default (weak)
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [????] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 62 75 66 66 65 72 | 2e 63 00 00 00 00 00 00 |..buffer|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 3f 3f 3f | 3f 00 00 00 00 00 00 00 |.TEXT???|?.......|
|00000050| 00 00 00 00 00 19 dc 00 | 00 01 7e 9f fa a7 a0 a0 |........|..~.....|
|00000060| a6 f7 dc 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000080| 2f 2a 0d 20 2a 20 4d 61 | 63 69 6e 74 6f 73 68 20 |/*. * Ma|cintosh |
|00000090| 54 61 72 0d 20 2a 0d 20 | 2a 20 4d 6f 64 69 66 69 |Tar. *. |* Modifi|
|000000a0| 65 64 20 62 79 20 43 72 | 61 69 67 20 52 75 66 66 |ed by Cr|aig Ruff|
|000000b0| 20 66 6f 72 20 75 73 65 | 20 6f 6e 20 74 68 65 20 | for use| on the |
|000000c0| 4d 61 63 69 6e 74 6f 73 | 68 2e 0d 20 2a 2f 0d 2f |Macintos|h.. */./|
|000000d0| 2a 0d 20 2a 20 42 75 66 | 66 65 72 20 6d 61 6e 61 |*. * Buf|fer mana|
|000000e0| 67 65 6d 65 6e 74 20 66 | 6f 72 20 70 75 62 6c 69 |gement f|or publi|
|000000f0| 63 20 64 6f 6d 61 69 6e | 20 74 61 72 2e 0d 20 2a |c domain| tar.. *|
|00000100| 0d 20 2a 20 57 72 69 74 | 74 65 6e 20 62 79 20 4a |. * Writ|ten by J|
|00000110| 6f 68 6e 20 47 69 6c 6d | 6f 72 65 2c 20 69 68 6e |ohn Gilm|ore, ihn|
|00000120| 70 34 21 68 6f 70 74 6f | 61 64 21 67 6e 75 2c 20 |p4!hopto|ad!gnu, |
|00000130| 6f 6e 20 32 35 20 41 75 | 67 75 73 74 20 31 39 38 |on 25 Au|gust 198|
|00000140| 35 2e 0d 20 2a 0d 20 2a | 20 40 28 23 29 20 62 75 |5.. *. *| @(#) bu|
|00000150| 66 66 65 72 2e 63 20 31 | 2e 31 34 20 31 30 2f 32 |ffer.c 1|.14 10/2|
|00000160| 38 2f 38 36 20 50 75 62 | 6c 69 63 20 44 6f 6d 61 |8/86 Pub|lic Doma|
|00000170| 69 6e 20 2d 20 67 6e 75 | 0d 20 2a 0d 20 2a 2f 0d |in - gnu|. *. */.|
|00000180| 0d 23 69 6e 63 6c 75 64 | 65 20 22 74 61 72 2e 68 |.#includ|e "tar.h|
|00000190| 22 0d 0d 42 6f 6f 6c 65 | 61 6e 09 09 46 6c 75 73 |"..Boole|an..Flus|
|000001a0| 68 41 72 63 68 69 76 65 | 28 29 3b 0d 0d 75 6e 69 |hArchive|();..uni|
|000001b0| 6f 6e 20 72 65 63 6f 72 | 64 09 2a 61 72 42 6c 6f |on recor|d.*arBlo|
|000001c0| 63 6b 3b 09 2f 2a 20 53 | 74 61 72 74 20 6f 66 20 |ck;./* S|tart of |
|000001d0| 62 6c 6f 63 6b 20 6f 66 | 20 61 72 63 68 69 76 65 |block of| archive|
|000001e0| 20 2a 2f 0d 75 6e 69 6f | 6e 20 72 65 63 6f 72 64 | */.unio|n record|
|000001f0| 09 2a 61 72 52 65 63 6f | 72 64 3b 09 2f 2a 20 43 |.*arReco|rd;./* C|
|00000200| 75 72 72 65 6e 74 20 72 | 65 63 6f 72 64 20 6f 66 |urrent r|ecord of|
|00000210| 20 61 72 63 68 69 76 65 | 20 2a 2f 0d 75 6e 69 6f | archive| */.unio|
|00000220| 6e 20 72 65 63 6f 72 64 | 09 2a 61 72 4c 61 73 74 |n record|.*arLast|
|00000230| 3b 09 2f 2a 20 4c 61 73 | 74 2b 31 20 72 65 63 6f |;./* Las|t+1 reco|
|00000240| 72 64 20 6f 66 20 61 72 | 63 68 69 76 65 20 62 6c |rd of ar|chive bl|
|00000250| 6f 63 6b 20 2a 2f 0d 63 | 68 61 72 09 09 61 72 52 |ock */.c|har..arR|
|00000260| 65 61 64 69 6e 67 3b 09 | 2f 2a 20 30 20 77 72 69 |eading;.|/* 0 wri|
|00000270| 74 69 6e 67 2c 20 21 30 | 20 72 65 61 64 69 6e 67 |ting, !0| reading|
|00000280| 20 61 72 63 68 69 76 65 | 20 2a 2f 0d 0d 2f 2a 0d | archive| */../*.|
|00000290| 20 2a 20 54 68 65 20 72 | 65 63 6f 72 64 20 70 6f | * The r|ecord po|
|000002a0| 69 6e 74 65 64 20 74 6f | 20 62 79 20 73 61 76 65 |inted to| by save|
|000002b0| 5f 72 65 63 20 73 68 6f | 75 6c 64 20 6e 6f 74 20 |_rec sho|uld not |
|000002c0| 62 65 20 6f 76 65 72 6c | 61 69 64 0d 20 2a 20 77 |be overl|aid. * w|
|000002d0| 68 65 6e 20 72 65 61 64 | 69 6e 67 20 69 6e 20 61 |hen read|ing in a|
|000002e0| 20 6e 65 77 20 74 61 70 | 65 20 62 6c 6f 63 6b 2e | new tap|e block.|
|000002f0| 20 20 43 6f 70 79 20 69 | 74 20 74 6f 20 72 65 63 | Copy i|t to rec|
|00000300| 6f 72 64 5f 73 61 76 65 | 5f 61 72 65 61 20 66 69 |ord_save|_area fi|
|00000310| 72 73 74 2c 20 61 6e 64 | 0d 20 2a 20 63 68 61 6e |rst, and|. * chan|
|00000320| 67 65 20 74 68 65 20 70 | 6f 69 6e 74 65 72 20 69 |ge the p|ointer i|
|00000330| 6e 20 2a 73 61 76 65 5f | 72 65 63 20 74 6f 20 70 |n *save_|rec to p|
|00000340| 6f 69 6e 74 20 74 6f 20 | 72 65 63 6f 72 64 5f 73 |oint to |record_s|
|00000350| 61 76 65 5f 61 72 65 61 | 2e 0d 20 2a 20 53 61 76 |ave_area|.. * Sav|
|00000360| 65 64 5f 72 65 63 6e 6f | 20 72 65 63 6f 72 64 73 |ed_recno| records|
|00000370| 20 74 68 65 20 72 65 63 | 6f 72 64 20 6e 75 6d 62 | the rec|ord numb|
|00000380| 65 72 20 61 74 20 74 68 | 65 20 74 69 6d 65 20 6f |er at th|e time o|
|00000390| 66 20 74 68 65 20 73 61 | 76 65 2e 0d 20 2a 20 54 |f the sa|ve.. * T|
|000003a0| 68 69 73 20 69 73 20 75 | 73 65 64 20 62 79 20 61 |his is u|sed by a|
|000003b0| 6e 6e 6f 66 69 6c 65 28 | 29 20 74 6f 20 70 72 69 |nnofile(|) to pri|
|000003c0| 6e 74 20 74 68 65 20 72 | 65 63 6f 72 64 20 6e 75 |nt the r|ecord nu|
|000003d0| 6d 62 65 72 20 6f 66 20 | 61 20 66 69 6c 65 27 73 |mber of |a file's|
|000003e0| 0d 20 2a 20 68 65 61 64 | 65 72 20 72 65 63 6f 72 |. * head|er recor|
|000003f0| 64 2e 0d 20 2a 2f 0d 73 | 74 61 74 69 63 20 75 6e |d.. */.s|tatic un|
|00000400| 69 6f 6e 20 72 65 63 6f | 72 64 20 2a 2a 73 61 76 |ion reco|rd **sav|
|00000410| 65 52 65 63 3b 0d 73 74 | 61 74 69 63 20 75 6e 69 |eRec;.st|atic uni|
|00000420| 6f 6e 20 72 65 63 6f 72 | 64 20 72 65 63 6f 72 64 |on recor|d record|
|00000430| 53 61 76 65 41 72 65 61 | 3b 0d 73 74 61 74 69 63 |SaveArea|;.static|
|00000440| 20 69 6e 74 09 20 20 20 | 20 73 61 76 65 64 52 65 | int. | savedRe|
|00000450| 63 6e 6f 3b 0d 0d 2f 2a | 0d 20 2a 20 52 65 63 6f |cno;../*|. * Reco|
|00000460| 72 64 20 6e 75 6d 62 65 | 72 20 6f 66 20 74 68 65 |rd numbe|r of the|
|00000470| 20 73 74 61 72 74 20 6f | 66 20 74 68 69 73 20 62 | start o|f this b|
|00000480| 6c 6f 63 6b 20 6f 66 20 | 72 65 63 6f 72 64 73 0d |lock of |records.|
|00000490| 20 2a 2f 0d 73 74 61 74 | 69 63 20 69 6e 74 09 62 | */.stat|ic int.b|
|000004a0| 61 73 65 52 65 63 3b 0d | 0d 2f 2a 0d 20 2a 20 52 |aseRec;.|./*. * R|
|000004b0| 65 74 75 72 6e 20 74 68 | 65 20 6c 6f 63 61 74 69 |eturn th|e locati|
|000004c0| 6f 6e 20 6f 66 20 74 68 | 65 20 6e 65 78 74 20 61 |on of th|e next a|
|000004d0| 76 61 69 6c 61 62 6c 65 | 20 69 6e 70 75 74 20 6f |vailable| input o|
|000004e0| 72 20 6f 75 74 70 75 74 | 20 72 65 63 6f 72 64 2e |r output| record.|
|000004f0| 0d 20 2a 2f 0d 75 6e 69 | 6f 6e 20 72 65 63 6f 72 |. */.uni|on recor|
|00000500| 64 20 2a 0d 46 69 6e 64 | 52 65 63 28 29 0d 7b 0d |d *.Find|Rec().{.|
|00000510| 09 69 66 20 28 61 72 52 | 65 63 6f 72 64 20 3d 3d |.if (arR|ecord ==|
|00000520| 20 61 72 4c 61 73 74 29 | 20 7b 0d 09 09 69 66 20 | arLast)| {...if |
|00000530| 28 46 6c 75 73 68 41 72 | 63 68 69 76 65 28 29 29 |(FlushAr|chive())|
|00000540| 0d 09 09 09 72 65 74 75 | 72 6e 28 28 75 6e 69 6f |....retu|rn((unio|
|00000550| 6e 20 72 65 63 6f 72 64 | 20 2a 29 20 6e 69 6c 29 |n record| *) nil)|
|00000560| 3b 0d 09 09 09 0d 09 09 | 69 66 20 28 61 72 52 65 |;.......|if (arRe|
|00000570| 63 6f 72 64 20 3d 3d 20 | 61 72 4c 61 73 74 29 0d |cord == |arLast).|
|00000580| 09 09 09 72 65 74 75 72 | 6e 28 28 75 6e 69 6f 6e |...retur|n((union|
|00000590| 20 72 65 63 6f 72 64 20 | 2a 29 20 6e 69 6c 29 3b | record |*) nil);|
|000005a0| 09 2f 2a 20 45 4f 46 20 | 2a 2f 0d 09 7d 0d 0d 09 |./* EOF |*/..}...|
|000005b0| 72 65 74 75 72 6e 28 61 | 72 52 65 63 6f 72 64 29 |return(a|rRecord)|
|000005c0| 3b 0d 7d 0d 0d 2f 2a 0d | 20 2a 20 49 6e 64 69 63 |;.}../*.| * Indic|
|000005d0| 61 74 65 20 74 68 61 74 | 20 77 65 20 68 61 76 65 |ate that| we have|
|000005e0| 20 75 73 65 64 20 61 6c | 6c 20 72 65 63 6f 72 64 | used al|l record|
|000005f0| 73 20 75 70 20 74 68 72 | 75 20 74 68 65 20 61 72 |s up thr|u the ar|
|00000600| 67 75 6d 65 6e 74 2e 0d | 20 2a 20 28 73 68 6f 75 |gument..| * (shou|
|00000610| 6c 64 20 74 68 65 20 61 | 72 67 20 68 61 76 65 20 |ld the a|rg have |
|00000620| 61 6e 20 6f 66 66 2d 62 | 79 2d 31 3f 20 58 58 58 |an off-b|y-1? XXX|
|00000630| 20 46 49 58 4d 45 29 0d | 20 2a 2f 0d 76 6f 69 64 | FIXME).| */.void|
|00000640| 0d 55 73 65 52 65 63 28 | 72 65 63 29 0d 75 6e 69 |.UseRec(|rec).uni|
|00000650| 6f 6e 20 72 65 63 6f 72 | 64 20 2a 72 65 63 3b 0d |on recor|d *rec;.|
|00000660| 7b 0d 09 77 68 69 6c 65 | 20 28 72 65 63 20 3e 3d |{..while| (rec >=|
|00000670| 20 61 72 52 65 63 6f 72 | 64 29 0d 09 09 61 72 52 | arRecor|d)...arR|
|00000680| 65 63 6f 72 64 2b 2b 3b | 0d 09 2f 2a 0d 09 20 2a |ecord++;|../*.. *|
|00000690| 20 44 6f 20 4e 4f 54 20 | 66 6c 75 73 68 20 74 68 | Do NOT |flush th|
|000006a0| 65 20 61 72 63 68 69 76 | 65 20 68 65 72 65 2e 20 |e archiv|e here. |
|000006b0| 20 49 66 20 77 65 20 64 | 6f 2c 20 74 68 65 20 73 | If we d|o, the s|
|000006c0| 61 6d 65 0d 09 20 2a 20 | 61 72 67 75 6d 65 6e 74 |ame.. * |argument|
|000006d0| 20 74 6f 20 75 73 65 72 | 65 63 28 29 20 63 6f 75 | to user|ec() cou|
|000006e0| 6c 64 20 6d 65 61 6e 20 | 74 68 65 20 6e 65 78 74 |ld mean |the next|
|000006f0| 20 72 65 63 6f 72 64 20 | 28 69 66 20 74 68 65 0d | record |(if the.|
|00000700| 09 20 2a 20 69 6e 70 75 | 74 20 62 6c 6f 63 6b 20 |. * inpu|t block |
|00000710| 69 73 20 65 78 61 63 74 | 6c 79 20 6f 6e 65 20 72 |is exact|ly one r|
|00000720| 65 63 6f 72 64 20 6c 6f | 6e 67 29 2c 20 77 68 69 |ecord lo|ng), whi|
|00000730| 63 68 20 69 73 20 6e 6f | 74 20 77 68 61 74 0d 09 |ch is no|t what..|
|00000740| 20 2a 20 69 73 20 69 6e | 74 65 6e 64 65 64 2e 0d | * is in|tended..|
|00000750| 09 20 2a 2f 0d 09 69 66 | 20 28 61 72 52 65 63 6f |. */..if| (arReco|
|00000760| 72 64 20 3e 20 61 72 4c | 61 73 74 29 20 7b 0d 09 |rd > arL|ast) {..|
|00000770| 09 50 67 6d 41 6c 65 72 | 74 28 22 5c 70 55 73 65 |.PgmAler|t("\pUse|
|00000780| 52 65 63 22 2c 20 22 5c | 70 61 72 52 65 63 6f 72 |Rec", "\|parRecor|
|00000790| 64 20 3e 20 61 72 4c 61 | 73 74 22 2c 20 6e 69 6c |d > arLa|st", nil|
|000007a0| 29 3b 0d 09 09 72 65 74 | 75 72 6e 3b 0d 09 7d 0d |);...ret|urn;..}.|
|000007b0| 7d 0d 0d 2f 2a 0d 20 2a | 20 52 65 74 75 72 6e 20 |}../*. *| Return |
|000007c0| 61 20 70 6f 69 6e 74 65 | 72 20 74 6f 20 74 68 65 |a pointe|r to the|
|000007d0| 20 65 6e 64 20 6f 66 20 | 74 68 65 20 63 75 72 72 | end of |the curr|
|000007e0| 65 6e 74 20 72 65 63 6f | 72 64 73 20 62 75 66 66 |ent reco|rds buff|
|000007f0| 65 72 2e 0d 20 2a 20 41 | 6c 6c 20 74 68 65 20 73 |er.. * A|ll the s|
|00000800| 70 61 63 65 20 62 65 74 | 77 65 65 6e 20 66 69 6e |pace bet|ween fin|
|00000810| 64 72 65 63 28 29 20 61 | 6e 64 20 65 6e 64 6f 66 |drec() a|nd endof|
|00000820| 72 65 63 73 28 29 20 69 | 73 20 61 76 61 69 6c 61 |recs() i|s availa|
|00000830| 62 6c 65 0d 20 2a 20 66 | 6f 72 20 66 69 6c 6c 69 |ble. * f|or filli|
|00000840| 6e 67 20 77 69 74 68 20 | 64 61 74 61 2c 20 6f 72 |ng with |data, or|
|00000850| 20 74 61 6b 69 6e 67 20 | 64 61 74 61 20 66 72 6f | taking |data fro|
|00000860| 6d 2e 0d 20 2a 2f 0d 75 | 6e 69 6f 6e 20 72 65 63 |m.. */.u|nion rec|
|00000870| 6f 72 64 20 2a 0d 45 6e | 64 4f 66 52 65 63 73 28 |ord *.En|dOfRecs(|
|00000880| 29 0d 7b 0d 09 72 65 74 | 75 72 6e 28 61 72 4c 61 |).{..ret|urn(arLa|
|00000890| 73 74 29 3b 0d 7d 0d 0d | 2f 2a 0d 20 2a 20 4f 70 |st);.}..|/*. * Op|
|000008a0| 65 6e 20 61 6e 20 61 72 | 63 68 69 76 65 20 66 69 |en an ar|chive fi|
|000008b0| 6c 65 2e 20 20 54 68 65 | 20 61 72 67 75 6d 65 6e |le. The| argumen|
|000008c0| 74 20 73 70 65 63 69 66 | 69 65 73 20 77 68 65 74 |t specif|ies whet|
|000008d0| 68 65 72 20 77 65 20 61 | 72 65 0d 20 2a 20 72 65 |her we a|re. * re|
|000008e0| 61 64 69 6e 67 20 6f 72 | 20 77 72 69 74 69 6e 67 |ading or| writing|
|000008f0| 2e 0d 20 2a 2f 0d 42 6f | 6f 6c 65 61 6e 0d 4f 70 |.. */.Bo|olean.Op|
|00000900| 65 6e 41 72 63 68 69 76 | 65 28 72 65 61 64 29 0d |enArchiv|e(read).|
|00000910| 69 6e 74 09 72 65 61 64 | 3b 0d 7b 0d 09 4f 53 45 |int.read|;.{..OSE|
|00000920| 72 72 09 65 72 72 3b 0d | 09 63 68 61 72 09 2a 72 |rr.err;.|.char.*r|
|00000930| 6f 75 74 69 6e 65 20 3d | 20 22 5c 70 4f 70 65 6e |outine =| "\pOpen|
|00000940| 41 72 63 68 69 76 65 22 | 3b 0d 0d 09 2f 2a 0d 09 |Archive"|;.../*..|
|00000950| 20 2a 20 47 65 74 20 61 | 20 62 6c 6f 63 6b 20 62 | * Get a| block b|
|00000960| 75 66 66 65 72 20 66 6f | 72 20 75 73 65 20 6c 61 |uffer fo|r use la|
|00000970| 74 65 72 0d 09 20 2a 2f | 0d 09 61 72 42 6c 6f 63 |ter.. */|..arBloc|
|00000980| 6b 20 3d 20 28 75 6e 69 | 6f 6e 20 72 65 63 6f 72 |k = (uni|on recor|
|00000990| 64 20 2a 29 20 4e 65 77 | 50 74 72 28 28 53 69 7a |d *) New|Ptr((Siz|
|000009a0| 65 29 20 62 6c 6f 63 6b | 53 69 7a 65 29 3b 0d 09 |e) block|Size);..|
|000009b0| 69 66 20 28 61 72 42 6c | 6f 63 6b 20 3d 3d 20 6e |if (arBl|ock == n|
|000009c0| 69 6c 29 20 7b 0d 09 09 | 4f 53 41 6c 65 72 74 28 |il) {...|OSAlert(|
|000009d0| 72 6f 75 74 69 6e 65 2c | 20 22 5c 70 4e 65 77 50 |routine,| "\pNewP|
|000009e0| 74 72 22 2c 20 22 5c 70 | 61 72 42 6c 6f 63 6b 22 |tr", "\p|arBlock"|
|000009f0| 2c 20 4d 65 6d 45 72 72 | 6f 72 28 29 29 3b 0d 09 |, MemErr|or());..|
|00000a00| 09 72 65 74 75 72 6e 28 | 74 72 75 65 29 3b 0d 09 |.return(|true);..|
|00000a10| 7d 0d 0d 09 61 72 52 65 | 63 6f 72 64 20 3d 20 61 |}...arRe|cord = a|
|00000a20| 72 42 6c 6f 63 6b 3b 0d | 09 61 72 4c 61 73 74 20 |rBlock;.|.arLast |
|00000a30| 20 20 3d 20 61 72 42 6c | 6f 63 6b 20 2b 20 62 6c | = arBl|ock + bl|
|00000a40| 6f 63 6b 69 6e 67 3b 0d | 0d 09 2f 2a 0d 09 20 2a |ocking;.|../*.. *|
|00000a50| 20 54 72 79 20 61 6e 64 | 20 6f 70 65 6e 20 74 68 | Try and| open th|
|00000a60| 65 20 61 72 63 68 69 76 | 65 20 66 69 6c 65 2e 0d |e archiv|e file..|
|00000a70| 09 20 2a 2f 0d 09 69 66 | 20 28 72 65 61 64 29 20 |. */..if| (read) |
|00000a80| 7b 0d 09 09 65 72 72 20 | 3d 20 46 53 4f 70 65 6e |{...err |= FSOpen|
|00000a90| 28 61 72 4e 61 6d 65 2c | 20 61 72 56 52 65 66 4e |(arName,| arVRefN|
|00000aa0| 75 6d 2c 20 26 61 72 63 | 68 69 76 65 29 3b 0d 0d |um, &arc|hive);..|
|00000ab0| 09 7d 20 65 6c 73 65 20 | 7b 0d 09 09 65 72 72 20 |.} else |{...err |
|00000ac0| 3d 20 43 72 65 61 74 65 | 28 61 72 4e 61 6d 65 2c |= Create|(arName,|
|00000ad0| 20 61 72 56 52 65 66 4e | 75 6d 2c 20 28 4f 53 54 | arVRefN|um, (OST|
|00000ae0| 79 70 65 29 27 54 41 52 | 20 27 2c 20 28 4f 53 54 |ype)'TAR| ', (OST|
|00000af0| 79 70 65 29 27 54 41 52 | 46 27 29 3b 0d 09 09 69 |ype)'TAR|F');...i|
|00000b00| 66 20 28 28 65 72 72 20 | 3d 3d 20 6e 6f 45 72 72 |f ((err |== noErr|
|00000b10| 29 20 7c 7c 20 28 65 72 | 72 20 3d 3d 20 64 75 70 |) || (er|r == dup|
|00000b20| 46 4e 45 72 72 29 29 20 | 7b 0d 09 09 09 65 72 72 |FNErr)) |{....err|
|00000b30| 20 3d 20 46 53 4f 70 65 | 6e 28 61 72 4e 61 6d 65 | = FSOpe|n(arName|
|00000b40| 2c 20 61 72 56 52 65 66 | 4e 75 6d 2c 20 26 61 72 |, arVRef|Num, &ar|
|00000b50| 63 68 69 76 65 29 3b 0d | 09 09 7d 0d 09 7d 0d 0d |chive);.|..}..}..|
|00000b60| 09 69 66 20 28 65 72 72 | 20 21 3d 20 6e 6f 45 72 |.if (err| != noEr|
|00000b70| 72 29 20 7b 0d 09 09 4f | 53 41 6c 65 72 74 28 72 |r) {...O|SAlert(r|
|00000b80| 6f 75 74 69 6e 65 2c 20 | 22 5c 70 46 53 4f 70 65 |outine, |"\pFSOpe|
|00000b90| 6e 20 6f 72 20 46 53 43 | 72 65 61 74 65 22 2c 20 |n or FSC|reate", |
|00000ba0| 61 72 4e 61 6d 65 2c 20 | 65 72 72 29 3b 0d 09 09 |arName, |err);...|
|00000bb0| 44 69 73 70 6f 73 50 74 | 72 28 28 50 74 72 29 20 |DisposPt|r((Ptr) |
|00000bc0| 61 72 42 6c 6f 63 6b 29 | 3b 0d 09 09 61 72 63 68 |arBlock)|;...arch|
|00000bd0| 69 76 65 20 3d 20 30 3b | 0d 09 09 72 65 74 75 72 |ive = 0;|...retur|
|00000be0| 6e 28 74 72 75 65 29 3b | 0d 09 7d 0d 0d 09 69 66 |n(true);|..}...if|
|00000bf0| 20 28 21 72 65 61 64 20 | 26 26 20 28 28 65 72 72 | (!read |&& ((err|
|00000c00| 20 3d 20 53 65 74 45 4f | 46 28 61 72 63 68 69 76 | = SetEO|F(archiv|
|00000c10| 65 2c 20 30 4c 29 29 20 | 21 3d 20 6e 6f 45 72 72 |e, 0L)) |!= noErr|
|00000c20| 29 29 20 7b 0d 09 09 4f | 53 41 6c 65 72 74 28 72 |)) {...O|SAlert(r|
|00000c30| 6f 75 74 69 6e 65 2c 20 | 22 5c 70 53 65 74 45 4f |outine, |"\pSetEO|
|00000c40| 46 22 2c 20 61 72 4e 61 | 6d 65 2c 20 65 72 72 29 |F", arNa|me, err)|
|00000c50| 3b 0d 09 09 44 69 73 70 | 6f 73 50 74 72 28 28 50 |;...Disp|osPtr((P|
|00000c60| 74 72 29 20 61 72 42 6c | 6f 63 6b 29 3b 0d 09 09 |tr) arBl|ock);...|
|00000c70| 61 72 63 68 69 76 65 20 | 3d 20 30 3b 0d 09 09 72 |archive |= 0;...r|
|00000c80| 65 74 75 72 6e 28 74 72 | 75 65 29 3b 0d 09 7d 0d |eturn(tr|ue);..}.|
|00000c90| 09 0d 09 61 72 52 65 61 | 64 69 6e 67 20 3d 20 72 |...arRea|ding = r|
|00000ca0| 65 61 64 3b 0d 09 69 66 | 20 28 72 65 61 64 29 20 |ead;..if| (read) |
|00000cb0| 7b 0d 09 09 61 72 4c 61 | 73 74 20 3d 20 61 72 42 |{...arLa|st = arB|
|00000cc0| 6c 6f 63 6b 3b 09 09 2f | 2a 20 53 65 74 20 75 70 |lock;../|* Set up|
|00000cd0| 20 66 6f 72 20 31 73 74 | 20 62 6c 6f 63 6b 20 3d | for 1st| block =|
|00000ce0| 20 23 20 30 20 2a 2f 0d | 09 09 46 6c 75 73 68 41 | # 0 */.|..FlushA|
|00000cf0| 72 63 68 69 76 65 28 29 | 3b 0d 09 7d 0d 0d 09 72 |rchive()|;..}...r|
|00000d00| 65 74 75 72 6e 28 66 61 | 6c 73 65 29 3b 0d 7d 0d |eturn(fa|lse);.}.|
|00000d10| 0d 2f 2a 0d 20 2a 20 52 | 65 6d 65 6d 62 65 72 20 |./*. * R|emember |
|00000d20| 61 20 75 6e 69 6f 6e 20 | 72 65 63 6f 72 64 20 2a |a union |record *|
|00000d30| 20 61 73 20 70 6f 69 6e | 74 69 6e 67 20 74 6f 20 | as poin|ting to |
|00000d40| 73 6f 6d 65 74 68 69 6e | 67 20 74 68 61 74 20 77 |somethin|g that w|
|00000d50| 65 0d 20 2a 20 6e 65 65 | 64 20 74 6f 20 6b 65 65 |e. * nee|d to kee|
|00000d60| 70 20 77 68 65 6e 20 72 | 65 61 64 69 6e 67 20 6f |p when r|eading o|
|00000d70| 6e 77 61 72 64 20 69 6e | 20 74 68 65 20 66 69 6c |nward in| the fil|
|00000d80| 65 2e 20 20 4f 6e 6c 79 | 20 6f 6e 65 20 73 75 63 |e. Only| one suc|
|00000d90| 68 0d 20 2a 20 74 68 69 | 6e 67 20 63 61 6e 20 62 |h. * thi|ng can b|
|00000da0| 65 20 72 65 6d 65 6d 62 | 65 72 65 64 20 61 74 20 |e rememb|ered at |
|00000db0| 6f 6e 63 65 2c 20 61 6e | 64 20 69 74 20 6f 6e 6c |once, an|d it onl|
|00000dc0| 79 20 77 6f 72 6b 73 20 | 77 68 65 6e 20 72 65 61 |y works |when rea|
|00000dd0| 64 69 6e 67 0d 20 2a 20 | 61 6e 20 61 72 63 68 69 |ding. * |an archi|
|00000de0| 76 65 2e 0d 20 2a 2f 0d | 53 61 76 65 52 65 63 28 |ve.. */.|SaveRec(|
|00000df0| 70 6f 69 6e 74 65 72 29 | 0d 75 6e 69 6f 6e 20 72 |pointer)|.union r|
|00000e00| 65 63 6f 72 64 09 2a 2a | 70 6f 69 6e 74 65 72 3b |ecord.**|pointer;|
|00000e10| 0d 7b 0d 09 73 61 76 65 | 52 65 63 20 3d 20 70 6f |.{..save|Rec = po|
|00000e20| 69 6e 74 65 72 3b 0d 09 | 73 61 76 65 64 52 65 63 |inter;..|savedRec|
|00000e30| 6e 6f 20 3d 20 62 61 73 | 65 52 65 63 20 2b 20 61 |no = bas|eRec + a|
|00000e40| 72 52 65 63 6f 72 64 20 | 2d 20 61 72 42 6c 6f 63 |rRecord |- arBloc|
|00000e50| 6b 3b 0d 7d 0d 0d 2f 2a | 0d 20 2a 20 50 65 72 66 |k;.}../*|. * Perf|
|00000e60| 6f 72 6d 20 61 20 77 72 | 69 74 65 20 74 6f 20 66 |orm a wr|ite to f|
|00000e70| 6c 75 73 68 20 74 68 65 | 20 62 75 66 66 65 72 2e |lush the| buffer.|
|00000e80| 0d 20 2a 2f 0d 42 6f 6f | 6c 65 61 6e 0d 46 6c 57 |. */.Boo|lean.FlW|
|00000e90| 72 69 74 65 28 29 0d 7b | 0d 09 4f 53 45 72 72 09 |rite().{|..OSErr.|
|00000ea0| 65 72 72 3b 0d 09 6c 6f | 6e 67 09 63 6f 75 6e 74 |err;..lo|ng.count|
|00000eb0| 3b 0d 0d 09 63 6f 75 6e | 74 20 3d 20 62 6c 6f 63 |;...coun|t = bloc|
|00000ec0| 6b 53 69 7a 65 3b 0d 09 | 65 72 72 20 3d 20 46 53 |kSize;..|err = FS|
|00000ed0| 57 72 69 74 65 28 61 72 | 63 68 69 76 65 2c 20 26 |Write(ar|chive, &|
|00000ee0| 63 6f 75 6e 74 2c 20 61 | 72 42 6c 6f 63 6b 2d 3e |count, a|rBlock->|
|00000ef0| 63 68 61 72 70 74 72 29 | 3b 0d 09 69 66 20 28 28 |charptr)|;..if ((|
|00000f00| 65 72 72 20 3d 3d 20 6e | 6f 45 72 72 29 20 26 26 |err == n|oErr) &&|
|00000f10| 20 28 63 6f 75 6e 74 20 | 3d 3d 20 62 6c 6f 63 6b | (count |== block|
|00000f20| 53 69 7a 65 29 29 0d 09 | 09 72 65 74 75 72 6e 28 |Size))..|.return(|
|00000f30| 66 61 6c 73 65 29 3b 0d | 0d 09 69 66 20 28 28 63 |false);.|..if ((c|
|00000f40| 6f 75 6e 74 20 21 3d 20 | 62 6c 6f 63 6b 53 69 7a |ount != |blockSiz|
|00000f50| 65 29 20 7c 7c 20 28 65 | 72 72 20 3d 3d 20 64 73 |e) || (e|rr == ds|
|00000f60| 6b 46 75 6c 45 72 72 29 | 29 0d 09 09 44 46 41 6c |kFulErr)|)...DFAl|
|00000f70| 65 72 74 28 29 3b 0d 09 | 65 6c 73 65 0d 09 09 4f |ert();..|else...O|
|00000f80| 53 41 6c 65 72 74 28 22 | 5c 70 46 4c 57 72 69 74 |SAlert("|\pFLWrit|
|00000f90| 65 22 2c 20 22 5c 70 46 | 53 57 72 69 74 65 22 2c |e", "\pF|SWrite",|
|00000fa0| 20 22 5c 70 41 72 63 68 | 69 76 65 20 77 72 69 74 | "\pArch|ive writ|
|00000fb0| 65 22 2c 20 65 72 72 29 | 3b 0d 09 09 0d 09 72 65 |e", err)|;.....re|
|00000fc0| 74 75 72 6e 28 74 72 75 | 65 29 3b 0d 7d 0d 0d 2f |turn(tru|e);.}../|
|00000fd0| 2a 0d 20 2a 20 50 65 72 | 66 6f 72 6d 20 61 20 72 |*. * Per|form a r|
|00000fe0| 65 61 64 20 74 6f 20 66 | 6c 75 73 68 20 74 68 65 |ead to f|lush the|
|00000ff0| 20 62 75 66 66 65 72 2e | 0d 20 2a 2f 0d 42 6f 6f | buffer.|. */.Boo|
|00001000| 6c 65 61 6e 0d 46 6c 52 | 65 61 64 28 29 0d 7b 0d |lean.FlR|ead().{.|
|00001010| 09 4f 53 45 72 72 09 65 | 72 72 3b 09 09 2f 2a 20 |.OSErr.e|rr;../* |
|00001020| 52 65 73 75 6c 74 20 66 | 72 6f 6d 20 73 79 73 74 |Result f|rom syst|
|00001030| 65 6d 20 63 61 6c 6c 20 | 2a 2f 0d 09 6c 6f 6e 67 |em call |*/..long|
|00001040| 09 63 6f 75 6e 74 3b 0d | 09 69 6e 74 09 6c 65 66 |.count;.|.int.lef|
|00001050| 74 3b 09 09 2f 2a 20 42 | 79 74 65 73 20 6c 65 66 |t;../* B|ytes lef|
|00001060| 74 20 2a 2f 0d 09 63 68 | 61 72 09 2a 6d 6f 72 65 |t */..ch|ar.*more|
|00001070| 3b 09 09 2f 2a 20 50 6f | 69 6e 74 65 72 20 74 6f |;../* Po|inter to|
|00001080| 20 6e 65 78 74 20 62 79 | 74 65 20 74 6f 20 72 65 | next by|te to re|
|00001090| 61 64 20 2a 2f 0d 09 63 | 68 61 72 09 2a 72 6f 75 |ad */..c|har.*rou|
|000010a0| 74 69 6e 65 20 3d 20 22 | 5c 70 46 6c 52 65 61 64 |tine = "|\pFlRead|
|000010b0| 22 3b 0d 0d 09 2f 2a 0d | 09 20 2a 20 49 66 20 77 |";.../*.|. * If w|
|000010c0| 65 20 61 72 65 20 61 62 | 6f 75 74 20 74 6f 20 77 |e are ab|out to w|
|000010d0| 69 70 65 20 6f 75 74 20 | 61 20 72 65 63 6f 72 64 |ipe out |a record|
|000010e0| 20 74 68 61 74 0d 09 20 | 2a 20 73 6f 6d 65 62 6f | that.. |* somebo|
|000010f0| 64 79 20 6e 65 65 64 73 | 20 74 6f 20 6b 65 65 70 |dy needs| to keep|
|00001100| 2c 20 63 6f 70 79 20 69 | 74 20 6f 75 74 20 74 6f |, copy i|t out to|
|00001110| 20 61 20 68 6f 6c 64 69 | 6e 67 0d 09 20 2a 20 61 | a holdi|ng.. * a|
|00001120| 72 65 61 20 61 6e 64 20 | 61 64 6a 75 73 74 20 73 |rea and |adjust s|
|00001130| 6f 6d 65 62 6f 64 79 27 | 73 20 70 6f 69 6e 74 65 |omebody'|s pointe|
|00001140| 72 20 74 6f 20 69 74 2e | 0d 09 20 2a 2f 0d 09 69 |r to it.|.. */..i|
|00001150| 66 20 28 73 61 76 65 52 | 65 63 20 26 26 0d 09 20 |f (saveR|ec &&.. |
|00001160| 20 20 20 2a 73 61 76 65 | 52 65 63 20 3e 3d 20 61 | *save|Rec >= a|
|00001170| 72 52 65 63 6f 72 64 20 | 26 26 0d 09 20 20 20 20 |rRecord |&&.. |
|00001180| 2a 73 61 76 65 52 65 63 | 20 3c 20 61 72 4c 61 73 |*saveRec| < arLas|
|00001190| 74 29 20 7b 0d 09 09 72 | 65 63 6f 72 64 53 61 76 |t) {...r|ecordSav|
|000011a0| 65 41 72 65 61 20 3d 20 | 2a 2a 73 61 76 65 52 65 |eArea = |**saveRe|
|000011b0| 63 3b 0d 09 09 2a 73 61 | 76 65 52 65 63 20 3d 20 |c;...*sa|veRec = |
|000011c0| 26 72 65 63 6f 72 64 53 | 61 76 65 41 72 65 61 3b |&recordS|aveArea;|
|000011d0| 0d 09 7d 0d 0d 09 63 6f | 75 6e 74 20 3d 20 62 6c |..}...co|unt = bl|
|000011e0| 6f 63 6b 53 69 7a 65 3b | 0d 09 65 72 72 20 3d 20 |ockSize;|..err = |
|000011f0| 46 53 52 65 61 64 28 61 | 72 63 68 69 76 65 2c 20 |FSRead(a|rchive, |
|00001200| 26 63 6f 75 6e 74 2c 20 | 61 72 42 6c 6f 63 6b 2d |&count, |arBlock-|
|00001210| 3e 63 68 61 72 70 74 72 | 29 3b 0d 09 69 66 20 28 |>charptr|);..if (|
|00001220| 28 65 72 72 20 3d 3d 20 | 6e 6f 45 72 72 29 20 26 |(err == |noErr) &|
|00001230| 26 20 28 63 6f 75 6e 74 | 20 3d 3d 20 62 6c 6f 63 |& (count| == bloc|
|00001240| 6b 53 69 7a 65 29 29 0d | 09 09 72 65 74 75 72 6e |kSize)).|..return|
|00001250| 28 66 61 6c 73 65 29 3b | 0d 0d 09 65 6c 73 65 20 |(false);|...else |
|00001260| 69 66 20 28 28 65 72 72 | 20 21 3d 20 6e 6f 45 72 |if ((err| != noEr|
|00001270| 72 29 20 26 26 20 28 65 | 72 72 20 21 3d 20 65 6f |r) && (e|rr != eo|
|00001280| 66 45 72 72 29 29 20 7b | 0d 09 09 4f 53 41 6c 65 |fErr)) {|...OSAle|
|00001290| 72 74 28 22 5c 70 52 65 | 61 64 45 72 72 6f 72 22 |rt("\pRe|adError"|
|000012a0| 2c 20 22 5c 70 46 53 52 | 65 61 64 22 2c 20 22 5c |, "\pFSR|ead", "\|
|000012b0| 70 41 72 63 68 69 76 65 | 20 72 65 61 64 22 2c 20 |pArchive| read", |
|000012c0| 65 72 72 29 3b 0d 09 09 | 72 65 74 75 72 6e 28 74 |err);...|return(t|
|000012d0| 72 75 65 29 3b 0d 09 7d | 0d 0d 09 6d 6f 72 65 20 |rue);..}|...more |
|000012e0| 3d 20 61 72 42 6c 6f 63 | 6b 2d 3e 63 68 61 72 70 |= arBloc|k->charp|
|000012f0| 74 72 20 2b 20 63 6f 75 | 6e 74 3b 0d 09 6c 65 66 |tr + cou|nt;..lef|
|00001300| 74 20 3d 20 62 6c 6f 63 | 6b 53 69 7a 65 20 2d 20 |t = bloc|kSize - |
|00001310| 63 6f 75 6e 74 3b 0d 0d | 61 67 61 69 6e 3a 0d 09 |count;..|again:..|
|00001320| 69 66 20 28 30 20 3d 3d | 20 28 28 28 75 6e 73 69 |if (0 ==| (((unsi|
|00001330| 67 6e 65 64 29 6c 65 66 | 74 29 20 25 20 52 45 43 |gned)lef|t) % REC|
|00001340| 4f 52 44 53 49 5a 45 29 | 29 20 7b 0d 09 09 2f 2a |ORDSIZE)|) {.../*|
|00001350| 20 46 49 58 4d 45 2c 20 | 66 6f 72 20 73 69 7a 65 | FIXME, |for size|
|00001360| 3d 30 2c 20 6d 75 6c 74 | 69 20 76 6f 6c 20 73 75 |=0, mult|i vol su|
|00001370| 70 70 6f 72 74 20 2a 2f | 0d 09 09 2f 2a 20 4f 6e |pport */|.../* On|
|00001380| 20 74 68 65 20 66 69 72 | 73 74 20 62 6c 6f 63 6b | the fir|st block|
|00001390| 2c 20 77 61 72 6e 20 61 | 62 6f 75 74 20 74 68 65 |, warn a|bout the|
|000013a0| 20 70 72 6f 62 6c 65 6d | 20 2a 2f 0d 09 09 69 66 | problem| */...if|
|000013b0| 20 28 21 72 65 62 6c 6f | 63 6b 20 26 26 20 62 61 | (!reblo|ck && ba|
|000013c0| 73 65 52 65 63 20 3d 3d | 20 30 29 20 7b 0d 09 09 |seRec ==| 0) {...|
|000013d0| 09 63 68 61 72 09 62 75 | 66 5b 38 30 5d 3b 0d 0d |.char.bu|f[80];..|
|000013e0| 09 09 09 73 70 72 69 6e | 74 66 28 26 62 75 66 5b |...sprin|tf(&buf[|
|000013f0| 31 5d 2c 20 22 42 6c 6f | 63 6b 73 69 7a 65 20 3d |1], "Blo|cksize =|
|00001400| 20 25 6c 64 20 72 65 63 | 6f 72 64 73 22 2c 0d 09 | %ld rec|ords",..|
|00001410| 09 09 09 09 63 6f 75 6e | 74 20 2f 20 28 6c 6f 6e |....coun|t / (lon|
|00001420| 67 29 20 52 45 43 4f 52 | 44 53 49 5a 45 29 3b 0d |g) RECOR|DSIZE);.|
|00001430| 09 09 09 62 75 66 5b 30 | 5d 20 3d 20 73 74 72 6c |...buf[0|] = strl|
|00001440| 65 6e 28 26 62 75 66 5b | 31 5d 29 3b 0d 09 09 09 |en(&buf[|1]);....|
|00001450| 50 67 6d 41 6c 65 72 74 | 28 72 6f 75 74 69 6e 65 |PgmAlert|(routine|
|00001460| 2c 20 62 75 66 2c 20 6e | 69 6c 29 3b 0d 09 09 7d |, buf, n|il);...}|
|00001470| 0d 0d 09 09 61 72 4c 61 | 73 74 20 3d 20 61 72 42 |....arLa|st = arB|
|00001480| 6c 6f 63 6b 20 2b 20 28 | 28 75 6e 73 69 67 6e 65 |lock + (|(unsigne|
|00001490| 64 29 28 62 6c 6f 63 6b | 53 69 7a 65 20 2d 20 6c |d)(block|Size - l|
|000014a0| 65 66 74 29 29 2f 52 45 | 43 4f 52 44 53 49 5a 45 |eft))/RE|CORDSIZE|
|000014b0| 3b 0d 09 09 72 65 74 75 | 72 6e 28 66 61 6c 73 65 |;...retu|rn(false|
|000014c0| 29 3b 0d 09 7d 0d 0d 09 | 69 66 20 28 72 65 62 6c |);..}...|if (rebl|
|000014d0| 6f 63 6b 29 20 7b 0d 09 | 09 2f 2a 0d 09 09 20 2a |ock) {..|./*... *|
|000014e0| 20 55 73 65 72 20 77 61 | 72 6e 65 64 20 75 73 20 | User wa|rned us |
|000014f0| 61 62 6f 75 74 20 74 68 | 69 73 2e 20 20 46 69 78 |about th|is. Fix|
|00001500| 20 75 70 2e 0d 09 09 20 | 2a 2f 0d 09 09 69 66 20 | up.... |*/...if |
|00001510| 28 6c 65 66 74 20 3e 20 | 30 29 20 7b 0d 09 09 09 |(left > |0) {....|
|00001520| 63 6f 75 6e 74 20 3d 20 | 6c 65 66 74 3b 0d 09 09 |count = |left;...|
|00001530| 09 65 72 72 20 3d 20 46 | 53 52 65 61 64 28 61 72 |.err = F|SRead(ar|
|00001540| 63 68 69 76 65 2c 20 26 | 63 6f 75 6e 74 2c 20 6d |chive, &|count, m|
|00001550| 6f 72 65 29 3b 0d 09 09 | 09 69 66 20 28 28 65 72 |ore);...|.if ((er|
|00001560| 72 20 21 3d 20 6e 6f 45 | 72 72 29 20 26 26 20 28 |r != noE|rr) && (|
|00001570| 65 72 72 20 21 3d 20 65 | 6f 66 45 72 72 29 29 20 |err != e|ofErr)) |
|00001580| 7b 0d 09 09 09 09 4f 53 | 41 6c 65 72 74 28 22 5c |{.....OS|Alert("\|
|00001590| 70 52 65 61 64 45 72 72 | 6f 72 22 2c 20 22 5c 70 |pReadErr|or", "\p|
|000015a0| 46 53 52 65 61 64 22 2c | 0d 09 09 09 09 09 09 22 |FSRead",|......."|
|000015b0| 5c 70 41 72 63 68 69 76 | 65 20 72 65 61 64 20 32 |\pArchiv|e read 2|
|000015c0| 22 2c 20 65 72 72 29 3b | 0d 09 09 09 09 72 65 74 |", err);|.....ret|
|000015d0| 75 72 6e 28 74 72 75 65 | 29 3b 0d 09 09 09 7d 0d |urn(true|);....}.|
|000015e0| 09 09 09 0d 09 09 09 69 | 66 20 28 28 63 6f 75 6e |.......i|f ((coun|
|000015f0| 74 20 3d 3d 20 30 29 20 | 7c 7c 20 28 65 72 72 20 |t == 0) ||| (err |
|00001600| 3d 20 65 6f 66 45 72 72 | 29 29 20 7b 0d 09 09 09 |= eofErr|)) {....|
|00001610| 09 50 67 6d 41 6c 65 72 | 74 28 72 6f 75 74 69 6e |.PgmAler|t(routin|
|00001620| 65 2c 20 22 5c 70 45 6f | 66 20 6e 6f 74 20 6f 6e |e, "\pEo|f not on|
|00001630| 20 62 6c 6f 63 6b 20 62 | 6f 75 6e 64 61 72 79 22 | block b|oundary"|
|00001640| 2c 0d 09 09 09 09 09 09 | 6e 69 6c 29 3b 0d 09 09 |,.......|nil);...|
|00001650| 09 09 72 65 74 75 72 6e | 28 74 72 75 65 29 3b 0d |..return|(true);.|
|00001660| 09 09 09 7d 0d 09 09 09 | 0d 09 09 09 6c 65 66 74 |...}....|....left|
|00001670| 20 2d 3d 20 63 6f 75 6e | 74 3b 0d 09 09 09 6d 6f | -= coun|t;....mo|
|00001680| 72 65 20 2b 3d 20 63 6f | 75 6e 74 3b 0d 09 09 09 |re += co|unt;....|
|00001690| 67 6f 74 6f 20 61 67 61 | 69 6e 3b 0d 09 09 7d 0d |goto aga|in;...}.|
|000016a0| 09 7d 20 65 6c 73 65 20 | 7b 0d 09 09 50 67 6d 41 |.} else |{...PgmA|
|000016b0| 6c 65 72 74 28 72 6f 75 | 74 69 6e 65 2c 20 22 5c |lert(rou|tine, "\|
|000016c0| 70 44 69 64 20 6e 6f 74 | 20 72 65 61 64 20 62 6c |pDid not| read bl|
|000016d0| 6f 63 6b 73 69 7a 65 20 | 62 79 74 65 73 22 2c 20 |ocksize |bytes", |
|000016e0| 6e 69 6c 29 3b 0d 09 09 | 72 65 74 75 72 6e 28 74 |nil);...|return(t|
|000016f0| 72 75 65 29 3b 0d 09 7d | 0d 7d 0d 0d 2f 2a 0d 20 |rue);..}|.}../*. |
|00001700| 2a 20 46 6c 75 73 68 20 | 74 68 65 20 63 75 72 72 |* Flush |the curr|
|00001710| 65 6e 74 20 62 75 66 66 | 65 72 20 74 6f 2f 66 72 |ent buff|er to/fr|
|00001720| 6f 6d 20 74 68 65 20 61 | 72 63 68 69 76 65 2e 0d |om the a|rchive..|
|00001730| 20 2a 2f 0d 42 6f 6f 6c | 65 61 6e 0d 46 6c 75 73 | */.Bool|ean.Flus|
|00001740| 68 41 72 63 68 69 76 65 | 28 29 0d 7b 0d 09 62 61 |hArchive|().{..ba|
|00001750| 73 65 52 65 63 20 2b 3d | 20 61 72 4c 61 73 74 20 |seRec +=| arLast |
|00001760| 2d 20 61 72 42 6c 6f 63 | 6b 3b 2f 2a 20 4b 65 65 |- arBloc|k;/* Kee|
|00001770| 70 20 74 72 61 63 6b 20 | 6f 66 20 62 6c 6f 63 6b |p track |of block|
|00001780| 20 23 73 20 2a 2f 0d 09 | 61 72 52 65 63 6f 72 64 | #s */..|arRecord|
|00001790| 20 3d 20 61 72 42 6c 6f | 63 6b 3b 09 09 2f 2a 20 | = arBlo|ck;../* |
|000017a0| 52 65 73 74 6f 72 65 20 | 70 6f 69 6e 74 65 72 20 |Restore |pointer |
|000017b0| 74 6f 20 73 74 61 72 74 | 20 2a 2f 0d 09 61 72 4c |to start| */..arL|
|000017c0| 61 73 74 20 3d 20 61 72 | 42 6c 6f 63 6b 20 2b 20 |ast = ar|Block + |
|000017d0| 62 6c 6f 63 6b 69 6e 67 | 3b 09 2f 2a 20 52 65 73 |blocking|;./* Res|
|000017e0| 74 6f 72 65 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 |tore poi|nter to |
|000017f0| 65 6e 64 20 2a 2f 0d 0d | 09 69 66 20 28 21 61 72 |end */..|.if (!ar|
|00001800| 52 65 61 64 69 6e 67 29 | 20 0d 09 09 72 65 74 75 |Reading)| ...retu|
|00001810| 72 6e 28 46 6c 57 72 69 | 74 65 28 29 29 3b 0d 09 |rn(FlWri|te());..|
|00001820| 65 6c 73 65 0d 09 09 72 | 65 74 75 72 6e 28 46 6c |else...r|eturn(Fl|
|00001830| 52 65 61 64 28 29 29 3b | 0d 7d 0d 0d 2f 2a 0d 20 |Read());|.}../*. |
|00001840| 2a 20 43 6c 6f 73 65 20 | 74 68 65 20 61 72 63 68 |* Close |the arch|
|00001850| 69 76 65 20 66 69 6c 65 | 2e 0d 20 2a 2f 0d 43 6c |ive file|.. */.Cl|
|00001860| 6f 73 65 41 72 63 68 69 | 76 65 28 29 0d 7b 0d 09 |oseArchi|ve().{..|
|00001870| 69 66 20 28 21 61 72 52 | 65 61 64 69 6e 67 29 0d |if (!arR|eading).|
|00001880| 09 09 28 76 6f 69 64 29 | 20 46 6c 75 73 68 41 72 |..(void)| FlushAr|
|00001890| 63 68 69 76 65 28 29 3b | 0d 0d 09 44 69 73 70 6f |chive();|...Dispo|
|000018a0| 73 50 74 72 28 28 50 74 | 72 29 20 61 72 42 6c 6f |sPtr((Pt|r) arBlo|
|000018b0| 63 6b 29 3b 0d 09 69 66 | 20 28 61 72 63 68 69 76 |ck);..if| (archiv|
|000018c0| 65 20 21 3d 20 30 29 0d | 09 09 28 76 6f 69 64 29 |e != 0).|..(void)|
|000018d0| 20 46 53 43 6c 6f 73 65 | 28 61 72 63 68 69 76 65 | FSClose|(archive|
|000018e0| 29 3b 0d 0d 09 61 72 63 | 68 69 76 65 20 3d 20 30 |);...arc|hive = 0|
|000018f0| 3b 0d 7d 0d 0d 2f 2a 0d | 20 2a 20 62 63 6f 70 79 |;.}../*.| * bcopy|
|00001900| 20 61 6e 64 20 62 7a 65 | 72 6f 20 63 6f 6d 70 61 | and bze|ro compa|
|00001910| 74 61 62 69 6c 69 74 79 | 20 72 6f 75 74 69 6e 65 |tability| routine|
|00001920| 73 2e 0d 20 2a 20 54 68 | 65 73 65 20 63 6f 75 6c |s.. * Th|ese coul|
|00001930| 64 20 28 73 68 6f 75 6c | 64 29 20 70 6f 74 65 6e |d (shoul|d) poten|
|00001940| 74 69 61 6c 6c 79 20 62 | 65 20 64 6f 6e 65 20 77 |tially b|e done w|
|00001950| 69 74 68 20 74 68 65 20 | 4d 61 63 20 74 72 61 70 |ith the |Mac trap|
|00001960| 73 2e 0d 20 2a 2f 0d 63 | 68 61 72 20 2a 0d 62 63 |s.. */.c|har *.bc|
|00001970| 6f 70 79 28 73 31 2c 20 | 73 32 2c 20 6e 29 0d 63 |opy(s1, |s2, n).c|
|00001980| 68 61 72 20 2a 73 31 2c | 20 2a 73 32 3b 0d 72 65 |har *s1,| *s2;.re|
|00001990| 67 69 73 74 65 72 20 69 | 6e 74 20 6e 3b 0d 7b 0d |gister i|nt n;.{.|
|000019a0| 09 72 65 67 69 73 74 65 | 72 20 63 68 61 72 20 2a |.registe|r char *|
|000019b0| 73 20 3d 20 73 31 3b 0d | 09 72 65 67 69 73 74 65 |s = s1;.|.registe|
|000019c0| 72 20 63 68 61 72 20 2a | 64 20 3d 20 73 32 3b 0d |r char *|d = s2;.|
|000019d0| 0d 09 77 68 69 6c 65 20 | 28 2d 2d 6e 20 3e 3d 20 |..while |(--n >= |
|000019e0| 30 29 0d 09 09 2a 64 2b | 2b 20 3d 20 2a 73 2b 2b |0)...*d+|+ = *s++|
|000019f0| 3b 0d 0d 09 72 65 74 75 | 72 6e 28 73 31 29 3b 0d |;...retu|rn(s1);.|
|00001a00| 7d 0d 0d 76 6f 69 64 0d | 62 7a 65 72 6f 20 28 73 |}..void.|bzero (s|
|00001a10| 31 2c 20 6e 29 0d 72 65 | 67 69 73 74 65 72 20 63 |1, n).re|gister c|
|00001a20| 68 61 72 20 2a 73 31 3b | 0d 72 65 67 69 73 74 65 |har *s1;|.registe|
|00001a30| 72 20 69 6e 74 20 6e 3b | 0d 7b 0d 09 77 68 69 6c |r int n;|.{..whil|
|00001a40| 65 20 28 2d 2d 6e 20 3e | 3d 20 30 29 0d 09 09 2a |e (--n >|= 0)...*|
|00001a50| 73 31 2b 2b 20 3d 20 30 | 3b 0d 7d 0d 00 00 00 00 |s1++ = 0|;.}.....|
|00001a60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001a70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001a80| 00 00 01 00 00 00 01 4c | 00 00 00 4c 00 00 00 32 |.......L|...L...2|
|00001a90| 54 61 72 0d 20 2a 0d 20 | 2a 20 4d 6f 64 69 66 69 |Tar. *. |* Modifi|
|00001aa0| 65 64 20 62 79 20 43 72 | 61 69 67 20 52 75 66 66 |ed by Cr|aig Ruff|
|00001ab0| 08 62 75 66 66 65 72 2e | 63 2e 02 00 00 00 00 00 |.buffer.|c.......|
|00001ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001ad0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001ae0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001af0| 00 00 a0 cb 8f 96 00 00 | 00 00 00 00 01 7e 20 2a |........|.....~ *|
|00001b00| 0d 20 2a 20 57 72 69 74 | 74 65 6e 20 62 79 20 4a |. * Writ|ten by J|
|00001b10| 6f 68 6e 20 47 69 6c 6d | 6f 72 65 2c 20 69 68 6e |ohn Gilm|ore, ihn|
|00001b20| 70 34 21 68 6f 70 74 6f | 61 64 21 67 6e 75 2c 20 |p4!hopto|ad!gnu, |
|00001b30| 6f 6e 20 32 35 20 41 75 | 67 75 73 74 20 31 39 38 |on 25 Au|gust 198|
|00001b40| 35 2e 0d 20 2a 0d 20 2a | 20 40 28 23 29 20 62 75 |5.. *. *| @(#) bu|
|00001b50| 66 66 65 72 2e 63 20 31 | 2e 31 34 20 31 30 2f 32 |ffer.c 1|.14 10/2|
|00001b60| 38 2f 38 36 20 50 75 62 | 6c 69 63 20 44 6f 6d 61 |8/86 Pub|lic Doma|
|00001b70| 69 6e 20 2d 20 67 6e 75 | 0d 20 2a 0d 20 2a 2f 0d |in - gnu|. *. */.|
|00001b80| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 75 73 65 |...H..Mo|naco.use|
|00001b90| 20 6f 6e 20 74 68 65 20 | 4d 61 63 69 6e 74 6f 73 | on the |Macintos|
|00001ba0| 68 2e 0d 20 2a 2f 00 06 | 00 08 00 2a 00 05 01 49 |h.. */..|...*...I|
|00001bb0| 01 f3 00 2a 00 05 01 49 | 01 f3 a0 a6 f7 dc 00 00 |...*...I|........|
|00001bc0| 01 2b 00 00 01 2b 00 00 | 00 00 01 00 00 00 01 00 |.+...+..|........|
|00001bd0| 00 00 01 4c 00 00 00 4c | 00 00 00 32 00 1a 66 0e |...L...L|...2..f.|
|00001be0| 06 fc 00 00 00 1c 00 32 | 00 00 4d 50 53 52 00 00 |.......2|..MPSR..|
|00001bf0| 00 0a 03 ed ff ff 00 00 | 00 00 00 1b a0 64 00 00 |........|.....d..|
+--------+-------------------------+-------------------------+--------+--------+