PAK File Archive Utility for OS9 Version 02.02 (c) Copyright 1987 by G.B. Janssen ALL RIGHTS RESERVED Table of Contents Introduction .................................................... 1 Using PAK ....................................................... 3 PAK commands .................................................... 4 Adding files ................................................ 4 Moving files ................................................ 4 Updating files .............................................. 4 Extracting files ............................................ 5 Removing files .............................................. 5 Printing files .............................................. 5 Testing an PAK .............................................. 5 Directory Listing ........................................... 6 Backup retention ............................................ 7 Suppress compression ......................................... 7 INTRODUCTION PAK is the copyrighted property of G.B. Janssen and is not public domain software. You may distribute it, upload it, download it, use it, etc, etc, as long as it is FREE. It may NOT be used as part of any commerical ventures, nor as a sales aid without the expressed written consent of th author. PAK Page 0001 PAK is used to create and maintain files in groups. Such groups are usually called an archive (in this document it is called a PAK). PAK automatically compresses the files being archived, so that the resulting PAK takes up a minimum amount of space. When PAK is used to add a file to an PAK it analyzes the file to determine which of four storage methods will result in the greatest savings. These four methods are: 1) Huffman squeezing; the file is compressed into variable length bit strings, similar to the method used by SQ programs found on IBM PC's. 2) No compression; the file is stored as is. NOTE.. That since this methods involves no compression at all, the PAK entry will be larger than the original file do to overhead. 3) Run-length character compression; repeated sequences of the same byte value are collapsed into a three-byte code sequence. 4) Lempel-Zev compression; the file is stored as variable size bit codes which represents character strings. PAK was developed on a Tandy COCO3 OS9 Level II system using Tandy's "C" compiler. ***** Will run on Level I and II. ***** Some notes: 1. Bugs.mge was downloaded from Delphi COCO graphics database. This is a COMPRESSED graphics picture of Bugs Bunny that is input to COLORMAX (input size=21248). Using it as a test for PAK a saving of 50% in disk storage space was obtained (output size=10575). 2. A 1,000,206 byte text file (many "C" and ASM sources merged) resulted in a 532318 byte output file, a saving of 467888 bytes (46%). 3. Using PAK to distribute text, source, binary, graphics, fonts, etc. eliminates the need for multiple transmissions. It also solves the long discussed problem of needing special protocols and programs to eliminate characters added by XMODEM. PAK ignores any chararcter added to the end-of-the-file. 4. Due to work/backup copies, the largest PAK can only be approx. 1/2 the capacity of media being used. If using a 40 track DSDD disk drive (40trk * 18 sec/trk * 256 byte/sec * 2 no. of sides = 368640 bytes) (360KB) then the maximum PAK would be about 179KB or 183296 bytes. 5. PAK uses OS9 command "rename". It must be available in the current execution directory or loaded in memory prior to executing the PAK command. When using PAK with large files or files on multiple diskettes, preload both programs ("load pak rename"), change diskettes then issue PAK command. 6. MAXIMUM input file size is 1,048,575 or $FFFFF. PAK Page 0002 USING PAK If PAK is invoked with no arguments then a brief command summary is displayed. OS9 Pak Version 02.02 (c) 1987 G.B. Janssen =============================================================================== Usage: pak -{amuexrpdltb} archive [filelist] where: a = Add files to a PAK. m = Move files to a PAK. u = Update files in a PAK. e,x = EXtract from a PAK. r = Remove files from a PAK. p = Print files from a PAK to stdout. d,l = Directory (List) of files in a PAK. t = Test integrity of files in a PAK. alter how a command works: b = retain Backup copy of PAK. s = Suppress all compression. NOTE The "B" option may be added to Add, Move, Update, Extract or Remove. The "S" option may be added to Add, Move or Update. Archive is the name of the PAK to use or build. Filelist is a list of up to 40 file names to Add, Move, Update, Extract or Remove. Commands may be in UPPER or lower case. PAK Page 0003 PAK COMMANDS This section describes each of the commands. PAK will only accept one command at a time. ADDING FILES NOTE.. Files added to the PAK retain date-last-modified for use in Update command. ...NOT DATE ADDED TO PAK... Files are added to an PAK using the "A" (Add), "M" (Move), or "U" (Update) commands. Add always adds the file. Move deletes the source file once it has been added to the PAK. Update adds the file to the PAK if not present. If present, date last modified is use to determine older of the two, which is kept in the PAK. To add the file named "JUNK.DOC" to an PAK named "TEST.PAK", you would use the command: pak a test junk.doc To move the file named "JUNK.DOC" to an PAK named "TEST.PAK", you would use the command: pak m test junk.doc To update the file named "JUNK.DOC" in an PAK named "TEST.PAK", you would use the command: pak u test junk.doc You may also add, move or update a file which is in a directory other than your current directory. pak a test /d1/mystuff/junk.doc The above commands add, move and update will accept more then one filename from the command line. pak a test junk.asm junk.doc /d0/cmds/junk PAK does not save the path name. In other words, if you specify a path when adding a file, only the actual file name is stored in the PAK. In the above example junk.asm, junk.doc and junk are the file names stored. Duplicate names may not be added to a PAK. The following example will result in an error. pak a test junk /d0/cmds/junk PAK Page 0004 EXTRACTING FILES PAK entries are extracted with the "E" (Extract) and "X" (eXtract) commands. For example, if you had an PAK named "TEST.PAK", and you wanted the file in it named "JUNK". pak e test junk OR pak x test junk If you wanted to extract all of the files in an PAK named "TEST.PAK". pak x test OR pak e test Whatever method of file compression was used in storing the files is reversed, and uncompressed copies are created in the CURRENT DIRECTORY (not in directory they were originally from). REMOVING FILES PAK entries are removed with the "R" (Remove) command. For example, if you had an PAK named "TEST.PAK", and you wished to delete an entry in it with a filename "JUNK". pak r test junk PRINTING A FILE PAK entries may printed with the "P" (Print) command. This works the same as extract except the file is written to stdout, which in turn may be redirected '>' or piped '|' as required. pak p test junk OR pak p test junk >/p OR pak p test | sort NOTE... Files are printed regardless of type (text, binary or graphics). So be careful. Also no headings/total are printed to stderr. TESTING AN PAK The integrity of an PAK may be tested by use of the "T" (Test) command. This checks to make sure that all of the entries within a PAK are in good shape. This can be very helpful for critical PAKs, where data integrity must be assured. All of the entries in the PAK are unpaked (without saving them) and the CRC value is recalculated and compared with the CRC value saved at the time the file was stored. Example, if you just downloaded an PAK named "TEST.PAK" from your favorite bulletin board, and you want to make sure that you received it properly, enter the command: pak t test PAK Page 0005 LISTING PAK ENTRIES (Directory) You can obtain a list of the contents of an PAK by using the "D" (DIR) command or the "L" (LIST) command. To see what is in an PAK named "TEST.PAK". pak l test OR pak d test OS9 Pak Version 02.02 (c) 1987 G.B. Janssen =============================================================================== Name date time --orig length- --out length-- action =============================================================================== ty_asis 04-14-86 10:05am 4 $00004 4 $00004 Asis ty_comp 05-10-88 05:41am 4081 $00FF1 50 $00032 98% Comp ty_crnc 05-14-87 06:33pm 3562 $00DEA 1893 $00765 46% Crnch ty_sqz 05-14-87 04:32pm 8192 $02000 5748 $01674 29% Sqz =============================================================================== Files (4) 15839 $03DDF 7695 $01E0F 51% Controls/overhead 1044 $00068 Total 15839 $03DDF 7799 $01E77 50% Savings 8040 $01F68 31% "Name" is the name of the file. "Date time" is the date/time the file was last modified, NOT the time when it was added to the PAK. "orig length" is the original file length in deciaml and hex. "out length" is the file length in decimal and hex as saved within the PAK. "action" various messages or percentage saved and method used to save file. Asis No compression. Comp Runs of repeated byte values are commpressed. Sqz Huffman squeeze technique employed. Crnch Lempel-Zev compression technique employed. Some totals are printed at end and are self explanitory. PAK Page 0006 BACKUP When PAK changes an PAK (during an Add, Move, Update, Remove) it builds a new PAK with the same name, but with an extension of ".TMP". When PAK is finished it deletes the original and renames the temp PAK to the original name (TEST.PAK goes away, and TEST.TMP becomes the new TEST.PAK). Among other things, this means that if anything goes wrong and PAK is unable to finish, then your original PAK will still be intact. If you wish to retain the original version of the PAK as a backup copy. You can do this easily by using the Backup option. Add the letter "B" to your command, and PAK will rename your original PAK to have an extension of ".BAK" instead of deleting it. pak ab test junk SUPPRESS COMPRESSION By adding a "S" to the Add, Move or Update commands PAK will store files "ASIS" without analyzing data. This save considerable time if you just want to store files quickly. PAK Page 0007 MODIFICATIONS TO PAK A word about version and level numbers. Version is a two digit number left of the decimal point and indicates a major revision such a new packing formula. Level is a two digit number right of the decimal point. The first decimal place (tenths) indicates a minor revision correcting small problems. The second decimal place (hundredths) indicates a trival revision for cosmetic (spelling etc.) type changes. Version 01 level 00. Original release of PAK. Version 01 level 10. Correct long int compiler problem if file greater than 64k. All storage methods compatible with previous release. Version 01 level 20. Correct unaccessable file problem when move option has error. Correct output file ending up in current directory even if full pathname given. Redo calculation for ASIS storage. Date-last-modified on extracted file same as stored date. All storage methods compatible with previous releases. Version 02 level 00. Added Lempel-Zev compression formula. Added "S" option. Files stored asis if all formulas less than 5%. Version 02 will unPAK all version 01 files. Version 01 will ***NOT*** unPAK version 02 files. PAK Page 0008