/* Donation Stats (C) 1994 Subhumanz/LSD*/

#include "sc:include/ae/doorheader.h"
#include "sc:include/ae/glue.h"
#include <exec/types.h>
#include <exec/ports.h>
#include <exec/memory.h>
#include <dos/dos.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/alib_protos.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <proto/exec.h>
#include <time.h>

#ifdef LATTICE
int CXBRK(void) {return(0);} /* Disable Lattice CTRL-C handling */
int chkabort(void) {return(0);}
#endif

#define CR '\n'
#define CR1 '\x0D'
#define sm sendmessage

#define Ver "$VER: Donate 2.0 (01/22/1994) - ©1994 SuBhUmAnZ/LSD"


/* Function prototypes: */
int CheckMessage(void);
int PortStart(void);

int loadusers(char users[50][80]);
void Donating(void);
void NOTDonating(void);
void getdate(void);
void expired(char stats[500][40]);
void savestats(void);
void getconfig(void);
void sysopcmds(void);
void displayusers(void);
void addusers(void);
void editusers(void);
void delusers(void);
void centertextlf(char text[]);
void centertextnolf(char text[]);
void centertextnolfstripcr(char text[]);
void displaylogo(void);


char nothing[1];
char instring[256];
char finstring[80];
int numusers = 0;
int line_num;
char username[50];
char users[50][80];
char stats[500][40];
int temp, temp1, found, donate;
int len;
int lenusername;
char username[50], holdusername[50], fusername[50], holduseragain[50];
int ctr = 0;
char test[50];
char CS[5];
char expiredate[15];
char datenum[12], datedisp[12], expiredisp[12], expirenum[12];
char emonth[3], eday[3], eyear[5];
int x = 0;
int datecnum, dateenum;
int numusers, numstats;
int foundstats;
char config[5];
char accesslevel[5];
char answer[1];
char Pressakey[] = "Press any Key to Continue";
char asksysop[] = "Would you like the Sysop Commands? (y/N) ";
char asksysop1[] = "Choose an option! 'CR' to quit! ";
char menu[] = "*Sysop Menu*";
char menu1[] = "   1.  Display Users in Donate.users file";
char menu2[] = "   2.  Add User to Donate.users file     ";
char menu3[] = "   3.  Edit User in Donate.users file    ";
char menu4[] = "   4.  Delete User in Donate.users file  ";
char notactive[] = "Not Yet Implemented!";
int al = 0;
int cfg = 0;
char presskey[] = "Press any key for Sysop Menu";
char holdtext[100];
int y = 0;
char adduser1[35],adduser[35],addexpire[12];
char addmenu[] = "*** Add Users ***";
char editmenu[] = "*** Edit Users ***";
char delmenu[] = "*** Delete Users ***";
char addmessage[] = "Aborted!";
char addmessage1[] = "User Added";
char editmessage1[] = "User Edited";
char editmessage2[] = "User Deleted";
char errormessage[] = "User Exists!  Did not add!";
char errormessage1[] = "User Not Found.  Can't Edit!";
char errormessage2[] = "User Not Found.  Can't Delete!";
char areyousure[] = "Are you Sure? (Y/n) ";
int flag = 0;
int temp2,temp3;
char holduser[50];
int ctr1,ctr2,foundit;


