/* -*-c,save-*- */ /* * lureorg.c - Library reorganize function * Robert Heller. Created: Sun Nov 9, 1986 20:36:51.22 * Last Mod: * * (c) Copyright 1986 by Robert Heller * All Rights Reserved * * */ #include /* STD I/O defs */ #include /* char type defs */ #include "ludef.h" /* ludefs */ #include "luvars.h" /* lu variables */ lu_reorg(argcc,argvv) FAST int *argcc; FAST char ***argvv; { LOCAL LUDIR newdir[MAXFILES]; FAST int newslots; FAST int new_fd,i,j,k,bytes; FAST long int offset; LOCAL char sectbuff[SECTSIZE]; FAST int osect,nsect,isect,active; LOCAL char tname[20]; LOCAL char answer[64]; char *p,*gets(); #ifdef CRCCHEKC unsigned short int crc,calcrc(); #endif while (*argcc > 0 && ***argvv != '-') { *argcc -= 1; *argvv += 1; } if (!lu_openp) { fprintf(stderr,"lu: library not open!\n"); return; } for (i=1, active=1; i= MAXFILES); newslots++; /* allow for directory */ /* adjust size to sector boundary */ newslots += (SECTSIZE / sizeof(LUDIR)) - 1; i = newslots % (SECTSIZE / sizeof(LUDIR)); newslots -= i; /* initialize directory entry */ newdir[0].lu_stat = ACTIVE; strncpy(newdir[0].lu_name," ",11); newdir[0].lu_off = 0; newdir[0].lu_len = ((newslots * sizeof(LUDIR)) / SECTSIZE); newdir[0].lu_crc = 0; for (p = newdir[0].lu_fill, i=0; i<14; i++, p++) *p = '\0'; for (i = 1; i < newslots; i++) newdir[i].lu_stat = UNUSED; #ifdef CRCCHECK crc = calcrc(0,&newdir[0],newslots * sizeof(LUDIR)); newdir[0].lu_crc = crc; #else newdir[0].lu_crc = 0; #endif printf("lu: new library file %s has %d entries, %d free\n",tname,newslots, newslots-1); #ifdef CPM68K for (i=0;i