Shrink User's Guide Version 1.01b (beta) - May 1992 Written by Matthias Meixner Copyright (c) 1992 by Matthias Meixner All rights reserved Not for commercial use 1- Disclaimer ~~~~~~~~~~~~~ The author cannot be held liable for the suitability or accuracy of this manual and/or the program(s) it describes. Any damage directly or indirectly caused by the use or misuse of this manual and/or the program it describes is the sole responsibility of the user her/him self. 2 - Copyright/Distribution ~~~~~~~~~~~~~~~~~~~~~~~~~~ Shrink, (c) Copyright 1992 Matthias Meixner. All rights reserved. This Program is FREEWARE, so no financial donations are required (but welcome). This program may be freely distributed as long as all documentation and executable(s) remain unchanged and are included with the distribution. Also no profit is to be made by selling this program. Shrink V1.01b must not be added to other PD-libraries than AmigaLibDisks from Fred Fish without my written permission. The price must not exceed the costs of disk, package and mailing. 3 - Introduction ~~~~~~~~~~~~~~~~ Shrink is a new archiver for the Commodore-Amiga computer similar to LHA, lharc or zoo. It is not as fast as LHA, but compression rate is better than the rate of all these other archivers. Shrink uses a new IFF - format for its archives, that is designed to handle archives with other programs (see IFF-documentation). 4 - System requirements ~~~~~~~~~~~~~~~~~~~~~~~ Shrink will run on any Amiga system with at least 512KB RAM an one diskdrive. But for compressing large files more memory is needed, because shrink loads all files completely into RAM to reduce diskaccess. A 68020, 030 or 040 processor is very useful to reducecompression time. 5 - Command line syntax ~~~~~~~~~~~~~~~~~~~~~~~ The command line syntax is as follows: shrink [-options] [dest path] [pattern1] [pattern2] .. [-options] are optional, [dest path] is only needed for extraction and must end with ':' or '/', patterns are optional in some cases and sometimes needed (see documentation of commands). Patterns are the normal amiga patterns like #? or #?(x|y). Komplex patterns like (#?|#?.c) are not supported. 6 - Adding files to archive ~~~~~~~~~~~~~~~~~~~~~~~~~~~ There are several ways to add files to an archive. Shrink supports the following commands to add files matching the pattern to the archive: 'a': (add) Adds files to the archive if they are not already there. 'aa': (add all) Adds or replaces files in the archive. If the files was already in the archive, its generation is increased by one. (see generations) 'f': (freshen files) Replaces a file in an archive if the file is newer than the file in the archive. The generation of the older file is increased by one. Files that have not been in the archive are not addes to the archive. 'u: (update archive) Files are added to the archive if they are not already in the archive or are replaced in the archive if they are newer than the files in the archive. In this case the generation is increased by one. Options for adding files: The compression method can be set using the -m option. (-m0 no compression .. -m7 best compression [default]). -r forces shrink to collect the files recursively, e.g. to compress directories with subdirectories. With the option -a shrink supports the archive flag. When the option is set, only files with non-set archive flag are added to the archive. After adding them to the archive, the archive flag is set. -q (quiet mode) switches the progress indicator off when compressing. 7 - Testing archives ~~~~~~~~~~~~~~~~~~~~ The commands 't(n)' and 'ta' are used to test archives if they contain any errors. 't(n)' tests generation n of all files matching the pattern. If no pattern is given, shrink uses #? as default. 'n' Is a number between 1 and 255 and specifies the generation that shall be tested. If it is ommitted shrink assumes generation 1. 'ta' tests all files that are contained in the archive. Therefore it does not support any patterns. 8 - Deleting files ~~~~~~~~~~~~~~~~~~ Using 't(n)' or 'ta' you can delete files from the archive. With 'tn' the generation n of a file is deleted from the archive. 'ta' deletes all generations of the file. When you delete files from an archive they are not really removed from the archive, only their generation is set to 256. They are only removed when packing the archive (see packing the archive). As long as they are not removed from the archive they can be recovered again (see recovering deleted files). 9 - Recovering deleted files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If you wish to get back deleted files or files with an older generation you can use 'r(n)' to get back generation n of the file or 'ra' to get back a deleted file. The generation of this file is set to 1. The generation of the other files with the same name is increased by 1. If there exist more than one file with the same name and the same generation in an archive, you can use the -i(n) option to turn on the file index mode. Then only the n-th file that matches the pattern is referred by this command. 10 - Packing the archive ~~~~~~~~~~~~~~~~~~~~~~~~ Packing is used to remove all deleted or older files from an archive. 'p(n)' removes all generations that are higher than n from the archive. E.g. 'r255' removes all files with a generation higher than 255 i.e. deleted files. Or if you only want to keep 5 generations of each file use 'p5' to remove all older files. Shrink generates a backup-file when packing an archive. This is disabled by using the -d option. 11 - Extracting files ~~~~~~~~~~~~~~~~~~~~~ Extraction is done by using the command 'e(n)' or 'x(n)'. These commands extract the generation n of the files matching the pattern. If n is not given the first generation is extracted. If you do not want the whole pathname to be extracted, use the -c option to extract only the filenames. A special feature of this option is to cut off part of the filename. This can be used to change the path during extraction. For example the file ff500/c/MuchMore would be extracted as df0:c/MuchMore by the following command: shrink -cff500 x archive ff500/c/MuchMore If you wish to set the archive flag of the extracted files. you can use the -a option that does exactly this during extraction. By using the index-file-mode with the -i(n) option one can refer to the n-th file that matches generation and pattern. This is useful when there are more than one file of the same name and generation in one archive. 12 - Extracting files on the screen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 's(n)' extracts the n-th generation of the file on the screen. You can use the same options that can be used for normal extraction. 13 - Listing the contents of an archive ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'l(n)' or 'v(n)' prints the contents upto generation n of the archive on the screen, sorted by name and generation. Use 'la' or 'va' to get a list of all files and deleted files. It has the same effect as using 'l256'. 14 - Other options ~~~~~~~~~~~~~~~~~~ '-q' disables the progress indicator during compression and decompression. 15 - Technical info ~~~~~~~~~~~~~~~~~~~ Shrink uses a dictionary from 1024 upto 65536 bytes for compression due to the compression-mode. String down to 2 bytes are replaced by their reference to achieve maximum compression. Shrink uses dynamic arithmetic encoding instead of huffman encoding to get a better compression rate. Shrink is the first archiver on the amiga that uses this method for best compression rate. 16 - IFF-Archive-Format ~~~~~~~~~~~~~~~~~~~~~~~ Shrink uses a new IFF format for its archive files. The structure is as follows: FORM xxxx CDAF ; Compressed Data Archive File ^^^^ length of FORM NAME xxxx archivers_name ; This chunk must be the first chunk in the ; archive to determine the archiver that is ; required for compression and decompression ; of files in the archive. The other functions ; like deleting or recovering files should ; work with every archiver using this format FILE xxxx ; This must be the first chunk of every file ; contained in the archive UBYTE Checksum ; The sum of all bytes in this chunk must be zero UBYTE Method,Version ; Method and version of the compression method ; that was used to compress this file UBYTE Generation ; Generation of the file: 0=new .. 255=deleted USHORT SystemID ; System ID of the computer on which the file ; was compressed. ULONG Filesize ; Original size of the file, the compressed ; size of the file is the size of the BODY chunk UBYTE Year,Month,Day ; Date of the file (year since 1900) UBYTE Hour,Mins,Secs ; Time of the file USHORT CRC ; CRC Checksum of the uncompressed file ULONG Protection ; File attributes on the computer of SystemID UBYTE Filname ; The rest of the length of this chunk is used ; to store the filename. This enables filenames ; of any lenght BODY xxxx ; This chunk contains the compressed data of the ; file. This must be the last chunk of every ; file in the archive. Between the chunks FILE and BODY there can be as many chunks as the archiver needs to store additional information about the file and/or compression. Therefore these chunks must not be removed when packing or modifying archives. One of these chunks is the NOTE chunk: NOTE xxxx filenote It contains the filenote of the file. 17 - SystemID's ~~~~~~~~~~~~~~~ AMIGA 'AM' ATARI_ST 'ST' ARCHIMEDES 'AR' MS_DOS 'MS' UNIX 'UX' MAC 'MA' HELIOS 'HE' 18 - Something on bug reports ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When sending in bug reports, please state exactly under what circumstances the bug occurred, what equipment was used and what happened. If possible also try to give me enough information to reproduce the bug. It is very difficult to find bugs when you don't know exactly what happened. Please don't just send messages like "it can't extract files from archives sometimes", that really doesn't help me. If possible, submit the offending file/archive to me so I can test it myself, or give me a pointer where I can find the archive. 19 - Notes ~~~~~~~~~~ Bug reports, suggestions, postcards, flames, criticism, contributions, ideas, gifts, etc., etc., etc........... to: Matthias Meixner Sandberg 13 W-6417 Hofbieber 2 Germany P.S. The CRC-Checksum value of shrink is D6EF. You can use shrink itself to test the checksum by simply adding itself to an archive. Then the checksum can be controlled by listing the contents. So you can easily check if shrink is infected by a virus.