Booz 1.02 -- Barebones Ooz a Zoo Extractor/Lister by Rahul Dhesi Booz 1.02 is a small, memory-efficient Zoo archive extractor/lister. It is not fancy. It does not recognize the advanced features available in current versions of Zoo, such as long filenames, directory names, comments, and multiple file generations. Extraction always uses a short MS-DOS format filename and all extracted files go into the current directory. But Booz 1.02 is simple and portable and can be implemented in about fifteen minutes on any system with a reasonably good C compiler that provides **IX-compatible read(), write(), and lseek() functions. And Booz 1.02 can extract and list all archives created by all currently-existing versions of Zoo. At compilation time, conditional compilation selects one of three levels of sophistication for Booz 1.02. The three options are as follows. The Tiny option: Booz compiled with the Tiny option is very frugal and should compile and run under CP/M and other systems with limited memory. Tiny Booz always extracts an entire archive at a time and does not attempt to prevent an exctracted file from overwriting another. Tiny Booz requires you to type the entire filename of the archive being extracted, including the ".zoo" extension. The Small option: Booz compiled with the Small option is a little more sophisticated than Tiny Booz. Small Booz assumes the default extension ".zoo" for an archive if it is not specified. It will let you specify which files should be extracted from an archive. Small Booz accepts these wildcard symbols in the names of files to be extracted: "?" stands for any one character and "*" stands for any sequence of zero or more characters. Combinations of these are permitted so, for example, "*c?t*h" matches filenames ending with "h" and containing "c" and "t" separated by one character. Small Booz is nearly as memory-efficient as Tiny Booz and it very likely that it will compile and run under CP/M. The Big option: Booz compiled with the Big option does everything that Small Booz does and in addition it can give the directory listing of a Zoo archive or test its integrity. Despite its name, Big Booz is still quite frugal. Under MS-DOS, when compiled with the Microsoft C compiler version 3.00, it runs in about 50 kilobytes of free memory and occupies about 9.5 kilobytes on disk. COMPILING BOOZ 1.02 1. Make sure that the two macros OPEN and CREATE are correctly defined for your system in file `oozio.h'. Some sample macros are provided. The macros must be defined to open files in binary mode (i.e., without newline conversions). The macro OPEN is supplied a filename and it must open the file for reading and return an open file descriptor, or -1 if the open fails. It is used to open the archive being extracted or listed, and to test the existence of a file about to be extracted. The macro CREATE is supplied a filename and it must create a new file for writing and return an open file descriptor, or -1 if the create fails. It is used for creating each file that is extracted. 2. If your C library does not provide the unlink() function (which deletes a file given its name), define an empty function by that name, or define a suitable (possibly empty) macro by that name in file `oozio.h'. 3. Decide which of the three options, Tiny, Small, or Big, you will use. If memory is tight use the Tiny option first to get a Zoo extractor quickly running on your system. Then experiment with the other options. If memory is not tight, use the Big option. Define any one of the symbols TINY, SMALL, or BIG in the file `options.h' (or alternatively define it on the command line that invokes your C compiler). Exactly one of these three symbols must be defined. 4. Choose appropriate sizes for the input/output buffers and for the size of the decompression stack in file `options.h'. If memory permits, make the buffers 8192 each. (Bigger sizes, perhaps up to 16384, could be used but they have not been tested and could conceivably cause overflow in certain bit-shift operations in file `lzd.c'). A reasonable stack size is 2000, but in pathological cases extraction of a file could require a larger stack. If memory is tight, decrease the input/output buffers to 1024 each each and the stack to 1000. 5. Compile and link all the C files. Two makefiles are supplied, one suitable for **IX systems and the other for Microsoft C 3.0 under MS-DOS. Modify these as necessary for your system. Also supplied is a project file booz.prj for use with Turbo C 1.0 on MS-DOS. MACHINE DEPENDENCE Booz is relatively independent of machine architecture, except that (a) the machine must be a 2's complement machine (all modern machines are) and (b) `char' must be exactly 8 bits, `int' must be 16 bits or larger, and `long' must be 32 bits or larger (though a `long' of a little less than 32 bits may work). Booz makes no assumptions about the filename syntax of the host machine, except that Small and Big Booz assume that dot "." is used to separate the extension "zoo" from the rest of the name of the archive. They will append ".zoo" to the archive name if it contains no dot; this fails if an archive name of the type "../junk" is specified. If your system uses a different filename syntax, you may need to change the code. Also, if your system cannot accept some of the characters legal in MS-DOS filenames, you may need to add a function that will fix the filename before extraction. A sample function `fixfname()' is included in the file `oozext.c'. It becomes activated only if the preprocessor symbol FIXFNAME is defined. NOTE This program does not attempt to be case-insensitive. Therefore you will need to type names of files to be extracted in the correct case. Note, however, that some operating systems (possibly CP/M) may fold command line arguments to uppercase. If this happens, your best bet is to extract all files from an archive instead of specifying specific names. REVISION HISTORY Version 1.00 Corresponded to just the Tiny booz 1.02 Version 1.01 Included TINY, SMALL, BIG compilation options. Had a bug in function needed() that sometimes cause file extraction to fail. Version 1.02 Fixed bug in function needed(). Added support for Turbo C 1.0. Revised this documentation and some comments in the source code. -- Rahul Dhesi 1988/08/25