UNARJ.DOC, UNARJ 2.41 April 1993 UNARJ software and manual copyright (c) 1991-93 by Robert K Jung. All rights reserved. UNARJ version 2.41 release This documents new or updated information since UNARJ 2.10. ** IMPORTANT NEWS **************************************************** The ARJ archive format at 2.39 and above supports an archive date-time modified field. A new data check has been added to make_table() in DECODE.C to account for badly corrupted data. There is a newly defined flag bit in the ARJ flags. See TECHNOTE.DOC for details. UNARJ only supports this flag bit with the "l" command. There is an extended header bug in older versions of ARJ, AV.C and UNARJ.C. The extended header processing in read_header() should skip 4 bytes for the extended header CRC and not 2 bytes. This is NOT a current problem as no versions of ARJ use the extended header. The following source line in DECODE.C is AMBIGUOUS and has been corrected. weight[i++] = 1 << (16 - i); ********************************************************************** Here is the C source code for a simple UNARJ extractor program. It has been portabilized courtesy of Mark Adler for platforms that do not support ANSI C. This UNARJ is NOT meant for use as a production quality ARJ extractor. It is meant for the use of 3rd party developers who want to build file readers, etc, for ARJ. The UNARJ source code has been built and tested under Turbo C++ 1.0, Quick C 2.5, and Coherent 3.2.0. It has none of the program protection and other fancy features of ARJ 2.41. It is also VERY SLOW compared to ARJ!!! In ARJ, all of the critical routines are written in assembly language. COMMAND SYNTAX: UNARJ has been modified to support the four commands: "e", "l", "t", and "x". These are similar to the ARJ version of these commands. However, UNARJ does not create directories when using the "x" command. Usage: UNARJ archive[.arj] (list archive) UNARJ e archive (extract archive) UNARJ l archive (list archive) UNARJ t archive (test archive) UNARJ x archive (extract with pathnames) UNARJ does not accept any other commands or options. You cannot specify a base directory or select individual files to extract. UNARJ does not support empty directories or volume labels. UNARJ is much slower than ARJ because ARJ is highly optimized using assembly language. "e" extract command This command extracts the contents of the ARJ archive to the current directory. Files in the archive that already exist in the current directory will not be extracted. "l" list command This command lists the contents of the archive to the screen. The UNARJ l command replaces the old AV.EXE program. The last field on the display BTPMGVX stands for: B -> file has been marked as a backup T -> text/binary/directory/volume label type P -> path information available in "V" listing M -> compression method used G -> file has been garbled (encrypted) V -> archive has been continued to another volume X -> this file is an extended portion of a larger file "t" test command This command tests the contents of the archive by extracting the files to the NUL device (no data will be written to disk). If the contents of a file is corrupted, UNARJ will display "CRC error!". If the contents are valid, UNARJ will display "CRC OK". You can use this command to see if an archive contains pathnames. "x" extract with pathnames command This command extracts the contents of the ARJ archive to the pathnames stored in the archive. If only filespecs are stored in the archive, then the files will be extracted to the current directory. UNARJ will not create missing directories in the pathnames. You must create them manually. Use the UNARJ t command to see the full pathnames stored in the archive. PROGRESS INDICATOR UNARJ uses a small spinning bar to indicate extraction/testing progress. For some systems that have buffered output, the progress indicator may not work. BUILDING THE UNARJ PROGRAM Source files: UNARJ.C, DECODE.C, ENVIRON.C, UNARJ.H, UNARJ.DEF, TCCUNARJ.MAK, QCLUNARJ.MAK, OS2UNARJ.MAK. For Turbo C/C++, type MAKE /ftccunarj.mak For QuickC, type NMAKE /F qclunarj.mak For OS/2, type NMAKE /F os2unarj.mak For Coherent, type cc -DUNIX -DCOHERENT -o unarj unarj.c decode.c environ.c For UNIX type cc -DUNIX -o unarj unarj.c decode.c environ.c If you use a compiler other than listed above, the resulting UNARJ.EXE will not support restoring file date-time stamps. You can modify the ENVIRON.C file to add these functions for your particular implementation environment. If you send me your implementations, I will try to incorporate them into the next version of UNARJ. ACKNOWLEDGEMENTS: I wish to thank Haruhiko Okumura for providing the ideas for ARJ and UNARJ. His AR001 and AR002 provided the basic compression algorithms for ARJ 1.0. At ARJ 2.0, ARJ uses only the secondary Huffman compressor from AR002. I wish to thank Mark Adler for helping make UNARJ more portable. I also wish to acknowledge the use of the file date-time stamping routines in Rahul Dhesi's ZOO archiver. And to those who have contributed bug reports and porting information, I extend my thanks. UNARJ LICENSE POLICY FOR ALL USERS: The UNARJ program, source code, and the associated documentation are copyright (c) 1990-93 Robert K Jung, all rights reserved. If you distribute this software to others, you are required to distribute the ENTIRE package consisting of the following files: README.DOC UNARJ.EXE UNARJ.DOC UNARJ.C DECODE.C ENVIRON.C UNARJ.H UNARJ.DEF TCCUNARJ.MAK QCLUNARJ.MAK OS2UNARJ.MAK TECHNOTE.DOC I strongly prefer that the files be distributed in the format originally released: UNARJ241.EXE with the ARJ-SECURITY envelope as created by the author. If you must distribute the UNARJ archive in another archive format, please archive the UNARJ241.EXE as one file inside the other archive. Re-archival of the software as separate files means losing the ARJ security envelope. You may freely use the UNARJ C source code provided the end product is NOT an ARJ archiver (both compress and extract ARJ files). If you wish to distribute a modified version of UNARJ.EXE, you MUST indicate that it is a modified version both in the program and source code. I am holding the copyright on the source code, so please do not delete my name from the program files or the documentation. The UNARJ.EXE program is built from this source using Turbo C++ 1.0. You may freely use, copy, and distribute UNARJ.EXE, provided that no fee is charged for such use, copying or distribution. You may use UNARJ.EXE in a commercial software package provided that no additional fee is charged for using UNARJ.EXE and provided that the user fully understands that NO warranty or support is provided for UNARJ.EXE by ARJ Software. Moreover, the user must fully understand that UNARJ does not have the long usage history that ARJ does. This source code is intended to promote the building of utilities to support the use of ARJ and ARJ archives. TECHNICAL SUPPORT: Please report any bugs. I will TRY to fix them. If you have portability improvements, I would appreciate receiving a copy of them. I can be reached at: Robert Jung at Channel One BBS (617) 354-8873 Robert Jung at Bay State BBS (617) 598-6646 Robert Jung at FIDONET address: 1:16/390.7 Robert Jung in the ARJ (RIME/RELAYNET), COMPRESS (ILINK), LHARC / COMPRESSIONS (SMARTNET), or ARCHIVERS (RIME/RELAYNET) echo conferences. ARJ Software Robert and Susan Jung 2606 Village Road West Norwood, Massachusetts 02062 USA Internet address: robjung@world.std.com CompuServe userid: 72077,445 DISCLAIMER: This software UNARJ is provided on an "as is" basis without warranty of any kind, expressed or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. The person using the software bears all risk as to the quality and performance of the software. Should the software prove defective, the user assumes the entire cost of all necessary repair, servicing, or correction. The author will not be liable for any special, incidental, consequential, indirect or similar damages due to loss of data or any other reason, even if the author or an agent of the author has been advised of the possibility of such damages. HISTORY: UNARJ 2.41 - Added ARCHIMEDES support. Added archive date-time modified field support. Added data check to make_table(). Updated ARJ header descriptions. UNARJ 2.30 - Added new header arj flag (BACKUP_FLAG). Updated information in TECHNOTE.DOC. UNARJ 2.22 - Added missing semicolon to unarj.c for THINK_C. Modified text mode processing to include test for host_os in fwrite_txt_crc(). Added more error checking to unarj.c. UNARJ 2.21 - Changed uint ratio() to static uint ratio(). Added #ifdef VMS to unarj.c. Tested unarj on COHERENT (UNIX clone). Fixed use of _chmod to handle directories. Modified unarj.c to support the MAC THINK_C compiler. Added #include to vanilla section of environ.c. Added file date-time stamping to UNIX section of environ.c. UNARJ 2.20 - Changed arguments in get_mode_str() and set_ftime_mode() to at least int size. Added default_case_path() for convenience in UNIX. Added two missing %c from printf statement in list_arc(). end document