void main(int argc, char *argv[])
{

	if(argc<2) /* AmiExpress will supply line_num on command line */
	{
                printf("Donation Stats V2.0 (C) 1994 SuBhUmAnZ/LSD\n");
		printf("This is a XIM door and must be called from /X.\n");
		exit(0);
	}


Register(argv[1][0]-'0');

sprintf(CS,"%c",'\x0C');

getconfig();

getuserstring(accesslevel,DT_SECSTATUS);

getuserstring(username,DT_NAME);
strcpy(holdusername,username);
strcpy(holduseragain,username);

lenusername = strlen(username);

for (temp=0;temp<lenusername;temp++)
    {username[temp] = toupper(username[temp]);}

numusers = loadusers(users);

for (temp1=1;temp1<numusers;temp1++)
     {len = strlen(users[temp1]);

      for (temp=0;temp<len;temp++)
       {users[temp1][temp] = toupper(users[temp1][temp]);}
        
        for (temp=0;temp<lenusername;temp++)
             {test[temp] = users[temp1][temp];}
                    

if (strcmp(test,username) == 0)
         {found = temp1;
          found++;
          donate = 1;
          strcpy(fusername,test);
          for (temp=30;temp<40;temp++)
          {expiredate[ctr] = users[temp1][temp];
           ctr++;}

            ctr = 0;

          for (x=0;x<4;x++)
           {eyear[ctr] = expiredate[x];
            ctr++;}

            eyear[ctr] = '\0';
            ctr = 0;

          for (x=8;x<10;x++)
           {eday[ctr] = expiredate[x];
            ctr++;}

            eday[ctr] = '\0';
            ctr = 0;


          for (x=5;x<7;x++)
           {emonth[ctr] = expiredate[x];
            ctr++;}

            emonth[ctr] = '\0';
            ctr = 0;


           sprintf(expiredisp,"%s/%s/%s",emonth,eday,eyear);
           sprintf(expirenum,"%s%s%s",eyear,emonth,eday);


         }

}

numusers = temp1;

if (donate == 1)
   {Donating();}
  else
   {NOTDonating();}



if (donate == 0)
   {goto Exitprog;}

datecnum = atoi(datenum);
dateenum = atoi(expirenum);

if (datecnum > dateenum)
   {expired(stats);}



Exitprog:

sysopcmds();

sm("",1);

ShutDown();

end();

}




int loadusers(char users[50][80])

{
int ctr = 0;
int x = 0;
int temp1 = 0;
int temp = 0;
int len = 0;

FILE *fp;

 for(x=0;x<50;x++)
    {strcpy(users[x],NULL);}
 

 if ((fp = fopen("doors:donate/donate.users", "r")) == NULL)
   { sm("Donate.users not found in Doors:donate",1);
     ShutDown();
     end();
   }
   else
       {
        while(fgets(finstring,80,fp)!=NULL)
        { 
          strcpy(users[ctr],finstring);
          ctr++;
       }
        }
        fclose(fp);

for (temp1=1;temp1<numusers;temp1++)
     {len = strlen(users[temp1]);

      for (temp=0;temp<len;temp++)
       {users[temp1][temp] = toupper(users[temp1][temp]);}
     }

return(ctr);
}

void Donating()
{

int thelen, diff, x;
char message1[] = " you are currently a donating user.";
char message2[80];
char message3[80];

getdate();
savestats();

displaylogo();

strcat(holdusername,message1);
thelen = strlen(holdusername);

diff = (80 - thelen) / 2;

for (x=0;x<diff;x++)
    {sm(" ",0); }

sm(holdusername,1);

sm(" ",1);

sprintf(message2,"%s %s!\n","                     Your Donation is good thru",expiredisp,"!");

sm(message2,1);

sprintf(message3,"%s %s!\n","                        The current date is",datedisp,"!");

sm(message3,1);

donate = 1;


putuserstring("0",DT_SECLIBRARY);

return;
}


void NOTDonating()
{


int thelen, diff, x;
char message1[] = " you are currently NOT a donating user.";

displaylogo();

strcat(holdusername,message1);
thelen = strlen(holdusername);

diff = (80 - thelen) / 2;

for (x=0;x<diff;x++)
    {sm(" ",0); }

sm(holdusername,1);

sm(" ",1);

sm("        For more information about donations leave the sysop a comment.",1);

sm(" ",1);

donate = 0;

return;
}




void expired(char stats[500][40])

