#include "stdio.h" /* RETRN.C .. RETURN FILES TO DISK */ /* program to allocate space on disk */ /* and set new creation dates */ main() /* MAIN PROGRAM */ { char line[50],name[15],date[10]; char tdate[10]; int size,blk,sblk; int err,nfiles,ndel,nfail; FILE *fopen(),*fpin,*fpout; nfiles=0; ndel=0; nfail=0; /* open files */ fpin=fopen("dk:backup.get","rn"); fpout=fopen("dk:retrn1.com","wn"); if(fpin!=NULL && fpout!=NULL) { printf("ENTER TODAYS DATE (DD-MMM-YY) "); gets(tdate); while(fgetss(line,42,fpin)!=NULL) { err=sscanf(line,"%14s%5d%5d-%2d%9s",name,&size,&blk,&sblk,date); if(err<0)break; fprintf(fpout,"DATE %9s\r\n",date); fprintf(fpout,"CREATE %-14s /ALLOCATE:%d \r\n",name,size); err=delete(name); nfiles++; if(err==0)nfail++; else if(err==1)ndel++; } fprintf(fpout,"DATE %9s\r\n",tdate); fclose(fpout); } else { if(fpin==NULL) printf("'backup.get' not opened"); if(fpout==NULL) printf("'retrn1.com' not opened"); } printf("\nSUMMARY OF FILES DELETED ..\n"); printf(" %5d files were deleted \n",ndel); printf(" %5d files were NOT on the system \n",nfail); printf(" -----\n %5d FILES TO BE RESTORED \n",nfiles); }