/* ARC - Archive utility - ARCCVT (C) COPYRIGHT 1985 by System Enhancement Associates; ALL RIGHTS RESERVED By: Thom Henderson Description: This file contains the routines used to convert archives to use newer file storage methods. Language: Computer Innovations Optimizing C86 */ #include #include "arc.h" static char tempname[STRLEN]; /* temp file name */ cvtarc(num,arg) /* convert archive */ int num; /* number of arguments */ char *arg[]; /* pointers to arguments */ { struct heads hdr; /* file header */ int cvt; /* true to convert current file */ int did[MAXARG]; /* true when argument was used */ int n; /* index */ char *makefnam(); /* filename fixer */ FILE *fopen(); /* file opener */ if(arctemp) /* use temp area if specified */ sprintf(tempname,"%s/$ARCTEMP.CVT",arctemp); else makefnam("$ARCTEMP.CVT",arcname,tempname); openarc(1); /* open archive for changes */ for(n=0; nname); unpack(arc,tmp,hdr); /* unpack the entry */ fseek(tmp,0L,0); /* reset temp for reading */ starts = ftell(new); /* note where header goes */ hdrver = ARCVER; /* anything but end marker */ writehdr(hdr,new); /* write out header skeleton */ pack(tmp,new,hdr); /* pack file into archive */ fseek(new,starts,0); /* move back to header skeleton */ writehdr(hdr,new); /* write out real header */ fseek(new,hdr->size,1); /* skip over data to next header */ fclose(tmp); /* all done with the file */ if(unlink(tempname) && warn) { printf("Cannot unsave %s\n",tempname); nerrs++; } }