Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!ames!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.SHAR02_OF_19 Message-ID: <880624092300.022@Ins.MRC.AdhocNet.CA> Date: 24 Jun 88 15:22:58 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 403 $Part02: $ File_is="ARCADD.C" $ Check_Sum_is=775976552 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY Xstatic char *RCSid = "$Header: arcadd.c,v 1.2 86/07/15 07:52:37 turner Exp $"; X X/* X * $Log:`009arcadd.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:37 turner X * X * X * Revision 1.1 86/06/26 14:59:37 turner X * initial version X * X * X */ X X/* ARC - Archive utility - ARCADD X X$define(tag,$$segment(@1,$$index(@1,=)+1))# X$define(version,Version $tag( XTED_VERSION DB =3.39), created on $tag( XTED_DATE DB =02/05/86) at $tag( XTED_TIME DB =22:21:53))# X$undefine(tag)# X $version X X(C) COPYRIGHT 1985 by System Enhancement Associates; ALL RIGHTS RESERVED X X By: Thom Henderson X X Description: X This file contains the routines used to add files to an archive. X X Language: X Computer Innovations Optimizing C86 X*/ X#include X#include "arc.h" X#ifdef VAXC X#include "dir.h" X#endif VAXC X XINT addarc(num,arg,move,update,fresh) /* add files to archive */ XINT num; /* number of arguments */ Xchar *arg[]; /* pointers to arguments */ XINT move; /* true if moving file */ XINT update; /* true if updating */ XINT fresh; /* true if freshening */ X{ X char *d, *dir(); /* directory junk */ X char *NameList;`009/* Any pointer. Used to pass file names around */ X char buf[STRLEN]; /* pathname buffer */ X char **path = NULL; /* pointer to pointers to paths */ X char **name = NULL; /* pointer to pointers to names */ X INT nfiles = 0; /* number of files in lists */ X INT notemp; /* true until a template works */ X INT nowork = 1; /* true until files are added */ X char *i, *rindex(); /* string indexing junk */ X char *malloc(), *realloc(); /* memory allocators */ X INT m, n; /* indices */ X unsigned INT coreleft(); /* remaining memory reporter */ X INT addbunch(); X X if(num<1) /* if no files named */ X { num = 1; /* then fake one */ X arg[0] = "*.*"; /* add everything */ X`009 printf("%%ARC-I-NOSPEC, File not specfied. Defaulting to *.*\n"); X } X X for(n=0; n0) X { d = path[n]; X path[n] = path[m]; X path[m] = d; X d = name[n]; X name[n] = name[m]; X name[m] = d; X } X } X } X X for(n=0; n=0) X break; /* found our spot */ X X writehdr(&ohdr,new); /* entry preceeds update; keep it */ X filecopy(arc,new,ohdr.size); X starts = ftell(arc); /* now where are we? */ X } X X if(upd) /* if an update */ X { if(note) X { printf("Updating file: %-12s ",name); fflush(stdout);} X fseek(arc,ohdr.size,1); X } X else if(fresh) /* else if freshening */ X { fseek(arc,starts,0); /* then do not add files */ X fclose(f); X return; X } X else /* else adding a new file */ X { if(note) X { printf("Adding file: %-12s ",name); fflush(stdout);} X fseek(arc,starts,0); /* reset for next time */ X } X } X X else /* no existing archive */ X { if(fresh) /* cannot freshen nothing */ X { fclose(f); X return; X } X else if(note) /* else adding a file */ X { printf("Adding file: %-12s ",name); fflush(stdout);} X } X X starts = ftell(new); /* note where header goes */ X hdrver = ARCVER; /* anything but end marker */ X writehdr(&nhdr,new); /* write out header skeleton */ X pack(f,new,&nhdr); /* pack file into archive */ X fseek(new,starts,0); /* move back to header skeleton */ X writehdr(&nhdr,new); /* write out real header */ X fseek(new,nhdr.size,1); /* skip over data to next header */ X fclose(f); /* all done with the file */ X} X $ GoSub Convert_File $ File_is="ARCCODE.C" $ Check_Sum_is=1750696541 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY Xstatic char *RCSid = "$Header: arccode.c,v 1.1 86/06/26 14:59:53 turner Exp $"; X X/* X * $Log:`009arccode.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.1 86/06/26 14:59:53 turner X * initial version X * X * X */ X X/* ARC - Archive utility - ARCCODE X X$define(tag,$$segment(@1,$$index(@1,=)+1))# X$define(version,Version $tag( XTED_VERSION DB =1.02), created on $tag( XTED_DATE DB =01/20/86) at $tag( XTED_TIME DB =13:33:35))# X$undefine(tag)# X $version X X(C) COPYRIGHT 1985 by System Enhancement Associates; ALL RIGHTS RESERVED X X By: Thom Henderson X X Description: X This file contains the routines used to encrypt and decrypt X data in an archive. The encryption method is nothing fancy, X being just a routine XOR, but it is used on the packed data, X and uses a variable length key. The end result is something X that is in theory crackable, but I'd hate to try it. It should X be more than sufficient for casual use. X X Language: X Computer Innovations Optimizing C86 X*/ X#include X#include "arc.h" X Xstatic char *p; /* password pointer */ X XINT setcode() /* get set for encoding/decoding */ X{ X p = password; /* reset password pointer */ X} X XINT code(c) /* encode some character */ XINT c; /* character to encode */ X{ X if(p) /* if password is in use */ X { if(!*p) /* if we reached the end */ X p = password; /* then wrap back to the start */ X return c^*p++; /* very simple here */ X } X else return c; /* else no encryption */ X} X $ GoSub Convert_File $ Goto Part03