PAK The File Compression Utility Version 1.6 Copyright 1988, 1989 by NoGate Consulting P.O. Box 88115 Grand Rapids, MI 49518-0115 (616)455-6270 ALL RIGHTS RESERVED _______ ____|__ | (tm) --| | |------------------- | ____|__ | Association of | | |_| Shareware |__| o | Professionals -----| | |--------------------- |___|___| MEMBER Introduction...............................................1 Purpose of PAK.........................................1 The Shareware Concept..................................1 Registration and Benefits..............................1 Other NoGate Products..................................2 List of Files..........................................2 Using the Command Line Version Of PAK......................3 A Note on the Interface................................3 Archive Files..........................................3 Creating An Archive....................................3 The Add Command....................................3 The Move Command...................................4 The Update Command.................................4 The Freshen Command................................4 Extracting Files From An Archive.......................5 The Extract Command................................5 The Extract and Remove Command.....................5 Extracting Files to the Screen or Printer..........6 Managing Archives......................................6 Listing Files......................................6 Deleting Files.....................................7 Testing files......................................7 Adding Remarks to Archives.............................7 The /R option......................................8 The /H option......................................8 The Revise command.................................8 The Header command.................................8 Converting Archives from ARC and PKARC.................8 Options................................................9 Moving Files (/M)..................................9 Duplicate Files (/D)..............................10 Replacing Existing Files (/W).....................10 Use Remarks (/R and /H)...........................10 Crunch and Squash (/C and /S).....................11 Encrypting Files (/G).............................11 Sorting Files (/O)................................11 Pack Archives (/P)................................12 The Temporary Path (/T)...........................12 General Syntax........................................13 Summary of Standard PAK Commands......................13 Limitations...........................................14 PAKINST (PAK install program).............................14 Command Definitions...................................14 Option Definitions....................................15 Comments..............................................15 EXEMAKE (Make self-extracting archives)...................15 Appendices................................................16 Release History.......................................16 PAK's Advanced Compression............................17 Technical Notes on File Formats.......................17 Credits...............................................19 PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 1 Introduction Purpose of PAK PAK is a utility to create and maintain file archives in compressed form. There are several advantages to compressing files. On a hard disk, most files are accessed infrequently. Reducing the size of these files allows more of them to remain on the hard disk, where they are more accessible than on a floppy in a file cabinet, and frees disk space for other use. Backup is simpler, faster, and cheaper, since the files are smaller and organized into related groups. Most importantly, compressed files take less time to transmit via modem, and time is money when the transmission is long distance, or to a service such as CompuServe. Even on local computer bulletin boards, reduced transmission time is an advantage. PAK is intended as a replacement for ARC by System Enhancement Associates and PKARC by Philip Katz. While PAK is roughly 2.5 times as fast as ARC, speed is not the emphasis, and PAK does not attempt to compete with PKARC in this respect. However, PAK produces archive files that are consistently 50% to 90% of the size produced by either ARC or PKARC, and supports files created by either program. In particular, PAK handles large text files and non-text files of any length much better than the either of these programs. In addition, the full screen version is much easier to use than ARC or PKARC. The Shareware Concept PAK is distributed as shareware. Shareware is commercial software distributed in an unconventional manner. Microcomputers copy information very easily. Instead of trying to frustrate this through copy protection, shareware takes advantage of it to reach as many users as possible at the lowest cost. Anyone may copy a shareware program and distribute it to whomever they desire, provided they do not charge a fee or alter it. Shareware isn't free. Serious shareware is as polished as any conventional commercial product, and represents just as much programming effort. If you use it regularly, the authors expect compensation. However, unlike conventional distribution, shareware allows you to evaluate the product before you decide to purchase it. The price is often lower, as well, because there are no advertising, packaging, or distribution costs. But it can only work with your support. If you are still using a shareware product after a couple of weeks, then it is obviously worth something to you, and you should register it. Registration and Benefits There are three versions of the compression routines in PAK available. The first is the command line version, included in the evaluation package (of which this file is a part) distributed as PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 2 shareware. Registration of this version is $15, and entitles you to a disk with a copy of PAK registered in your name. The second is the full screen version, also known as PAKF. PAKF is a fully windowed program which displays archive contents and file directories, and allows easy tagging of files to be compressed or extracted. Registration of this version is $30, and entitles you to a disk with both the full screen and command line versions. The third, for programmers, is a library of data compression routines suitable for inclusion in your own programs. This toolkit can be used in practically any application, since all compression is done on buffers in memory, not on disk. Registration of this version is $50, and entitles you to a disk with object files suitable for use with Turbo Pascal, C, or assembler, and the other two versions of PAK, as well as example programs in Pascal and C. To register your copy of PAK, see the enclosed order form. Other NoGate Products TRI_D, a programming toolkit for three dimensional graphics, with support for wireframes and hidden surface removal. Reasonably fast and very easy to use. Includes a TPU for Turbo Pascal (4.0 or 5.0) and OBJ files for Turbo C. TRI_D is $30. CONTOUR, a utility for creating contour maps from empirical data. Quickly and accurately approximates the entire surface from relatively few data points, and then draws lines at each elevation change. Also creates AutoCad .DXF files. Primarily intended for surveyors, taking a few minutes for a process that normally takes weeks, but useful to anyone who wishes to plot three dimensional data. CONTOUR is $150. NoGate consulting also provides custom solutions in a wide variety of fields including databases, networking, simulations, and telecommuncications. Inquire for further information. List of Files Your copy of PAK16 should contain: PAK.EXE - PAK version 1.6 PAK.CNF - PAK configuration file. PAK.DOC - This documentation file. PAKINST.EXE - PAK installation program. EXEMAKE.EXE - Utility to make self-extracting archives. ORDER.FRM - Order form for registration. UPDATE.FRM - Form for updates and upgrades. SITE.FRM - Form for site licenses. STDCFG.TXT - Text file for standard configuration. ALTCFG.TXT - Text file for alternate configuration. PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 3 Using the Command Line Version Of PAK A Note on the Interface This manual describes PAK's commands as they are initially configured. Using PAKINST and the provided example files STDCFG.TXT and ALTCFG.TXT, you can easily add, change, or delete the commands and options which PAK understands. For example, if the 'A' command is too cryptic for your taste, you can change it to 'Add' or 'Compress'. The section on PAKINST describes how to change the interface. Archive Files PAK creates and modifies archive files, which have the .PAK or .ARC extension. An archive file may contain one, two, or any number of compressed files. Files in an archive retain all of the information they had in the directory, such as name, size, and date. In addition, each file in an archive has a calculated CRC number, which assures the detection of damage after events such as file transmission via modem. Creating An Archive The Add Command To create an archive, type PAK a A is the Add command, and adding files to an archive will create it if it doesn't exist. If the extension is omitted, PAK will look first for a file with the extension PAK and then for ARC. For example, if to add the file "FOO.DAT" to an archive named "BAR.PAK" (which need not already exist), type PAK a bar foo.dat The wildcard characters ? and * are also permissible, as are multiple file specifications. For example, to add all of the files ending in ".DAT" to the same archive, and all of the files named "TURBO" with any extension, type PAK a bar *.dat turbo.* Specifying a subdirectory will add all of the files in that subdirectory. For example, PAK a bak \c\lib would add all of the files in the "\c\lib" directory to the archive "BAK.PAK", provided that "\c\lib" was a subdirectory. Of course, if "\c\lib" were simply a file, it would be added like any other file. PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 4 If you omit the file name, PAK assumes you mean "*.*", or all of the files in the directory. The Move Command The Add command copies files to an archive, and leaves the originals intact. The Move command also copies files to an archive, but deletes the originals when the operation is successfully completed. Using the Move command is very similar to the Add command. To move a file or files, type PAK m The Update Command If a file specified in an Add or Move command has the same name as a file already in the archive, PAK will ask if you wish to replace the old file. The Update command behaves much as the Add command does, except that it replaces existing archived files automatically if they have an older date, and does not replace newer files. To update a file or files, type PAK u For example, suppose NEW1.DAT and NEW2.DAT existed in the archive "SAVE.PAK", that the copy of NEW1.DAT in the archive was older than the one on the disk, and that NEW3.DAT existed on the disk but not in the archive. Then PAK u save new1.dat new2.dat new3.dat would add "NEW1.DAT" and "NEW3.DAT" to "SAVE.PAK". The Freshen Command The Freshen command is very similar to the Update command, except that it only checks files which already exist in the archive. To freshen files in an archive, type PAK f For example, PAK f total *.* would check every file in the archive "TOTAL.PAK" and freshen any which were older than those on the disk. Note that the "*.*" in the above example is optional; if you omit the file list, PAK assumes you intended all files in the directory. PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 5 Extracting Files From An Archive The Extract Command To copy files from an existing archive to the disk, type PAK e For example, to unpack all of the files from the archive "GAME.PAK", type PAK e game Again, PAK assumes that you mean all of the files in the archive if you omit the file names to be extracted. If one of the files to be extracted already exists, PAK will stop and ask if you intend to replace the existing file. When using any command which does involve compression (i.e., the Add, Move, Update and Freshen commands), you can use wildcards in specifying the archive name. For example, PAK e ch* *.doc would extract all of the files with the extension .DOC from all of the archives starting with the letters CH. As usual, PAK will provide .PAK and .ARC if you omit the extension. Extracting files to one or more remote subdirectories is much like adding them from other subdirectories. For example, PAK e project \c\objects\*.obj \c\source\*.c would extract all of the files with the extension .OBJ to the \C\OBJECTS directory, and all the files with the extension .C to the \C\SOURCE directory. The Extract and Remove Command Sometimes you may wish to move files out of an archive rather than simply copying them. To do this, type PAK x The X command is like the Extract command in all ways except that it deletes the files from the archive after unpacking them. If this removes all of the files from the archive, leaving it empty, it also deletes the archive. PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 6 Extracting Files to the Screen or Printer You can also extract files to the standard output, which is normally the screen. To do so, type PAK p Anything sent to the standard output can be re-directed to a file, some other programs, or to the printer. For example, PAK p docs >prn: would extract all of the files from the archive DOCS and send them to the printer. For other uses of redirection, consult your DOS manual. Managing Archives Listing Files Both the L and V commands display a list of files, the original sizes, and the file dates, in much the same format as the MSDOS DIR command. In addition, they display the type of compression, compression ratio, the compressed size, time, and CRC checksum. There is no difference between the two commands. Both L and V are provided for the convenience of those used to PAK 1.0. There are 7 compression types, created variously by ARC, PKARC, and PAK. PAK can extract files compressed with any of these, and compress new files with the Crunched, Squashed, or Crushed types. -- No compression. Used by ARC, PKARC, PAK. Packed Repeated byte values replaced by codes. Used by ARC. Squeezed Huffman encoding, used by ARC 5.20 and earlier. crunched Lempel-Zev compression, used by ARC 4.5 and earlier. Crunched Lempel-Zev compression, used by ARC 5.0 and later. Squashed Lempel-Zev compression, used by PKARC. Crushed Lempel-Zev compression, used only by PAK. PAK uses the CRC checksum to verify that the file is intact. PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 7 Deleting Files Sometimes you may wish to remove files from an archive, either because they were added accidently or because they are no longer useful. To delete files from an archive, type PAK d For example, PAK d junk *.tmp would delete all the files ending in the ".TMP" extension from the archive "JUNK.PAK". PAK can ask for confimation before deleting each file. To enable this option, type PAK d /WP Testing files Sometimes the integrity of an archive (or any other file) is suspect, such as after transmission by modem or after physical disk damage. The Test command checks all the specified files to insure that they are intact. For example, to test the archive "POKER.PAK" which you have just downloaded from a BBS, type PAK t poker PAK can also test multiple archives this way: PAK t *.pak would test all of the archives ending in the .PAK extension. If, for some reason, you wish to test only some of the files, you may specify a list of files, much as you can for any other command. For example, PAK t *.pak *.doc will test only files ending in the .DOC extension. Adding Remarks to Archives PAK 1.6 supports variable length remarks for each file in an archive, and for the archive as a whole. While there is no inherent limitation to the length of a remark, PAK 1.6 currently only provides commands to handle single-line remarks of at most 55 characters. PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 8 The /R option Adding the /R option to any other command (such as Add or List) will enable remarks. For example, PAK a /r saved *.pas will add all the files with the extension .PAS to the archive SAVED, and ask for the remark for each new file. PAK l /r saved would then include those remarks with the list of files in the archive. The /H option Adding the /H option to any other command will enable the remark at the head of an archive. In all other ways it is like the /R option. The Revise command Sometimes you may wish to change the remarks in an archive. Typing PAK r saved *.doc will first display the archive remark, and then display the files with the extension .DOC one at a time, and ask for the new remark for each. If you wish to keep the existing remark, simply press . The Header command The H (header) command is just like Revise, except that it only changes the remark at the head of the archive, and not the remarks for the files in the archive. Converting Archives from ARC and PKARC The C command extracts files from the archive and recompresses them. This is primarily of use to convert older archives created with ARC and PKARC to the better compression techniques used by PAK. Example: To convert all the files in BONZO.PAK, type: PAK c bonzo PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 9 It is also possible to convert files created with PAK so that they will be compatible with ARC or PKARC, by adding the C or S compression type modifier: PAK c /c bonzo converts bonzo (created with PAK, PKARC, or PAK) to compression types compatible with ARC and PKARC. PAK c /s bonzo converts bonzo to compression types compatible with PKARC. Options In addition to the commands, PAK supports a variety of options. We've already mentioned a few in passing - the /R (remarks), /C (crunch) and /S (squash) options. These options aren't necessary for the day-to-day use of PAK, but occasionally you may wish to use them. Normally, these options appear immediately after the command, separated by slashes (/). For example: PAK a /opt1 /opt2 archive While this is the normal ordering, it's not required, and the options can appear anywhere on the line, provided each starts with the slash character. For example, PAK a archive /opt1 file /opt2 is also acceptable. For compatibility with PAK 1.0, options may be jammed against the command. For example, PAK cc archive is the same as PAK c /c archive This format is hard to read, and not recommended. Moving Files (/M) The Move option will delete files after compressing them or extracting them. The M (move) and X (extract + delete) commands are actually the Add and Extract commands with the Move option. This option is primarily of use in combination with Update or Freshen, which do not have matching Move commands. PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 10 Duplicate Files (/D) The /D (duplicate) option selects only those files which are both inside the archive and outside the archive. For example, PAK e /d saved *.doc would only extract those files with the .DOC extension which matched existing files on the disk. The Freshen command is another example of the /D option - it only adds those files which already exist in the archive. While of most use with the Add and Extract commands, the Duplicate option can be used with other commands, such as List. Replacing Existing Files (/W) Normally, PAK asks before replacing an existing file, either in an archive or on your disk. You can change this by adding one of these options: /WA Always replace existing files. /WP Prompt before replacing existing files (normal). /WO Replace older files. /WN Never replace existing files. The /WP option simply means 'Prompt' when used with the Delete command. The Update and Freshen commands automatically include the /WO option. Use Remarks (/R and /H) Adding the /R option to any other command (such as Add or List) will enable remarks. For example, PAK a /r saved *.pas will add all the files with the extension .PAS to the archive SAVED, and ask for the remark for each new file. PAK l /r saved would then include those remarks with the list of files in the archive. The /H option is similar, except that it only enables the the remark at the head of an archive. PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 11 Crunch and Squash (/C and /S) Using the /C or /S option will force PAK to use Crunching or Squashing when compressing files. They are of primary use with the Convert command, but they can also be used with Add, Move, Update, and Freshen. Encrypting Files (/G) Occasionally you may wish to encrypt your archives with a password. Files can still be listed in such archives, but they will appear damaged unless extracted with the same password. To encrypt files, type PAK a /g The 'g' option stands for Garble. Passwords used with the Garble command are converted to all uppercase. For example, to encrypt the file "SECRET.EXE" in the archive "DARK.PAK" with the password "DEEP", type PAK a /gDEEP dark secret.exe To extract it later, type PAK e /gDEEP dark secret.exe While these are the most common uses of Garble, Garble can also be used with any of the other commands. For example, testing the example encrypted archive requires the use of the Garble command: PAK t /gDEEP dark Sorting Files (/O) PAK supports sorting of archives by filename + extension (the normal method, used in release 1.0), extension + filename, time, size, or no sort at all. To enable a sorting method, include one of these options: /ON for filename + extension /OE for extension + filename /OT for time /OS for size /O- for no sort PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 12 For example, PAK a /OT newmail mail*.* will add the all files starting with MAIL to the archive NEWMAIL in the order of the date and time of the files. On the other hand, PAK l /OS saved would list all of the files in an archive in the order of their fully-expanded size, regardless of the actual order in SAVED. Note that adding any file to an archive will result in PAK sorting the archive. In the first example above, all of the files in the archive NEWMAIL would be sorted by time, even if they were previously sorted by some other method. The standard sort for the compression commands (Add, Move, Update, Freshen) is by filename + extension. For other commands, the standard is no sorting. Pack Archives (/P) Archives rarely compress, so normally PAK does not attempt to do so, which saves time. Adding this option will force PAK to try and compress archive files. The Temporary Path (/T) You can specify a path for temporary files, like so: PAK c /tC: doodle Whenever PAK makes any change (adding or deleting a file) to an archive, PAK must create a temporary file for the changed archive. If you are working on floppy disks, this limits the maximum size of an archive to half the volume of the disk, since the old copy and the new copy must exist at the same time. If you use this option to specify a temporary path (such as C:), and you are working on drive A: or B:, PAK will create this temporary file in the Temporary Path and copy it over the old file when everything is done. This allows archives up to the full size of a floppy. PAK also needs a temporary file if you Print or Convert a file which is larger than what PAK can hold in memory (this is always limited to 64K, even if you have more). PAK will always try to use the Temporary Path to create this file. If the Temporary Path is invalid, PAK will use the directory of the archive instead. PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 13 General Syntax The command format for PAK is: PAK [/opt, /opt...] [, ...] is a command. [/opt] is zero or more options. is the name of the archive to operate on, which may include the "wildcard" characters * or ?, provided is not one of the compression commands (Add, Move, Update, or Freshen). is one or more file names. Filenames may include the "wildcard" characters * and ?. If you specify a directory or a disk drive, PAK will use all files in that directory. If you don't list any files or directories, PAK assumes you mean all the files in the current directory. Simply typing PAK will print a short list of commands. Summary of Standard PAK Commands Commands: A Add files to archive M Move files to archive U Update archive files F Update duplicate files E Extract files from archive X Move files from archive D Delete files L List files V List files P Display files T Test files C Convert files R Revise remarks Options: /m = move files /c = make ARC compatible files (Crunched). /s = make PKARC compatible files (Squashed). /g = encrypt the file with a password. /t = use temporary path /d = use only duplicate files. /wa = always replace existing files /wp = prompt before replacing existing files (normal) /wo = replace older files /wn = never replace existing files /r = use remarks /on = filename + extension order /oe = extension + filename order /ot = time order /os = size order /o- = no order /p = pack archives PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 14 Limitations PAK can handle at most 16,000 files at once, though this may also be limited by available memory. PAKINST (PAK install program) PAKINST manipulates PAK.CNF, the configuration file for PAK. Since PAK.CNF contains the definition of PAK's user interface, PAK cannot run without it. You can use PAKINST to tell PAK where to look for PAK.CNF, to translate PAK.CNF into a text-format configuration file, or to translate a text-format configuration file into PAK.CNF. Included with PAK 1.6 are two example text-format configuration files, STDCFG.TXT and ALTCFG.TXT. By creating your own configuration files with a word processor, or by altering the provided examples, you can customize PAK's commands to suit your needs. PAKINST must always be run in the same directory with PAK and PAK.CNF. To run PAKINST, simply type PAKINST PAKINST provides four choices: set [D]irectory convert [T]ext to PAK.CNF convert [P]AK.CNF to text and [Q]uit To set the directory where PAK looks for PAK.CNF, select D. To create a new PAK.CNF from a properly-formatted text file, select T. To create a text file from PAK.CNF, select P. Command Definitions A command definition in text-format file looks like this: = [+ ], "" The is the command as it will be used with PAK, i.e. 'A' or 'Add'. Commands must start with a letter, and may contain no spaces, but may be may be any length. The is one of ADD, EXTRACT, DELETE, LIST, VIEW, TEST, CONVERT, or REVISE. These correspond to the standard PAK commands of A, E, D, L, P, T, C, and R. The command may also include one or more , separated by the plus (+) symbol. Each is one of MOVE, CRUSH, CRUNCH, SQUASH, PASSWORD, DUPLICATE, REMARK, ARCHIVE_REMARK, PACK_ARCHIVES, NAME_SORT, TIME_SORT, SIZE_SORT, EXT_SORT, NO_SORT, ALWAYS_REPLACE, PROMPT_REPLACE, REPLACE_OLDER, NEVER_REPLACE, or PAK (C) 1988, 1989 NoGate Consulting Jan 24th 1989 Page 15 TEMP_PATH. All of these are covered in more depth in the section 'Using The Command Line Version of PAK'. Finally, separated from the commands and options by a comma and enclosed in quotation marks is the help definition for this command. The PAK help screen, obtained by typing PAK by itself, will display the text within these quotation marks after the command. For example, the Freshen command (F) in the STDCFG.TXT file looks like this: F = Add + Duplicate + Replace_Older + Name_Sort, "Update duplicate files" Reading this literally, PAKINST takes this as 'F means add files to the archive, selecting only duplicate files, replacing older files, and sorting by name. When asked for help, display F followed by the text "Update duplicate files".' Notice that this does not all have to be on the same line. Option Definitions An option definition looks like this: /