{
FILE *fp;
int ctr = 0;
int ctr1 = 0;
int x;
int len;
char holduser[50];
char uratio[1], udfiles[20], udbytes[20], firstdate[12];  


len = strlen(username);


sm("                      >>> Your Donation has expired! <<<",1);
sm(" ",1);

retry:

 if ((fp = fopen("doors:donate/donate.users", "w")) == NULL)
   {if (ctr == 15)
       {sm("Could not open donate.users for write at this time!",1);
        ShutDown();
        end();}
    ctr++; 
    goto retry;}
 else
       { for (ctr=0;ctr<found-1;ctr++)
          {fprintf(fp,"%s",users[ctr]); }
         
         for (ctr=found;ctr<numusers;ctr++)
          {fprintf(fp,"%s",users[ctr]); }


        }
        fclose(fp);

ctr = 0;

if ((fp = fopen("doors:donate/donate.stats", "r")) == NULL)
   { sm("Could not open donate.stats for read!",1);
     ShutDown();
     end();}
   else
       {
        while(fgets(finstring,40,fp)!=NULL)
        {  
         for (x=0;x<len;x++)
             {holduser[ctr] = finstring[x];
              ctr++;}
 
         holduser[ctr] = '\0';
            
         
         ctr = 0;
         
         strcpy(stats[ctr1],finstring);
         if (strcmp(username,holduser) == 0)
            {foundstats = ctr1;}
         ctr1++; 

       }
        }
        fclose(fp);


numstats = ctr1;


retry1:

 if ((fp = fopen("doors:donate/donate.stats", "w")) == NULL)
   {if (ctr == 15)
       {sm("Could not open donate.stats for write at this time!",1);
        ShutDown();
        end();}
    ctr++; 
    goto retry1;}
 else
       { for (ctr=0;ctr<foundstats;ctr++)
          {fprintf(fp,"%s",stats[ctr]); }
         
         for (ctr=foundstats+5;ctr<numstats;ctr++)
          {fprintf(fp,"%s",stats[ctr]); }


        }
        fclose(fp);


strcpy(uratio,stats[foundstats+1]);
strcpy(udfiles,stats[foundstats+2]);
strcpy(udbytes,stats[foundstats+3]);
strcpy(firstdate,stats[foundstats+4]);

putuserstring(uratio,DT_SECLIBRARY);
putuserstring(udfiles,DT_DOWNLOADS);
putuserstring(udbytes,DT_BYTEDOWNLOAD);


firstdate[10] = '\0';



 if ((fp = fopen("doors:donate/donate.log", "a")) == NULL)
   { fclose(fp); }
else
   { fclose(fp); }

 if ((fp = fopen("doors:donate/donate.log", "a")) == NULL)
   { sm("Could not open donate.log for read!",1);
     ShutDown();
     end();}
   else
       {
         fprintf(fp,"%s from %s to %s\n",holduseragain, firstdate, expiredisp);
        
       }
        fclose(fp);


return;
}


void savestats(void)
{

int ctr = 0;
int x;
int check = 0;
int len;
FILE *fp;
char holduser[50];
char uratio[1], udfiles[20], udbytes[20];  
char finstring[80];


len = strlen(username);



 if ((fp = fopen("doors:donate/donate.stats", "a")) == NULL)
   { fclose(fp); }
else
   { fclose(fp); }

 if ((fp = fopen("doors:donate/donate.stats", "r")) == NULL)
   { sm("Could not open donate.stats for read!",1);
     ShutDown();
     end();}
   else
       {
        while(fgets(finstring,80,fp)!=NULL)
        {  
         for (x=0;x<len;x++)
             {holduser[ctr] = finstring[x];
              ctr++;}
 
         holduser[ctr] = '\0';
            
         if (strcmp(username,holduser) == 0)
            {check = 1;}

         ctr = 0;


       }
        }
        fclose(fp);


if (check == 1)
   {return;}


getuserstring(uratio,DT_SECLIBRARY);
getuserstring(udfiles,DT_DOWNLOADS);
getuserstring(udbytes,DT_BYTEDOWNLOAD);


 if ((fp = fopen("doors:donate/donate.stats", "a")) == NULL)
   {sm("Could not open donate.stats for append!",1);
        ShutDown();
        end();} 
   else
       {
        fprintf(fp,"%s\n",username);
        fprintf(fp,"%s\n",uratio);
        fprintf(fp,"%s\n",udfiles);
        fprintf(fp,"%s\n",udbytes);
        fprintf(fp,"%s\n",datedisp);
       }
        fclose(fp);

return;
}


void getconfig()
{

FILE *fp;


if ((fp = fopen("doors:donate/donate.config", "r")) == NULL)
   { sm("Could not open donate.config for read!",1);
     ShutDown();
     end();}
   else
       {
        fgets(config,4,fp);
        fclose(fp);
       }

return;
}
                   


