Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!CORNELLC.CCS.CORNELL.EDU.BITNET!ewilts%Ins.MRC.AdhocNet.CA%Stasis.MRC.AdhocNet.CA%UNCAEDU.
From: ewilts%Ins.MRC.AdhocNet.CA%Stasis.MRC.AdhocNet.CA%UNCAEDU.@CORNELLC.CCS.CORNELL.EDU.BITNET (Ed Wilts)
Newsgroups: comp.os.vms
Subject: ARC_C.SHAR01_OF_19
Message-ID: <880624092234.021@Ins.MRC.AdhocNet.CA>
Date: 24 Jun 88 15:22:32 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 357
....................... Cut between dotted lines and save .....................
.
$!..............................................................................
$! VAX/VMS archive file created by VMS_SHAR V-5.01 01-Oct-1987
$! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au)
$! To unpack, simply save and execute (@) this file.
$!
$! This archive was created by EWILTS
$! on Friday 24-JUN-1988 08:13:22.18
$!
$! ATTENTION: To keep each article below 15872 bytes, this program
$! has been transmitted in 16 parts.
$! You should concatenate ALL parts to ONE file and execute (@) that file.
$!
$! It contains the following 23 files:
$! ARC.C ARCADD.C ARCCODE.C ARCCVT.C ARCDEL.C ARCDIR.C ARCDOS.C ARCEXT.C ARCIO.C
$! ARCLST.C ARCLZW.C ARCMATCH.C ARCMISC.C ARCPACK.C ARCRUN.C ARCS.C ARCSQ.C
$! ARCSVC.C ARCTST.C ARCUNP.C ARCUSQ.C ARCVAX.C SQUASH.C
$!==============================================================================
$ Set Symbol/Scope=(NoLocal,NoGlobal)
$ Version=F$GetSYI("VERSION") ! See what VMS version we have here:
$ If Version.ges."V4.4" then goto Version_OK
$ Write SYS$Output "Sorry, you are running VMS ",Version, -
", but this procedure requires V4.4 or higher."
$ Exit 44
$Version_OK: CR[0,8]=13
$ Pass_or_Failed="failed!,passed."
$ Goto Start
$Convert_File:
$ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd
$No_Error1: Define/User_Mode SYS$Output NL:
$ Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' -
VMS_SHAR_DUMMY.DUMMY
f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f);
o:=Get_Info(Command_Line,"Output_File");Set(Output_File,b,o);
Position(Beginning_of(b));Loop x:=Erase_Character(1);Loop ExitIf x<>"V";
Move_Vertical(1);x:=Erase_Character(1);Append_Line;
Move_Horizontal(-Current_Offset);EndLoop;Move_Vertical(1);
ExitIf Mark(None)=End_of(b) EndLoop;Position(Beginning_of(b));Loop
x:=Search("`",Forward,Exact);ExitIf x=0;Position(x);Erase_Character(1);
If Current_Character='`' then Move_Horizontal(1);else
Copy_Text(ASCII(INT(Erase_Character(3))));EndIf;EndLoop;Exit;
$ Delete VMS_SHAR_DUMMY.DUMMY;*
$ Checksum 'File_is
$ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
$ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd
$No_Error2: Return
$Start:
$ File_is="ARC.C"
$ Check_Sum_is=924119136
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
Xstatic char *RCSid = "$Header: arc.c,v 1.2 86/07/15 07:52:04 turner Exp $";
X
X/*
X * $Log:`009arc.c,v $
X * Hack-attack 1.3 86/12/20 01:23:45 wilhite@usceast.uucp
X * `009Bludgeoned into submission for VAX 11/780 BSD4.2
X *`009(ugly code, but fewer core dumps)
X *
X * Revision 1.2 86/07/15 07:52:04 turner
X * first working version for the vax
X *
X * Revision 1.1 86/06/26 14:59:15 turner
X * initial version
X *
X *
X */
X
X#define version "5.12 (VMS01b), created on"
X
X/* ARC - Archive utility
X
X$define(tag,$$segment(@1,$$index(@1,=)+1))#
X$define(version,Version $tag(
XTED_VERSION DB =5.12), created on $tag(
XTED_DATE DB =02/05/86) at $tag(
XTED_TIME DB =22:22:01))#
X$undefine(tag)#
X $version
X
X(C) COPYRIGHT 1985,86 by System Enhancement Associates; ALL RIGHTS RESERVED
X
X By: Thom Henderson
X
X Description:
X This program is a general archive utility, and is used to maintain
X an archive of files. An "archive" is a single file that combines
X many files, reducing storage space and allowing multiple files to
X be handled as one.
X
X Instructions:
X Run this program with no arguments for complete instructions.
X
X Programming notes:
X ARC Version 2 differs from version 1 in that archive entries
X are automatically compressed when they are added to the archive,
X making a separate compression step unecessary. The nature of the
X compression is indicated by the header version number placed in
X each archive entry, as follows:
X
X 1 = Old style, no compression
X 2 = New style, no compression
X 3 = Compression of repeated characters only
X 4 = Compression of repeated characters plus Huffman SQueezing
X 5 = Lempel-Zev packing of repeated strings (old style)
X 6 = Lempel-Zev packing of repeated strings (new style)
X 7 = Lempel-Zev Williams packing with improved has function
X 8 = Dynamic Lempel-Zev packing with adaptive reset
X`009 9 = Squashing
X
X Type 5, Lempel-Zev packing, was added as of version 4.0
X
X Type 6 is Lempel-Zev packing where runs of repeated characters
X have been collapsed, and was added as of version 4.1
X
X Type 7 is a variation of Lempel-Zev using a different hash
X function which yields speed improvements of 20-25%, and was
X added as of version 4.6
X
X Type 8 is a different implementation of Lempel-Zev, using a
X variable code size and an adaptive block reset, and was added
X as of version 5.0
X
X Verion 4.3 introduced a temporary file for holding the result
X of the first crunch pass, thus speeding up crunching.
X
X Version 4.4 introduced the ARCTEMP environment string, so that
X the temporary crunch file may be placed on a ramdisk. Also
X added was the distinction bewteen Adding a file in all cases,
X and Updating a file only if the disk file is newer than the
X corresponding archive entry.
X
X The compression method to use is determined when the file is
X added, based on whichever method yields the smallest result.
X
X Language:
X Computer Innovations Optimizing C86
X*/
X#include
X#include "arc.h"
X
Xmain(num,arg) /* system entry point */
XINT num; /* number of arguments */
Xchar *arg[]; /* pointers to arguments */
X{
X char opt = 0; /* selected action */
X char *a; /* option pointer */
X char *makefnam(); /* filename fixup routine */
X char *upper(); /* case conversion routine */
X/* char *index(); */ /* string index utility */
X char *envfind(); /* environment searcher */
X INT n; /* argument index */
X char *arctemp2;
X long getpid();
X
X warn = 1;
X note = 1;
X if(num<3)
V { printf("ARC - Archive utility, %s %s at %s\n",version,__DATE__,__TIME__)
X;
X printf("(C) COPYRIGHT 1985,86 by System Enhancement Associates;");
X printf(" ALL RIGHTS RESERVED\n\n");
X printf("Please refer all inquiries to:\n\n");
X printf(" System Enhancement Associates\n");
X printf(" 21 New Street, Wayne NJ 07470\n\n");
X printf("You may copy and distribute this program freely,");
X printf(" provided that:\n");
X printf(" 1) No fee is charged for such copying and");
X printf(" distribution, and\n");
X printf(" 2) It is distributed ONLY in its original,");
X printf(" unmodified state.\n\n");
X printf("If you like this program, and find it of use, then your");
X printf(" contribution will\n");
X printf("be appreciated. You may not use this product in a");
X printf(" commercial environment\n");
X printf("or a governmental organization without paying a license");
X printf(" fee of $35. Site\n");
X printf("licenses and commercial distribution licenses are");
X printf(" available. A program\n");
X printf("disk and printed documentation are available for $50.\n");
X printf("\nIf you fail to abide by the terms of this license, ");
X printf(" then your conscience\n");
X printf("will haunt you for the rest of your life.\n\n");
X printf("Usage: ARC {amufdxerplvtc}[bswn][g]");
X printf(" [ . . .]\n");
X printf("Where: a = add files to archive\n");
X printf(" m = move files to archive\n");
X printf(" u = update files in archive\n");
X printf(" f = freshen files in archive\n");
X printf(" d = delete files from archive\n");
X printf(" x,e = extract files from archive\n");
X printf(" r = run files from archive\n");
X printf(" p = copy files from archive to");
X printf(" standard output\n");
X printf(" l = list files in archive\n");
X printf(" v = verbose listing of files in archive\n");
X printf(" t = test archive integrity\n");
X printf(" c = convert entry to new packing method\n");
X printf(" b = retain backup copy of archive\n");
X printf(" s = suppress compression (store only)\n");
X printf(" w = suppress warning messages\n");
X printf(" n = suppress notes and comments\n");
X printf(" g = Encrypt/decrypt archive entry\n");
X#ifdef VAXC
X printf(" %% = print statistics information\n");
X#endif VAXC
X printf(" q = squash instead of crunching\n\n");
X/* printf("\nPlease refer to the program documentation for"); */
X/* printf(" complete instructions.\n"); */
X return 1;
X }
X
X /* see where temp files go */
X /* use process id to "enhance uniquity" of temp filenames */
X /* (avoids multi-user or background foolishness) */
X
X if(!(arctemp2 = envfind("ARCTEMP")))
X arctemp2 = envfind("TEMP");
X#ifdef VAXC
X if (arctemp2) printf("Temprary file will be on %s\n",arctemp2);
X if (arctemp2) sprintf(arctemp,"%s.Arc_%08lx",arctemp2,getpid());
X#else
X if (arctemp2) sprintf(arctemp,"%s.Arc%ld",arctemp2,getpid());
X#endif
X#ifdef VAXC
X else sprintf(arctemp,"Arc_%08lx",getpid());
X#else
X else sprintf(arctemp,".Arc%ld",getpid());
X#endif VAXC
X
X#if MSDOS
X /* avoid any case problems with arguments */
X
X for(n=1; n