Category : Databases and related files
Archive   : DISKLIB.ZIP
Filename : LIB.C

 
Output of file : LIB.C contained in archive : DISKLIB.ZIP
/* LIB.C */
#include
#include
#include
#include
#include
#include
#include
#include
#include "lib.hdr"

/* ....................................... */

extern DiskRecord **DiskEntry;
extern int *FileSeq;
extern int ActiveFiles;
extern int NewDrive;
extern int StartingDrive;

/* ==================================================================== */

/* ................................................. */
static char items[81];

MenuEntry Main[] = {
{ 2,80,' ',"DISK LIBRARY SYSTEM" },
{ 4,80,' ',items },
{ 8,80,'a',"(A)dd disk " },
{ 9,80,'f',"(F)ind a file " },
{ 10,80,'k',"Find (D)isk " },
{ 11,80,'q',"(Q)uit " },
{ 12,80,'d',"(D)elete a disk " },
{ 24,80,' ',"Copyright 1988 C-Soft"},
};
/* ==================================================================== */

char *FilePrint(DiskRecord *temp)
{ unsigned date;
unsigned time;
unsigned mo;

unsigned day;
unsigned yr;
unsigned hr;
unsigned min;
static char d_t[161];

date = temp->EntryDate;
time = temp->EntryTime;

yr = date / 512;
mo = (date % 512)/32;
day = date - (512 * yr) - (mo * 32);
yr += 80;

hr = time / 2048;
min = (time % 2048) / 32;
sprintf(d_t,"%3s %-13s %02u-%02u-%02u %02u:%02u %6ld %s",temp->DiskID,
temp->EntryName,mo,day,yr,hr,
min,temp->EntrySize,(temp+1));
return d_t;
}

char MainMenu(void)
{ int n;

sprintf(items,"%d Files in Directory",ActiveFiles);
n = sizeof(Main)/sizeof(Main[0]);
return menu(Main,n);
}

main()
{ struct ffblk F;
int MenuDone = FALSE;
char DiskID[4];
void DeleteDisk(char *DiskID);
char StartingPath[81];
struct editfield E;
int ChangedDataBase = FALSE;


DiskID[0] = '\0';
StartingDrive = getdisk();
getcwd(StartingPath,80);

NewDrive = StartingDrive;

DiskEntry = (DiskRecord **)calloc(MaxFiles, sizeof(DiskRecord *));
FileSeq = (int *)malloc(MaxFiles * sizeof(int));

ClearScreen(0x1f);
ReadData();

while(!MenuDone)
{ switch(MainMenu())
{ case 'a': /* add a disk */
{ AddDisk();
ChangedDataBase = TRUE;
break;
}
case 'd': /* delete a disk */
{ GetID(DiskID,FALSE);
DeleteDisk(DiskID);
ChangedDataBase = TRUE;
break;
}
case 'f': /* find a file */
{ FindFile();
break;
}
case 'k': /* find a disk */
{ PrintDisk();
break;
}

case 'q': /* quit */
{ MenuDone = TRUE;
cursor(24,0);
break;
}
default:
{ break;
}
}
}
if(ChangedDataBase)
{ if(StartingDrive != 2) /* C drive -- assumed to be hard disk */
{ window *W;
char buff[81];
int done;

W = WindowOpen(1,10,5,5,40,0x0a,0x1f," Library Disk ");
sprintf(buff,"Place Library Disk in Drive %c ",StartingDrive +'A');
WindowPrint(W,0,1,buff);
WindowPrint(W,1,1,"Press A Key When Ready");
do
{ getch();
setdisk(StartingDrive);
done = !chdir(StartingPath);
if(!done)
{ WindowPrint(W,2,1,"Could not find correct file -- check the disk");
WindowPrint(W,3,1,"Press A Key When Ready");
}
} while(!done);
WindowClose(W);
}
else
{ setdisk(StartingDrive);
chdir(StartingPath);
}
WriteData();
}
cursor(0,0);
CursorOn();
exit(0);
}


  3 Responses to “Category : Databases and related files
Archive   : DISKLIB.ZIP
Filename : LIB.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/