void sysopcmds()
{

al=atoi(accesslevel);
cfg=atoi(config);


if(al < cfg)
  {return;}


centertextnolf(asksysop);

hotkey("",answer);


if ((answer[0] == 'y') || (answer[0] == 'Y')) 
{goto display;}

return;

display:

answer[0] = '\0';

displaylogo();

centertextlf(menu);

sm(" ",1);

centertextnolf(menu1);
centertextnolf(menu2);
centertextnolf(menu3);
centertextnolf(menu4);

sm(" ",1);

centertextnolf(asksysop1);

hotkey("",answer);

if (answer[0] == '1')
    {displayusers();}

if (answer[0] == '2')
    {addusers();}

if (answer[0] == '3')
    {editusers();}

if (answer[0] == '4')
    {delusers();}

if (answer[0] == CR1) 
    {return;}

goto display;
}

void getdate()
{

 int m,d,y;
 
 char month[3];
 char day[3];
 char year[5]; 


 long Date[3], x;
 
 DateStamp(Date);

 x = Date[0] - 2251;
 y = (4 * x + 3) / 1461;
 x -= 1461 * (long) y / 4;
 y += 1984;
 m = (5 * x + 2) / 153;
 d = x - (153 * m + 2) / 5 + 1;
 m +=3;

 if(m>12)
   {
    y++;
    m -= 12;
   }

sprintf(month,"%d",m);
sprintf(day,"%d",d);
sprintf(year,"%d",y);
 
if (strlen(month) == 1)
   {month[1] = month[0];
    month[0] = '0'; 
    month[2] = '\0';}

if (strlen(day) == 1)
   {day[1] = day[0];
    day[0] = '0'; 
    day[2] = '\0';}

sprintf(datenum,"%s%s%s",year,month,day);


sprintf(datedisp,"%s/%s/%s",month,day,year);

return;

}

void centertextlf(char text[])
{

int thelen,diff,x = 0;

thelen = strlen(text);

diff = (80 - thelen) / 2;

sm(" ",1);

for (x=0;x<diff;x++)
    {sm(" ",0); }

sm(text,1);

text = '\0';

return;
}

void centertextnolf(char text[])
{

int thelen,diff,x = 0;

thelen = strlen(text);

diff = (80 - thelen) / 2;

sm(" ",1);

for (x=0;x<diff;x++)
    {sm(" ",0); }

sm(text,0);

text = '\0';

return;
}

void centertextnolfstripcr(char text[])
{

int thelen,diff,x = 0;

thelen = strlen(text);

text[thelen-1] = '\0';

diff = (80 - thelen) / 2;

sm(" ",1);

for (x=0;x<diff;x++)
    {sm(" ",0); }

sm(text,0);

text = '\0';

return;
}


void displayusers(void)
{

char presskey[] = "Press any key for Sysop Menu";
int x=0;

numusers = 0;
temp1=0;
temp=0;
len=0;

numusers = loadusers(users); 

sm(CS,1);
sm("                                                     EXPIRE",1);
sm("                   USERNAME                            DATE",1);


 for(x=1;x<numusers;x++)
    {centertextnolfstripcr(users[x]);}
        

sm(" ",1);
centertextnolf(presskey);

hotkey("",nothing);


return;
}


void addusers(void)
{

FILE *fp;
char edituser[] = "Seaching...";

addagain:

numusers = 0;

numusers = loadusers(users); 

adduser[0] = '\0';
answer[0] = '\0';
addexpire[0] = '\0';
test[0] = '\0';
found=0;
len=0;
temp2=0;
temp3=0;
flag=0;

displaylogo();

centertextlf(addmenu);

sm(" ",1);
prompt("     Enter user name to ADD > ",adduser,29);

strcpy(adduser1,adduser);
len=strlen(adduser);

if (len == 0)
    {return;}

for(y=0;y<len;y++)
   {adduser[y] = toupper(adduser[y]);}


while(len<30)
   {strcat(adduser," ");
    len=strlen(adduser);}

sm(" ",1);

prompt("     Enter Expiration Date for USER (Format YYYY/MM/DD) > ",addexpire,9);
sm(" ",1);

len=strlen(addexpire);

while(len<10)
   {strcat(addexpire," ");
    len=strlen(addexpire);}

sprintf(holdtext,"ADD %s with an expire date of %s",adduser1,addexpire);

centertextlf(holdtext);
centertextnolf(areyousure);

hotkey("",answer);

if (answer[0] == NULL)
   {answer[0] = 'y';}

if ((answer[0] == 'n') || (answer[0] == 'N'))
  {flag = 1;}

if ((answer[0] == 'y') || (answer[0] == 'Y'))
  {flag = 2;}

if (flag == 1)
   {centertextlf(addmessage);
    centertextnolf(Pressakey); 
    hotkey("",nothing);
    goto addagain;}

sm("",1);
centertextlf(edituser);

   for (temp2=1;temp2<numusers;temp2++)
     { for (temp3=0;temp3<30;temp3++)
         {test[temp3] = users[temp2][temp3];}

if (strcmp(test,adduser) == 0)
         {found = temp2;}
     }

if (found != 0)
    {centertextlf(errormessage);
     centertextnolf(Pressakey); 
     hotkey("",nothing);
    }

if (found == 0)
    { if ((fp = fopen("doors:donate/donate.users", "a")) == NULL)
       { sm("Could not open donate.users for append!",1);
         ShutDown();
         end();}
    
         fprintf(fp,"%s%s\n",adduser,addexpire);
       
         fclose(fp);
     centertextlf(addmessage1);
     centertextnolf(Pressakey); 
     hotkey("",nothing);
     
    }

 
goto addagain;

}

