home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beijing Paradise BBS Backup
/
PARADISE.ISO
/
software
/
BBSDOORW
/
MUL100.ZIP
/
PACK.SCR
< prev
next >
Wrap
Text File
|
1993-02-01
|
6KB
|
147 lines
// PACK.SCR -- Maximus User Base Packer -- Version 1.00
//
// Script program for MUL - the Maximus User Language
// MUL is (C) Copyright 1990-93 by CodeLand Australia
// PACK scans your user base, marking records deleted that have not
// called within the days since last call values set below, and then
// packs the user base to remove the deleted records. Fairly simple,
// this script is easily modified to include other deletion criteria,
// such as key possession, credit value, etc.
// PACK optionally logs deleted records to a Binkley style log file, see
// the 'syslog' variable setting below.
char *ufile = "USER.BBS"; // Path & name of Maximus user file
//char *ufile = "C:\\BBS\\USER.BBS"; // Path & name of Maximus user file
//char *syslog = ""; // No log file
char *syslog = "PACK.LOG"; // Log file name
// Delete criteria, edit to suit your preference
int HiddenDys = 30; // Delete days since last call
int TwitDys = 30; // Delete days since last call
int DisgraceDys = 30; // Delete days since last call
int LimitedDys = 60; // Delete days since last call
int NormalDys = 180; // Delete days since last call
int WorthyDys = 210; // Delete days since last call
int PrivilDys = 240; // Delete days since last call
int FavoredDys = 270; // Delete days since last call
int ExtraDys = 360; // Delete days since last call
int ClerkDys = 360; // Delete days since last call
int AsstsysopDys = 360; // Delete days since last call
int SysopDys = 360; // Delete days since last call
char *banner = "PACK v1.00"; // Script banner
char *desc = "Maximus User Base Packer"; // Description
int backch=0xB0; // Background fill character
int bdr = 0; // Window border type
int battr = Attr (WHITE,RED); // Colour - window border
int qattr = Attr (LRED,RED); // Colour - windows headings
int wattr = Attr (BLACK,RED); // Colour - window body
int fattr = Attr (YELLOW,BLACK); // Colour - window fields
int deleted=0; // Records deleted count
char buf[128]; // Work buffer
main () // Main program
{
int rec=2;
if (!BaseOpen (ufile)) {
printf ("\nERROR opening user file \"%s\"\n\n",ufile);
exit ();
}
background (); // Display background
if (Wopen (15,8,22,70,bdr,battr,battr)) {
Wshadow (Attr (LGREY,BLACK));
Wxyprintf (0,12,qattr,"%s - %s",banner,desc);
Wxyputs (2, 3,wattr,"Action:");
Wxyputs (2,26,wattr,"Record:"); Wxyputs (2,34,fattr," 1");
Wxyputs (2,42,wattr,"Deleted:"); Wxyputs (2,51,fattr," 0");
Wxyputs (4,3,wattr,"Name:");
Wxyputs (4,11,fattr," ");
// Log the start
sprintf (buf,"Pack begin, found %u records",BaseCount ());
SysLog (syslog,buf);
// Delete scan
Wxyputs (2,11,fattr,"Delete Scan");
while (BaseRead (rec)) {
if (!(rec%20)) Wxyprintf (2,34,fattr,"%4d",rec);
delete_check (rec);
++rec;
}
if (deleted) {
Wxyputs (2,34,fattr," ");
Wxyputs (2,11,fattr,"Base Pack ");
BasePack (ufile);
}
// Log ending
sprintf (buf,"Pack end, %u records deleted",deleted);
SysLog (syslog,buf);
Wclose ();
}
Wclose (); Wclose (); // Close windows
BaseClose (); // Close the user base
}
background () // Display background
{
Wfillch (backch);
Wopen (0,0,NumRows ()-1,NumCols ()-1,5,0,Attr (RED,LGREY));
Wfillch (0x20);
Hidecur (); // Hide the cursor
About (-2); // MUL title window
}
// This function may be modified to include other deletion criteria
delete_check (int rec) // Check record for deletion
{
int c=BaseDaysLCall ();
if (USRflagdel) return; // If already deleted
if (USRflagperm) return; // If a permanent record
// Check days since last call for priviledge level
if (USRpriv==HIDDEN ) { if (c>HiddenDys ) delete_record (rec,c); }
else if (USRpriv==TWIT ) { if (c>TwitDys ) delete_record (rec,c); }
else if (USRpriv==DISGRACE ) { if (c>DisgraceDys ) delete_record (rec,c); }
else if (USRpriv==LIMITED ) { if (c>LimitedDys ) delete_record (rec,c); }
else if (USRpriv==NORMAL ) { if (c>NormalDys ) delete_record (rec,c); }
else if (USRpriv==WORTHY ) { if (c>WorthyDys ) delete_record (rec,c); }
else if (USRpriv==PRIVIL ) { if (c>PrivilDys ) delete_record (rec,c); }
else if (USRpriv==FAVORED ) { if (c>FavoredDys ) delete_record (rec,c); }
else if (USRpriv==EXTRA ) { if (c>ExtraDys ) delete_record (rec,c); }
else if (USRpriv==CLERK ) { if (c>ClerkDys ) delete_record (rec,c); }
else if (USRpriv==ASSTSYSOP) { if (c>AsstsysopDys) delete_record (rec,c); }
else if (USRpriv==SYSOP ) { if (c>SysopDys ) delete_record (rec,c); }
}
delete_record (int rec, int days) // Delete the record
{
USRflagdel=1; // Set delete flag
BaseWrite (rec); // Update the user file
++deleted; // Count the deletion
Wxyprintf (2,51,fattr,"%4d",deleted); // Report count
Wxyprintf (4,11,fattr,"%-35s",USRname); // Report deleted name
// Log the deletion
sprintf (buf,"Pack Deleting %-20s (%s %3u days)",
USRname,BasePrivStr (USRpriv),days);
SysLog (syslog,buf);
}
// End of script