Path: utzoo!hoptoad!mejac!decwrl!labrea!eos!ames!nrl-cmf!mailrus!umix!hyc From: hyc@umix.cc.umich.edu (Howard Chu) Newsgroups: alt.sources Subject: Latest and Greatest ARC (with squashing) pre-release (1/9) Keywords: ARC 5.20 squash Message-ID: <3996@umix.cc.umich.edu> Date: 14 Apr 88 05:55:08 GMT Reply-To: hyc@umix.cc.umich.edu (Howard Chu) Distribution: alt Organization: University of Michigan Computing Center, Ann Arbor Lines: 1015 UUCP-Path: {uunet,rutgers}!umix!hyc Howdy... I'm calling this a pre-release, but there's nothing wrong with the included code. (Assuming you're on a BSD style machine.) It may even work on a Sys V flavor machine; I don't know. When I find out for certain, the resulting code will be posted to comp.sources.misc. (I hope. Depends on Brandon, I guess.) Meanwhile, I've sent a copy of this to Jon Zeeff, (umix!b-tech!zeeff) who has promised to test this for me on his Sys V machine. (Got that, Jon? If there are any delays, the entire alt world will blame it on you... }-) Anyway... Cut all this crud out, cat all 9 pieces together, unshar it, and read the Readme file. You should be able to just type make, walk away for a few minutes, and come back to find a shiny new arc program on your machine... While it's nearly identical to the MSDOS program, even if you're familiar with how to use ARC you should read my notes on the two new options... neuf'o'dix. Further info in the Readme. byefornow # This is a shell archive. # Remove everything above and including the cut line. # Then run the rest of the file through sh. #----cut here-----cut here-----cut here-----cut here----- #!/bin/sh # shar: Shell Archiver # Run the following text with /bin/sh to create: # Readme # Manifest # Make.tws # Makefile # Arc.doc # Arcinfo # arc.c # arc.h # arcadd.c # arccode.c # arccvt.c # arcdata.c # arcdel.c # arcdos.c # arcext.c # arcio.c # arclst.c # arclzw.c # arcmatch.c # arcmisc.c # arcpack.c # arcrun.c # arcs.h # arcsqs.c # arcsvc.c # arctst.c # arcunp.c # arcusq.c # dtime.c # dtimep.lex # lexedit.sed # lexstring.c # libtws.3 # tws.h # This archive created: Thu Apr 14 00:30:56 1988 echo shar: extracting Readme '(4232 characters)' sed 's/^XX//' << \SHAR_EOF > Readme XXGreetings, XX herein you should be pleased to find the complete sources for the XXlatest and greatest version of ARC, based on the sources for version 5.20 XXof the MSDOS ARC program. The patches to the previous release, 5.12, with XXsquashing algorithm, have also been applied here. The code is known to XXwork on a Sun 3 running SunOS 3.4, Apollo DN3000 running SR9.7 DOMAIN/IX, XXVax 750 running 4.3BSD, and IBM 3090 running MTS. I shall probably begin XXporting to my Atari ST in a few days as well... XX Also included is a detailed description of the format of a .ARC XXfile directory entry, in the file named Arcinfo. Could be useful if you're XXtrying to port ARC to any more esoteric systems... XX One final necessary inclusion: sources for libtws.a, which was XXposted a long time ago to mod.sources as part of a package he called XX"phoon" - a program that calculated and displayed the PHase of the mOON. XXThe only thing I use the time routines for here is to convert an expanded XXdate/time back into a Unix style time value, for keeping file modification XXtimes straight. XX I have not written a man page; if you need docs for this program, XXsee the docs for ARC 5.20 on a PC. Operation is pretty much identical, XXexcept as noted below. XX XXA necessary legal note: ARC is copywritten by Systems Enhancement XXAssociates. You may freely distribute the ARC program as long as you do not XXcharge for distribution. The comments in the code indicate that the program XXis intended to be distributed in unmodified form (i.e., lots of people will XXget very angry at you if you rewrite a banner to claim that you wrote the XXprogram, or if you do something vile like insert a virus.). This is a moot XXpoint, really, since the sources were made public by the SEA folk to allow XX(heck, encourage!) other people to use and modify the code. (The point is XXmoot only in this context - I'm not distributing binary executables...) XXOrdinarily, if you liked this program, you'd send a registration fee to SEA XXand they'd promise to give you technical support. The registration form is XXincluded here, at the end of the doc file. I suppose you can send them your XXmoney if you want, after using this code. I don't see why, though, since XXthey didn't write the non-MSDOS code, and probably won't provide any XXsupport for it. (Actually, I suppose it would be very easy for them to pick XXthis up and then offer to support non-MSDOS users. Whatever...) In any case, XXThey didn't write all of what you're about to see, and neither did I, but I XXsuspect neither the SEA folk, myself, or any of the many others who have XXinvested time in this program would appreciate it much if you were to charge XXanything for distributing this code. neuf'o'dix. XX XXThings to note - if you specify the "q" (use squashing) option, ARC will XXnot bother trying the other compression methods at all. This may or may XXnot be desirable. (A small speed gain, but Squashing isn't always better XXthan Crunching...) Also, as of version 5.20, ARC no longer uses the Huffman XXSqueeze algorithm for compression. This is also a speed gain, since it no XXlonger spends time performing 3 different compression methods simultaneously XXand choose the best. (Now it only tries two at most.) XX XXAnother thing - this version, unlike for MSDOS, distinguishes between text XXand binary files. The default is text, which will strip CRs from files XXupon extraction, and will insert them before LFs upon storage. Should make XXsending text files between machines a little less painful than before. XX(On a 370 machine it also translates from and to ASCII/EBCDIC, so all XXfiles are stored internally in an MSDOS usable format, i.e, ASCII text, XXCR/LF line terminator...) XX XXTo compile all this stuff... Edit Make.tws (shouldn't need to change anything XXhere, really.) Edit arc.h. I've never run this on a pure System V Unix, so XXI can't say how it'll behave, but it should still compile with BSD defined. XXAfter that, just type make and wait a while... Ok... Well, I've had this XXfor a while, and it works for me, but if somehow I've goofed, let me know. XX XX / XX /_ , ,_. Howard Chu XX/ /(_/(__ University of Michigan XX / Computing Center College of LS&A XX ' Unix Project Information Systems SHAR_EOF if test 4232 -ne "`wc -c Readme`" then echo shar: error transmitting Readme '(should have been 4232 characters)' fi echo shar: extracting Manifest '(2051 characters)' sed 's/^XX//' << \SHAR_EOF > Manifest XXContents of this distribution.... XX 55115 Apr 14 00:08 Arc.doc Docs for original PC ARC 5.20 XX 5577 Apr 11 19:15 Arcinfo Description of .ARC file format XX 1323 Apr 11 19:10 Make.tws Makefile for the time routine library XX 1697 Apr 11 18:48 Makefile Makefile for ARC XX 2051 Apr 11 19:16 Manifest This file XX 4232 Apr 11 19:50 Readme Brief description of this package XX 10348 Apr 11 18:57 arc.c Main routine, option parser... XX 3115 Apr 11 17:40 arc.h System dependencies, externs XX 9205 Apr 11 17:43 arcadd.c Top level routine for adding to archive XX 1314 Apr 8 16:43 arccode.c Code for file encryption/decryption XX 3800 Apr 11 17:45 arccvt.c Convert from old to new packing method XX 1838 Apr 11 17:46 arcdata.c Declarations of externs from arc.h XX 2077 Apr 8 16:43 arcdel.c delete files from archive XX 5048 Apr 11 17:46 arcdos.c OS specific file management routines XX 5231 Apr 11 17:52 arcext.c Top level routine for extraction XX 7950 Apr 11 17:54 arcio.c OS specific low-level I/O routines XX 4534 Apr 11 17:56 arclst.c list contents of archive XX 23283 Apr 11 18:06 arclzw.c low-level lempel-ziv-welch compression XX 3403 Apr 11 18:14 arcmatch.c pattern matching routines XX 11060 Apr 11 18:20 arcmisc.c OS specific miscellaneous functions XX 7219 Apr 11 18:50 arcpack.c mid-level compression code XX 3287 Apr 8 16:44 arcrun.c run files from archive XX 1832 Dec 19 03:52 arcs.h Declaration of .ARC header format XX 11230 Apr 11 18:32 arcsqs.c low-level squash code XX 5470 Apr 11 18:35 arcsvc.c .ARC file utilities XX 1437 Apr 8 16:44 arctst.c test archive integrity XX 5622 Apr 11 18:51 arcunp.c mid-level extraction code XX 2678 Apr 11 18:40 arcusq.c low-level Huffman unSqueezer XX 9035 Apr 11 19:10 dtime.c sources for the time routine library... XX 7327 Apr 11 19:11 dtimep.lex XX 356 Apr 11 19:12 lexedit.sed XX 3765 Apr 11 19:12 lexstring.c XX 2241 Apr 11 19:13 libtws.3 man page for the time routine library XX 2999 Aug 13 1987 tws.h SHAR_EOF if test 2051 -ne "`wc -c Manifest`" then echo shar: error transmitting Manifest '(should have been 2051 characters)' fi echo shar: extracting Make.tws '(1323 characters)' sed 's/^XX//' << \SHAR_EOF > Make.tws XX# Makefile for phoon, deltime, parsetime, and libtws (stolen from mh). XX XX# Valid options: XX# BSD42 Set this if your system is BSD 4.2 or later. XX# SYS5 Set this if your system is System V. XX# EUROPE Makes nn/nn/nn mean dd/mm/yy instead of mm/dd/yy. XX# ATZ This has something to do with alpha-numeric time zones. XX# DSTXXX This has something to do with daylight savings time. XX# HUJI I don't XX# INETONLY know what XX# LEXDEBUG the rest of these XX# ONECASE do. XX# XX# Original posted to mod.sources by Jef Poskanzer. Cannibalized for use XX# with ARC by Howard Chu. XXOPTIONS = -DBSD42 -DATZ -DDSTXXX -DONECASE XX XX XXCC = cc XXCFLAGS = -O $(OPTIONS) XXLDFLAGS = -ns XX XXlibtws.a: dtime.o dtimep.o lexstring.o XX ar r libtws.a dtime.o dtimep.o lexstring.o XX# The following amusing bullshit makes sure that ranlib XX# gets executed if it is present, no matter which shell XX# make uses. If there's a better way to do this, someone XX# please tell me! XX -if test -r /usr/bin/ranlib ; then ranlib libtws.a ; fi XX -if ( -r /usr/bin/ranlib ) ranlib libtws.a XX XXdtime.o: dtime.c tws.h XX XXdtimep.o: dtimep.c tws.h XX XXdtimep.c: dtimep.lex XX lex -nt dtimep.lex | sed -f lexedit.sed > dtimep.c XX XXlexstring.o: lexstring.c XX $(CC) $(CFLAGS) -c lexstring.c SHAR_EOF if test 1323 -ne "`wc -c Make.tws`" then echo shar: error transmitting Make.tws '(should have been 1323 characters)' fi echo shar: extracting Makefile '(1697 characters)' sed 's/^XX//' << \SHAR_EOF > Makefile XX# XX# Makefile for Hack-attack 1.3 XX# VAX 11/780 BSD4.2 "ARC" utility XX# XX# Originals from Dan Lanciani, James Turner, and others... XX# XX# Modified to support squashing, also added targets for the time routine XX# library. -- Howard Chu, hyc@umix.cc.umich.edu, 4-11-88 XX# XXCFLAGS = -O XX XXOBJS = arc.o arcadd.o arccode.o arccvt.o arcdata.o arcdel.o arcdos.o \ XXarcext.o arcio.o arclst.o arclzw.o arcmatch.o arcpack.o arcrun.o \ XXarcsqs.o arcsvc.o arctst.o arcunp.o arcusq.o arcmisc.o XX XX XXSRCS = arc.c arcadd.c arccode.c arccvt.c arcdata.c arcdel.c arcdos.c \ XXarcext.c arcio.c arclst.c arclzw.c arcmatch.c arcpack.c arcrun.c \ XXarcsqs.c arcsvc.c arctst.c arcunp.c arcusq.c arcmisc.c XX XXarc: ${OBJS} libtws.a XX cc ${CFLAGS} -o arc ${OBJS} libtws.a XXarc.o: arc.h XX cc ${CFLAGS} -c arc.c XXarcadd.o: arc.h XX cc ${CFLAGS} -c arcadd.c XXarccode.o: arc.h XX cc ${CFLAGS} -c arccode.c XXarccvt.o: arc.h XX cc ${CFLAGS} -c arccvt.c XXarcdata.o: arc.h XX cc ${CFLAGS} -c arcdata.c XXarcdel.o: arc.h XX cc ${CFLAGS} -c arcdel.c XXarcdir.o: arc.h XX cc ${CFLAGS} -c arcdir.c XXarcdos.o: arc.h tws.h XX cc ${CFLAGS} -c arcdos.c XXarcext.o: arc.h XX cc ${CFLAGS} -c arcext.c XXarcio.o: arc.h XX cc ${CFLAGS} -c arcio.c XXarclst.o: arc.h XX cc ${CFLAGS} -c arclst.c XXarclzw.o: arc.h XX cc ${CFLAGS} -c arclzw.c XXarcmatch.o: arc.h XX cc ${CFLAGS} -c arcmatch.c XXarcmisc.o: arc.h XX cc ${CFLAGS} -c arcmisc.c XXarcpack.o: arc.h XX cc ${CFLAGS} -c arcpack.c XXarcrun.o: arc.h XX cc ${CFLAGS} -c arcrun.c XXarcsqs.o: arc.h XX cc ${CFLAGS} -c arcsqs.c XXarcsvc.o: arc.h XX cc ${CFLAGS} -c arcsvc.c XXarctst.o: arc.h XX cc ${CFLAGS} -c arctst.c XXarcunp.o: arc.h XX cc ${CFLAGS} -c arcunp.c XXarcusq.o: arc.h XX cc ${CFLAGS} -c arcusq.c XXarc.h: arcs.h XX touch arc.h XX XXlibtws.a: XX make -f Make.tws libtws.a SHAR_EOF if test 1697 -ne "`wc -c Makefile`" then echo shar: error transmitting Makefile '(should have been 1697 characters)' fi echo shar: extracting Arc.doc '(55115 characters)' sed 's/^XX//' << \SHAR_EOF > Arc.doc XX XX XX XX XX XX XX XX XX XX XX XX XX ARC XX XX File Archive Utility XX Version 5.20 XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX (C)COPYRIGHT 1985,86 XX by XX System Enhancement Associates, Inc. XX ALL RIGHTS RESERVED XX XX XX XX XX XXThis document describes version 5.20 of the ARC file XXutility, which was created by System Enhancement XXAssociates, Inc. in October of 1986. XX XX XX TABLE OF CONTENTS XX XX XX XX_______ ____ XX XX XXIntroduction .................................... 1 XXUsing ARC ....................................... 3 XXARC commands .................................... 5 XX Adding files ................................ 5 XX Extracting files ............................ 7 XX Deleting files .............................. 8 XX Listing archive entries ..................... 8 XX Running files ............................... 10 XX Printing files .............................. 11 XX Testing an archive .......................... 11 XX Converting an archive ....................... 12 XXARC options ..................................... 13 XX Suppressing compression ..................... 13 XX Backup retention ............................ 14 XX Message suppression ......................... 15 XX Encryption/Decryption ....................... 17 XXRAMdisk support ................................. 18 XXMARC ............................................ 19 XXARCE ............................................ 20 XXVersion numbers ................................. 21 XXCommon questions and answers .................... 22 XXMaintenance contracts ........................... 24 XXRevision history ................................ 25 XX Changes in version 3 ........................ 25 XX Changes in version 4 ........................ 25 XX Changes in version 4.1 ...................... 26 XX Changes in version 4.3 ...................... 26 XX Changes in version 4.4 ...................... 27 XX Changes in version 4.5 ...................... 27 XX Changes in version 5.0 ...................... 28 XX Changes in version 5.1 ...................... 29 XX Changes in version 5.2 ...................... 30 XXProgram history and credits ..................... 31 XXBulletin boards ................................. 33 XXSite licenses ................................... 34 XX XX XX XX XX XX XX XX XX XX XX XX XX XX INTRODUCTION XX XX XX XXARC is the copyrighted property of System Enhancement XXAssociates, Inc. You are granted a limited license to XXuse ARC, and to copy it and distribute it, provided XXthat the following conditions are met: XX XX1) No fee may be charged for such copying and XX distribution. XX XX2) ARC may ONLY be distributed in its original, XX unmodified state. XX XX ___ XX part of any commercial product or service without XX the express written permission of System XX Enhancement Associates. XX XX XXContributions for the use of this program will be XXappreciated, and should be sent to: XX XX System Enhancement Associates, Inc. XX 21 New Street, Wayne NJ 07470 XX XXYou may not use this product in a commercial XXenvironment or a governmental organization without XXpaying a license fee of $35. Site licenses and XXcommercial distribution licenses are available. A XXprogram disk and printed documentation are available XXfor $50. See the order form enclosed with this manual XXfor more details. XX XX XX XXARC is user supported software. This means that you XXmay copy it freely and give the copies away to anyone XXyou wish, at no cost. They are in turn requested to XXsend in a contribution if they decide to use it. XX XXThe user supported software concept (often referred to XX _________ XXcost. The cost of offering a new product by XXconventional means is staggering, and hence dissuades XXmany independent authors and small companies from XXdeveloping and promoting their ideas. User supported XXsoftware is an attempt to develop a new marketing XXchannel, where products can be introduced at low cost. XX XX XX XX XXARC Page 1 XX If user supported software works, then everyone will XXbenefit. The user will benefit by receiving quality XXproducts at low cost, and by being able to "test XXdrive" software thoroughly before purchasing it. The XXauthor benefits by being able to enter the commercial XXsoftware arena without first needing large sources of XXventure capital. XX XXBut it can only work with your support. We're not XXjust talking about ARC here, but about all user XXsupported software. If you obtain a user supported XXprogram from a friend or colleague, and are still XXusing it after a couple of weeks, then it is obviously XXworth something to you, and a contribution should be XXsent. XX XX XX XXAnd now, back to ARC: XX XXARC is used to create and maintain file archives. An XXarchive is a group of files collected together into XXone file in such a way that the individual files may XXbe recovered intact. XX XXARC is different from other archive and library XXutilities in that it automatically compresses the XXfiles being archived, so that the resulting archive XXtakes up a minimum amount of space. XX XXWhen ARC is used to add a file to an archive it XXanalyzes the file to determine which of three storage XXmethods will result in the greatest savings. These XXthree methods are: XX XX1) No compression; the file is stored as is. XX XX2) Repeated-character compression; repeated sequences XX of the same byte value are collapsed into a three- XX byte code sequence. XX XX3) Dynamic Lempel-Zev compression; the file is stored XX as a series of variable size bit codes which XX represent character strings, and which are created XX "on the fly". XX XXNote that since one of the three methods involves no XXcompression at all, the resulting archive entry will XXnever be larger than the original file. XX XX XX XX XX XXARC Page 2 XX USING ARC XX XX XX XXARC is invoked with a command of the following format: XX XX ARC [