void editusers(void)
{

FILE *fp;
char edituser[] = "Seaching...";

editagain:

numusers = 0;

numusers = loadusers(users); 

adduser[0] = '\0';
answer[0] = '\0';
addexpire[0] = '\0';
test[0] = '\0';
found=0;
len=0;
temp2=0;
temp3=0;
flag=0;

displaylogo();

centertextlf(editmenu);

sm(" ",1);
prompt("     Enter user name to EDIT > ",adduser,29);

strcpy(adduser1,adduser);
len=strlen(adduser);

if (len == 0)
    {return;}

while(len<30)
   {strcat(adduser," ");
    len=strlen(adduser);}

centertextlf(edituser);

for(y=0;y<len;y++)
   {adduser[y] = toupper(adduser[y]);}

   for (temp2=1;temp2<numusers;temp2++)
     { for (temp3=0;temp3<30;temp3++)
         {test[temp3] = users[temp2][temp3];}

if (strcmp(test,adduser) == 0)
         {(found = temp2);}
      }


if (found == 0)
    {centertextlf(errormessage1);
     centertextnolf(Pressakey); 
     hotkey("",nothing);
     goto editagain;
    }

sprintf(holdtext,"EDIT %s's Expiration Date? ",adduser1);

centertextlf(holdtext);
centertextnolf(areyousure);

hotkey("",answer);

if (answer[0] == NULL)
   {answer[0] = 'y';}

if ((answer[0] == 'n') || (answer[0] == 'N'))
  {flag = 1;}

if ((answer[0] == 'y') || (answer[0] == 'Y'))
  {flag = 2;}

if (flag == 1)
   {centertextlf(addmessage);
    centertextnolf(Pressakey); 
    hotkey("",nothing);
    goto editagain;}


if (found != 0)
    { 
      sm(" ",1);
      sm(" ",1);
      prompt("     Enter Expiration Date for USER (Format YYYY/MM/DD) > ",addexpire,9);

      len=strlen(addexpire);

       while(len<10)
       {strcat(addexpire," ");
        len=strlen(addexpire);}


      if ((fp = fopen("doors:donate/donate.users", "r+t")) == NULL)
       { sm("Could not open donate.users for read!",1);
         ShutDown();
         end();}

         fgets(finstring,80,fp);         
        
         fseek(fp,(found-1)*41,SEEK_CUR);         

         fprintf(fp,"%s%s\n",adduser,addexpire);
       
         fclose(fp);
     
     centertextlf(editmessage1);
     centertextnolf(Pressakey); 
     hotkey("",nothing);
     
    }

 
goto editagain;

}

