mailbackup.c
Mor/Mor/src/mailbackup.c · 1.8 KB
From the archive Mor.zip
Download the archive « Back to the archive contents
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
/*
Bu sistemin çalýþmasý için sistemde MUTT'un kurulmuþ olmasý
ve LOG dizininde mesaj.dat isimli bir dosyanýn oluþturulmasý
gerekiyor.
*/
void do_backup (CHAR_DATA *ch, char *argument)
{
char sendstring[1000];
char attachment[100];
FILE *fp;
char arg1[MAX_INPUT_LENGTH];
#define MUTT_DIR "mutt"
#define E_MAIL "bilgi@mud.gen.tr"
#define MESSAGE "../log/emailmessage.dat"
#define SUBJECT "CC Backup"
if(argument[0]=='\0')
{
send_to_char( "Syntax: backup <source|player|area|all>\n\r",ch );
return;
}
argument = one_argument(argument,arg1);
if ( ( fp = fopen( MESSAGE, "w+" ) ) == NULL )
{
printf_to_char( ch,"I couldnt find-create %s.\n\r",MESSAGE);
return;
}
fprintf(fp,"Backup Creation: %s",(char *) ctime( ¤t_time ));
fclose(fp);
do_asave( NULL, "world" );
if(!strcmp(arg1,"src"))
{
system("rm -f ../src.zip");
system("zip -r ../src ../src");
strcpy(attachment,"../src.zip");
}
else if(!strcmp(arg1,"area"))
{
system("rm -f ../area.zip");
system("zip -r ../area ../area");
strcpy(attachment,"../area.zip");
}
else if(!strcmp(arg1,"player"))
{
system("rm -f ../player.zip");
system("zip -r ../player ../player");
strcpy(attachment,"../player.zip");
}
else if(!strcmp(arg1,"all"))
{
system("rm -f ../rom.zip");
system("zip -r ../../rom ../../rom");
strcpy(attachment,"../../rom.zip");
}
else
{
send_to_char( "Syntax: backup <src|player|area|all>\n\r",ch );
return;
}
sprintf( sendstring, "%s -s \"%s\" -a %s %s < %s", MUTT_DIR,SUBJECT, attachment, E_MAIL,MESSAGE );
system(sendstring);
send_to_char( "Backup e-mailed successfully.\n\r",ch );
}