home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beijing Paradise BBS Backup
/
PARADISE.ISO
/
software
/
BBSDOORW
/
MUL100.ZIP
/
CALLSTAT.SCR
< prev
next >
Wrap
Text File
|
1993-02-01
|
9KB
|
209 lines
// CALLSTAT.SCR -- Maximus Call Statistics Report -- Version 1.00
//
// Script program for MUL - the Maximus User Language
// MUL is (C) Copyright 1990-93 by CodeLand Australia
// CALLSTAT scans the Maximus USER.BBS file, and writes an 'avatar'
// *.BBS file for online display.
char *rfile = "CALLSTAT.BBS"; // Path & name of report file
char *ufile = "USER.BBS"; // Path & name of Maximus user file
//char *ufile = "C:\\BBS\\USER.BBS"; // Path & name of Maximus user file
char *banner = "CALLSTAT v1.00"; // Script banner
char *desc = "Call Statistics Reporter"; // Description
char MCLS=0x0C; // Avatar 'clear screen'
char MENTER=0x01; // Maximus 'press enter'
char MMOREOFF=0x0B; // Maximus 'more off'
int lastcall=0; // Last call <30 count
int C[11]; // Calls data array
long fp; // Report file handle
main () // Main program
{
printf ("\n%s - %s\n\n",banner,desc); // Announce
if (!BaseOpenR (ufile)) {
printf ("ERROR opening user file %s\n",ufile);
saybibi (); exit ();
}
scanufile (); // Process the user file
writereport (); // Write the *.BBS file
BaseClose (); // Close the user base
saybibi (); // Was it good for you too?
}
scanufile () // Collect data
{
int i;
printf ("Collecting the calls data 1");
for (i=2;i<=BaseCount ();++i) { // For all records
if (!BaseRead (i)) break; // Read user record
// Notify
if (!(i%20)) printf("%c%c%c%c%4u",8,8,8,8,i);
// Update data array
if (USRcalls== 1 ) C[0]=C[0]+1; // 1
else if (USRcalls> 1 && USRcalls< 10) C[1]=C[1]+1; // 1 - 9
else if (USRcalls> 9 && USRcalls< 20) C[2]=C[2]+1; // 10 - 19
else if (USRcalls> 19 && USRcalls< 30) C[3]=C[3]+1; // 20 - 29
else if (USRcalls> 29 && USRcalls< 40) C[4]=C[4]+1; // 30 - 39
else if (USRcalls> 39 && USRcalls< 50) C[5]=C[5]+1; // 40 - 49
else if (USRcalls> 49 && USRcalls< 75) C[6]=C[6]+1; // 50 - 74
else if (USRcalls> 74 && USRcalls<100) C[7]=C[7]+1; // 75 - 99
else if (USRcalls> 99 && USRcalls<250) C[8]=C[8]+1; // 100 - 249
else if (USRcalls>249 && USRcalls<400) C[9]=C[9]+1; // 250 - 399
else C[10]=C[10]+1; // 400+
// Last call less than 30 days count
if (BaseDaysLCall ()<30) ++lastcall;
}
printf ("%c%c%c%c%4u\n",8,8,8,8,BaseCount ()); // End notify
}
// AVAILABLE COLOUR CONSTANTS
// Foreground & Background:
// BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LGREY
// Foreground ONLY:
// DGREY, LBLUE, LGREEN, LCYAN, LRED, LMAGENTA, YELLOW, WHITE
writereport () // Write the .BBS report file
{
char cbx1[5], cbx2[5], cbx3[5], cbx4[5];
char chd1[5], chd2[5], chd3[5], chd4[5];
char cbd1[5], cbd2[5], cbd3[5], cbd4[5];
char cgr1[5], cgr2[5], cgr3[5];
fp=fopen (rfile,"wb"); // Open report file
if (fp==NULL) return;
printf ("Writing report file \"%s\" ",rfile);
// Get avatar colour strings
strcpy (cbx1,Avt (YELLOW,BLACK)); strcpy (cbx2,Avt (LGREY,BLACK));
strcpy (cbx3,Avt (LCYAN,BROWN)); strcpy (cbx4,Avt (DGREY,BLACK));
strcpy (chd1,Avt (YELLOW,RED)); strcpy (chd2,Avt (LGREY,RED));
strcpy (chd3,Avt (LGREEN,BLACK)); strcpy (chd4,Avt (BROWN,LGREY));
strcpy (cbd1,Avt (LGREY,BROWN)); strcpy (cbd2,Avt (CYAN,BLACK));
strcpy (cbd3,Avt (LRED,BLACK)); strcpy (cbd4,Avt (WHITE,BLACK));
strcpy (cgr1,Avt (LCYAN,BLUE)); strcpy (cgr2,Avt (LBLUE,BLACK));
strcpy (cgr3,Avt (LGREEN,BLUE));
fputc (MCLS,fp); fputc (MMOREOFF,fp); // Output CLS and MoreOff
fprintf (fp,"\n %s┌────────────────────────────────────────────────────────────────────────────┐\n",cbx1);
fprintf (fp," %s│ %s Caller Statistics Report %sMUL v%s - the Maximus User Language %s │\n",cbx1,chd1,chd2,VERSN,cbx1);
fprintf (fp," %s│%s┌──────────────────────────────────────────────────────────────────────────┐%s│\n",cbx1,cbx2,cbx1);
fprintf (fp," %s│%s│ %s┌──────────────────┐%s │%s│\n",cbx1,cbx2,cbx3,cbx2,cbx1);
fprintf (fp," %s│%s│ %sSystem Calls Graph %s│%s System Calls %s│%s │%s│\n",cbx1,cbx2,chd3,cbx3,chd4,cbx3,cbx2,cbx1);
fprintf (fp," %s│%s│ %s┌─ %s┌───────────────────────────────────────────┐%s %s├──────────────────┤%s │%s│\n",cbx1,cbx2,cbx4,cgr1,cbx1,cbx3,cbx2,cbx1);
// Line 11
fprintf (fp," %s│%s│ %s│%s100 %s┤%s ",cbx1,cbx2,cbx4,cgr2,cgr1,cgr3);
do_graphline (95,100);
fprintf (fp," %s│%s %s│%s 1 %5u %s│%s %s│%s│\n",cgr1,cbx1,cbx3,cbd1,C[0],cbx3,cbx1,cbx2,cbx1);
// Line 10
fprintf (fp," %s│%s│ %s│ %s┤%s ",cbx1,cbx2,cbx4,cgr1,cgr3);
do_graphline (85,90);
fprintf (fp," %s│%s %s│%s 2 - 9 %5u %s│%s %s│%s│\n",cgr1,cbx1,cbx3,cbd1,C[1],cbx3,cbx1,cbx2,cbx1);
// Line 9
fprintf (fp," %s│%s│ %s│%s 80 %s┤%s ",cbx1,cbx2,cbx4,cgr2,cgr1,cgr3);
do_graphline (75,80);
fprintf (fp," %s│%s %s│%s 10 - 19 %5u %s│%s %s│%s│\n",cgr1,cbx1,cbx3,cbd1,C[2],cbx3,cbx1,cbx2,cbx1);
// Line 8
fprintf (fp," %s│%s│ %sU %s┤%s ",cbx1,cbx2,cbd2,cgr1,cgr3);
do_graphline (65,70);
fprintf (fp," %s│%s %s│%s 20 - 29 %5u %s│%s %s│%s│\n",cgr1,cbx1,cbx3,cbd1,C[3],cbx3,cbx1,cbx2,cbx1);
// Line 7
fprintf (fp," %s│%s│ %ss%s 60 %s┤%s ",cbx1,cbx2,cbd2,cgr2,cgr1,cgr3);
do_graphline (55,60);
fprintf (fp," %s│%s %s│%s 30 - 39 %5u %s│%s %s│%s│\n",cgr1,cbx1,cbx3,cbd1,C[4],cbx3,cbx1,cbx2,cbx1);
// Line 6
fprintf (fp," %s│%s│ %se %s┤%s ",cbx1,cbx2,cbd2,cgr1,cgr3);
do_graphline (45,50);
fprintf (fp," %s│%s %s│%s 40 - 49 %5u %s│%s %s│%s│\n",cgr1,cbx1,cbx3,cbd1,C[5],cbx3,cbx1,cbx2,cbx1);
// Line 5
fprintf (fp," %s│%s│ %sr%s 40 %s┤%s ",cbx1,cbx2,cbd2,cgr2,cgr1,cgr3);
do_graphline (35,40);
fprintf (fp," %s│%s %s│%s 50 - 74 %5u %s│%s %s│%s│\n",cgr1,cbx1,cbx3,cbd1,C[6],cbx3,cbx1,cbx2,cbx1);
// Line 4
fprintf (fp," %s│%s│ %ss %s┤%s ",cbx1,cbx2,cbd2,cgr1,cgr3);
do_graphline (25,30);
fprintf (fp," %s│%s %s│%s 75 - 99 %5u %s│%s %s│%s│\n",cgr1,cbx1,cbx3,cbd1,C[7],cbx3,cbx1,cbx2,cbx1);
// Line 3
fprintf (fp," %s│%s│ %s│%s 20 %s┤%s ",cbx1,cbx2,cbx4,cgr2,cgr1,cgr3);
do_graphline (15,20);
fprintf (fp," %s│%s %s│%s 100 - 249 %5u %s│%s %s│%s│\n",cgr1,cbx1,cbx3,cbd1,C[8],cbx3,cbx1,cbx2,cbx1);
// Line 2
fprintf (fp," %s│%s│ %s│ %s┤%s ",cbx1,cbx2,cbx4,cgr1,cgr3);
do_graphline (5,10);
fprintf (fp," %s│%s %s│%s 250 - 399 %5u %s│%s %s│%s│\n",cgr1,cbx1,cbx3,cbd1,C[9],cbx3,cbx1,cbx2,cbx1);
// Line 1
fprintf (fp," %s│%s│ %s│%s 1 %s┤%s ",cbx1,cbx2,cbx4,cgr2,cgr1,cgr3);
do_graphlinelast (0,1);
fprintf (fp," %s│%s %s│%s 400+ %5u %s│%s %s│%s│\n",cgr1,cbx1,cbx3,cbd1,C[10],cbx3,cbx1,cbx2,cbx1);
fprintf (fp," │%s│ %s│ %s└─┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─┘%s %s│%s Calls Users %s│%s │%s│\n",cbx2,cbx4,cgr1,cbx1,cbx3,cbd1,cbx3,cbx2,cbx1);
fprintf (fp," │%s│ %s│%s 1 2-9 10 20 30 40 50 75 100 250 400+ %s└──────────────────┘%s │%s│\n",cbx2,cbx4,cgr2,cbx3,cbx2,cbx1);
fprintf (fp," │%s│ %s└────────────────── %sCalls Logged %s────────────────┘ %s│%s│\n",cbx2,cbx4,cbd2,cbx4,cbx2,cbx1);
fprintf (fp," │%s└ %sOut of a total of %s%4u%s accounts, %s%4u%s were accessed in the last 30 days %s┘%s│\n",cbx2,cbd3,cbd4,BaseCount (),cbd3,cbd4,lastcall,cbd3,cbx2,cbx1);
fprintf (fp," └────────────────────────────────────────────────────────────────────────────┘\n");
// Press Enter prompt and CLS
fprintf (fp,"%s %c",Avt (WHITE,BLACK),MENTER);
fprintf (fp,"%s%c",Avt (LGREY,BLACK),MCLS);
putch ('\n'); // End notify
}
do_graphline (int val1, int val2) // Plot a graph line
{
int i;
char ch;
for (i=0;i<10;++i) {
ch=' ';
if (C[i]>val1) ch='▄';
if (C[i]>val2) ch='█';
fprintf (fp,"%c ",ch);
}
ch=' ';
if (C[10]>val1) ch='▄';
if (C[10]>val2) ch='█';
fputc (ch,fp);
}
do_graphlinelast (int val1, int val2) // Plot last graph line
{
int i;
char ch;
for (i=0;i<10;++i) {
ch='█';
if (C[i]==val1) ch=' ';
if (C[i]==val2) ch='▄';
fprintf (fp,"%c ",ch);
}
ch='█';
if (C[10]==val1) ch=' ';
else if (C[10]==val2) ch='▄';
fputc (ch,fp);
}
// Byebye
saybibi ()
{
puts ("\nCallStat done!\n");
}
// End of script