void delusers(void)
{

FILE *fp;
char edituser[] = "Seaching...";
int len1,len2,check;

delagain:

numusers = 0;

numusers = loadusers(users); 

holduser[0] = '\0';
adduser[0] = '\0';
adduser1[0] = '\0';
answer[0] = '\0';
addexpire[0] = '\0';
test[0] = '\0';
found=0;
foundstats=0;
len=0;
len1=0;
len2=0;
temp2=0;
temp3=0;
ctr2=0;
ctr1=0;
ctr=0;
x=0;
flag=0;
check=0;

displaylogo();

centertextlf(delmenu);

sm(" ",1);
prompt("     Enter user name to DELETE > ",adduser,29);

len=strlen(adduser);

if (len == 0)
    {return;}

strcpy(adduser1,adduser);

for(y=0;y<len;y++)
   {adduser1[y] = toupper(adduser1[y]);}

while(len<30)
   {strcat(adduser," ");
    len=strlen(adduser);}

centertextlf(edituser);

for(y=0;y<len;y++)
   {adduser[y] = toupper(adduser[y]);}

   for (temp2=1;temp2<numusers;temp2++)
     { for (temp3=0;temp3<30;temp3++)
         {test[temp3] = users[temp2][temp3];}

if (strcmp(test,adduser) == 0)
         {(found = temp2);
          (foundit = temp2);}
      }


if (found == 0)
    {centertextlf(errormessage2);
     centertextnolf(Pressakey); 
     hotkey("",nothing);
     goto delagain;
    }

sprintf(holdtext,"DELETE %s from Donate files? ",adduser1);

centertextlf(holdtext);
centertextnolf(areyousure);

hotkey("",answer);

if (answer[0] == NULL)
   {answer[0] = 'y';}

if ((answer[0] == 'n') || (answer[0] == 'N'))
  {flag = 1;}

if ((answer[0] == 'y') || (answer[0] == 'Y'))
  {flag = 2;}

if (flag == 1)
   {centertextlf(addmessage);
    centertextnolf(Pressakey); 
    hotkey("",nothing);
    goto delagain;}


if (found != 0)
    { 
      sm(" ",1);

      retry2:

 if ((fp = fopen("doors:donate/donate.users", "w")) == NULL)
   {if (ctr == 15)
       {sm("Could not open donate.users for write at this time!",1);
        ShutDown();
        end();}
    ctr++; 
    goto retry2;}
 else
       { for (ctr=0;ctr<foundit;ctr++)
          {fprintf(fp,"%s",users[ctr]); }
         
         for (ctr=foundit+1;ctr<numusers;ctr++)
          {fprintf(fp,"%s",users[ctr]); }


        }
        fclose(fp);

ctr = 0;

if ((fp = fopen("doors:donate/donate.stats", "r")) == NULL)
   { sm("Could not open donate.stats for read!",1);
     ShutDown();
     end();}
   else
       {
        while(fgets(finstring,30,fp)!=NULL)
        {  
         for (x=0;x<30;x++)
             {holduser[ctr] = finstring[x];
              ctr++;}
 
         len1=strlen(holduser);
         
         holduser[len1-1] = '\0';
         
         len1=strlen(holduser);

         while(len1<30)
         {strcat(holduser," ");
          len1=strlen(holduser);
         }
         
         ctr = 0;
         
         strcpy(stats[ctr1],finstring);

         if (strcmp(adduser,holduser) == 0)
            {foundstats = ctr1;
             check=1;}
         ctr1++; 

       }
        }
        fclose(fp);


numstats = ctr1;

if ((foundstats == 0) && (check == 0))
    {goto skipit;}

retry3:

 if ((fp = fopen("doors:donate/donate.stats", "w")) == NULL)
   {if (ctr == 15)
       {sm("Could not open donate.stats for write at this time!",1);
        ShutDown();
        end();}
    ctr++; 
    goto retry3;}
 else
       { for (ctr=0;ctr<foundstats;ctr++)
          {fprintf(fp,"%s",stats[ctr]); }
         
         for (ctr=foundstats+5;ctr<numstats;ctr++)
          {fprintf(fp,"%s",stats[ctr]); }


        }
        fclose(fp);
 
     
          
    }

skipit:

     centertextlf(editmessage2);
     centertextnolf(Pressakey); 
     hotkey("",nothing);

 
goto delagain;

}


void displaylogo(void)
{

sm(CS,1);
sm(" ",1);
sm("                 [37;47m [1;37m                                            [0m[37;47m [0;40m",1);
sm("                 [37;47m [0m                                            [37;47m [0m",1);         
sm("                 [37;47m [0m Donation Stats V2.0 (C) 1994 SuBhUmAnZ/LSD [37;47m [0m",1);
sm("                 [37;47m [0m                                            [37;47m [0m",1);         
sm("                 [37;47m [1;37m                                            [0m[37;47m [0;40m",1);
sm(" ",1);

}

void end(void)
{

exit(0);

}

void LastCommand(void)
{

sm("",1);

}
