This code is based on the code described in README.ORIG. Changes are: 1. A program (makecrc) will create the different C source files to do crc calculations. 2. The crc calculation method of binhex is added. 3. 32 bit crc's are added.
The comment for the predecessor of hexbin. /* * xbin -- unpack BinHex format file into suitable * format for downloading with macput * Dave Johnson, Brown University Computer Science * * (c) 1984 Brown University * may be used but not sold without permission * * created ddj 12/16/84 * revised ddj 03/10/85 -- version 4.0 compatibility, other minor mods * revised ddj 03/11/85 -- strip LOCKED bit from m_flags * revised ahm 03/12/85 -- System V compatibility * revised dba 03/16/85 -- (Darin Adler, TMQ Software) 4.0 EOF fixed, * 4.0 checksum added * revised ddj 03/17/85 -- extend new features to older formats: -l, stdin * revised ddj 03/24/85 -- check for filename truncation, allow multiple files * revised ddj 03/26/85 -- fixed USG botches, many problems w/multiple files * revised jcb 03/30/85 -- (Jim Budler, amdcad!jimb), revised for compatibility * with 16-bit int machines * revised dl 06/16/85 -- (Dan LaLiberte, liberte@uiucdcs) character * translation speedup * revised ddj 09/30/85 -- fixed problem with run of RUNCHAR * revised gvr 11/15/86 -- speed-up: rewrote .hqx decoding (mcvax!guido) * revised jwm 04/26/88 -- now recognizes "(Convert with" as a starting line * -- the widely-used Stuffit uses this as a header * revised dtw ../../89 -- hqx format will skip garbage lines; undoes some of * -- gvr's work. will now also recognize .dl format. */
/* * macget -- receive file from macintosh using xmodem protocol * Dave Johnson, Brown University Computer Science * * (c) 1984 Brown University * may be used but not sold without permission * * created ddj 5/22/84 * revised ddj 6/29/84 -- added [-rdu] options * revised ddj 7/16/84 -- protocol changes for MacTerminal Beta Version 0.5X * revised ddj 7/31/84 -- pre-4.2 signal bugs fixed in timedout() * revised ddj 11/7/84 -- renamed send_sync() -> get_sync() * revised lra 1/01/87 -- multiple file uploads added (VersTerm compatible) */
/* * * Here is the source for the current incarnation of macput . . . . * It is compatible with the 1.1 Release version of MacTerminal, * though in case you still need to use the -0.15X version, there's * the "-o" option to provide compatibility. Versions 0.5 and 0.9 * have a bug in the record checksum calculation which will break * file transfers, so 1.1 is recommended. * * Please pass any improvements/bug fixes on to me, and * if you know of any good protocols for use on a flow-controlled * line, let me know. * * Dave Johnson * ddj%brown@csnet-relay.arpa * Brown University Computer Science * */
Preliminary info about the Unix scanner. ---------------------------------------- This file states mostly how to use it, it is not yet full documentation. There are a few utilities in this package that help scanning: macidf, macscan, macstream, hexbin and macunpack. I will give examples of use where every use highlights some factilities. The main program is macscan. It reads from standard input (NB: no file parameters) and will scan the input for offensive stuff. The input consists of a stream of files in MacBinary format, with additional information between (about Unix file name, Archive/Packed file name, folder entry/exit in an archive etc.). To scan a single MacBinary file just do: macscan <file This will read the file and macscan will mark everything it does not like. Also when macscan detects that it is an archive, it will unpack the archive, and recursively so for embedded archives. When given the opion -l macscan will list the contents of the archive during its scan. When given the option -v it will also list all resources found, with type, number, name (if defined) and size. If you have multiple MacBinary files (e.g. a set of MacBinary files in a directory tree), you can do the following (supposing the filenames end in '.bin'): find directory -name '*.bin' -exec xxx {} \; | macscan Where xxx is the following shellscript: #!/bin/sh macidf $1 cat $1 The macidf is needed so that macscan knows the original Unix file name. Of course macscan can also get the -l and -v options. If you have a directory tree with binhexed files, the following is appropriate: find directory -name '*.hqx' -exec hexbin -S {} \; | macscan The flag -S tells hexbin that filename info for macscan must be included. And here again, macscan can have options. Note: every binhexed file must be contained in a single Unix file, unlike mcvert. But, like mcvert, mailheaders and such can preceed and follow the binhexed file, and can also be in the middle. You can of course have compressed binhexed files, in that case: find directory -name '*.hqx.Z' -exec xxx {} \; | macscan with xxx the following shellscript: #!/bin/sh macidf $1 zcat $1 | hexbin -s (Note, lower case s here. Hexbin has no knowledge about the Unix filename.) If the directory is an AUFS directory the following can be done: macstream directory | macscan Note: in this case it is not yet possible to include the Unix filename in the output of macscan. With the option -l Mac names are listed. The previous method might also work with AppleDouble directories, but I am not sure about that. ------- What macscan can at this moment. It currently uses a subset of Jeff's VirusDetective strings during the scan. Not all strings are yet implemented, so not all viruses are already detected. Moreover, it includes warnings for CDEF 0, WDEF 0 etc. resources, as per Zig's suggestion. Finally, it warns about resources compressed by the resource compressor of Ben Haller. ------- The status. This version is preliminary and confidential. Do not distribute. There are probably a number of bugs present, although my testing on a Sun (actually an FPS == very fast Sun) worked pretty well. Lint does not complain too much ;-). Also SGI's lint has not many problems with it. Mostly because the difference between (char *)malloc(); and (void *)malloc(); etc. That must be straightened out sometime. Any bug-reports, suggestions are wellcome. Please support bug-reports with input or somesuch. dik -- dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland dik@cwi.nl
/* * @(#)unpit.c 1.2 (CWI) 87/11/05 */ /* unpit - Macintosh PackIt file unpacker Version 2, for PackIt II This program will unpack a Macintosh PackIt file into separate files. The data fork of a PackIt file contains both the data and resource forks of the packed files. The program will unpack each Mac file into separate .data, .rsrc., and .info files that can be downloaded to a Mac using macput. The program syntax is much like macput/macget: unpit [-rdu] packit-file.data The -r and -d flags will cause only the resource and data forks to be written. The -u flag will cause only the data fork to be written and to have carriage return characters changed to Unix newline characters. Some of the program is borrowed from the macput.c/macget.c programs. Author: Allan G. Weber, (Weber%Brand@USC-ECL) Date: September 30, 1985 Revised: January 24, 1986 - added CRC checking March 25, 1986 - support compressed mode of PackIt II, check for illegal Unix file names */ /* There is some confusion as to what to do with the "inited" flag in the finder info bytes that are in the header of each file in the packit file. If this flag bit is copied to the .info file, it seems to confuse MacTerminal into placing the file icons in the upper left corner of the window on top of each other. Setting this bit to zero in the .info file seems to fix that problem but may cause others. I haven't been able to find any .info files that have this flag set so making it zero may be OK. Anyway, MacTerminal seems to set the flag when it create the file on the Mac. The "#define INITED_BUG" can be used to try both settings. */ /* Format of a Packit file: Repeat the following sequence for each file in the Packit file: 4 byte identifier ("PMag" = not compressed, "Pma4" = compressed) variable length compression data (if compressed file) 92 byte header (see struct pit_header below) * 2 bytes CRC number * data fork (length from header) * resource fork (length from header) * 2 bytes CRC number * Last file is followed by the 4 byte Ascii string, "Pend", and then the EOF. * these are in compressed form if compression is on for the file */
/* unsit - Macintosh StuffIt file extractor Version 1, for StuffIt 1.31 This program will unpack a Macintosh StuffIt file into separate files. The data fork of a StuffIt file contains both the data and resource forks of the packed files. The program will unpack each Mac file into separate .data, .rsrc., and .info files that can be downloaded to a Mac using macput. The program is much like the "unpit" program for breaking apart Packit archive files. ***** IMPORTANT ***** To extract StuffIt files that have been compressed with the Lempel-Ziv compression method, unsit pipes the data through the "compress" program with the appropriate switches, rather than incorporate the uncompression routines within "unsit". Therefore, it is necessary to have the "compress" program on the system and in the search path to make "unsit" work. "Compress" is available from the comp.sources.unix archives. The program syntax is much like unpit and macput/macget, with some added options: unsit [-rdulvq] stuffit-file.data The -r and -d flags will cause only the resource and data forks to be written. The -u flag will cause only the data fork to be written and to have carriage return characters changed to Unix newline characters. The -l flag will make the program only list the files in the StuffIt file. The -v flag causes the program to list the names, sizes, type, and creators of the files it is writing. The -q flag causes it to list the name, type and size of each file and wait for a 'y' or 'n' for either writing that file or skipping it, respectively. Some of the program is borrowed from the macput.c/macget.c programs. Many, many thanks to Raymond Lau, the author of StuffIt, for including information on the format of the StuffIt archives in the documentation. Author: Allan G. Weber weber%brand.usc.edu@oberon.usc.edu ...sdcrdcf!usc-oberon!brand!weber Date: January 15, 1988 */
Taken from the file plugins.h in the Zoom distribution. /* * The Zoom archive format is: * * (char) Magic1 * (char) Magic2 - or - (char) Magic2B * (char) Magic3 * (char) Magic4 * * IF Magic2B was received THEN * (long) logicalEof /* For multi-file archives * / * END IF * * <EntryChain> * * The format of <EntryChain> is a linked list of * EntryInfo, where "next" points to the next logical address * on disk. "next" as 0 means no more entries. * * For a directory, the "creator" field points to the * first file/folder entry inside the directory. * * For a file, IF the "what" field is ZOOM_PLUGIN, * the EntryInfo is followed by a length byte and that * many characters naming the compression engine. * Right after that (or right after the EntryInfo in the * case of uncompressed files or default compressed files) * follows the data fork compressed, followed by the * resource fork compressed. * * Note that there is no "end of compressed data" marker; * your compressor engine will have to figure that out by * itself. You could for instance do an ftell before * compressing; writing a (long)0 and then write your * compressed data, seek back and write the actual length. * * Note that new entries always are added last in the file, * so you need not worry about overrunning anything else. */ /* * The default compressor in Zoom is the same as used in * "better" compression mode in ZOO 2.10. A Zoo extractor * or convertor could parse the ZOO header format, and use * the built-in engine for "lzh" compressed files. * * The simplest way to do this is to call SetEngine(-1) and * call Encode / Decode. -1 is the default compressor, 0 is * the null compressor (fork copy) * * Likewise, a UNIX zoom packer/unpacker could use the source * for zoo 2.10 functions "lzh_encode" and "lzh_decode" * (they're wrappers) for compression. */ /* * This "EntryInfo" is presently also a file header. * Some fields may be non-obvious. Don't use these. * For instance, "comment" is currently unsupported, * and should be left as 0 */ #ifndef ZOOM_TYPES typedef enum zoomWhatType { ZOOM_NOTHING , ZOOM_FILE , ZOOM_UCFILE , ZOOM_DIR , ZOOM_PLUGIN } ZoomWhatType ; #define ZOOM_TYPES #endif /* * Remember to fill in "hlen" correctly as well. When reading a header, * Zoom checks with this field to see if it should skip some more data * or seek back a little, so as to make future field additions at the * end possible. You should NOT add your own fields to this structure. */ typedef struct EntryInfo { /* "what" is a ZoomWhatType */ char what ; /* Negative if deleted */ unsigned char hlen ; /* Header length */ unsigned short boolFlags ; /* Boolean flags */ long next ; /* Next entry */ long complen ; /* Length of compressed data */ long compdata ; /* Data fork portion of compressed data - for dirs, number of entries */ long uclen ; /* Length of uncompressed entry */ long ucdata ; /* Data fork part of uncompressed */ long type ; /* File type */ long creator ; /* File creator - for dir, offset of file */ long mdate ; /* Modification date */ long comment ; /* Comment offset */ short flags ; /* Macintosh file flags */ short dataCrc ; /* Data fork crc */ short resCrc ; /* Resource fork crc */ unsigned char name [ 32 ] ; /* File/Dir name */ } EntryInfo ;
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.