#include <sys/time.h>
#include <strings.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>


int ()
{
  FILE *fp ,*fp1;
  char pass[15], *getWord;
  system("wget -p --convert-links http://www.cs.rmit.edu./students/");
  system("mkdir previous");
  system("mv www.cs.rmit.edu./images/*.*   previous/");
  system("mv www.cs.rmit.edu./students/*.* previous/");
  system("cd www.cs.rmit.edu./images");
  system("cksum *.* > ../../cksum1.txt");
  sleep(10000);
  system("cd .. ");
  system("cd .. ");
  system("wget -p --convert-links http://www.cs.rmit.edu./students/");
  system("mkdir current");
  system("mv www.cs.rmit.edu./images/*.*  current/");
  system("mv www.cs.rmit.edu./students/*.* current/");
  system("cd www.cs.rmit.edu./images");
  system("cksum *.* > ../../cksum2.txt");
  system("diff cksum1.txt cksum2.txt> checksumdifference.txt");
  system("diff previous current > difference.txt");
  fp1 =fopen("difference.txt","r");
  getWord = fgets(pass, 15, fp1);
  if(strlen(getWord)!= 0)
  system("mailx -s   \"Difference in  \"    < difference.txt ");
  fp =fopen("checksumdifference.txt","r");
  getWord = fgets(pass, 15, fp);
  if(strlen(getWord)!= 0)
    system("mailx -s  \"Difference in \"   < checksumdifference.txt");

  return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>


int  (int argc, char *argv[])
{
   FILE *fp;
     
   while(1)
   {       
      system("wget -p http://www.cs.rmit.edu./students");
      
      
      
      system("mkdir Images");
      
      if((fp=fopen("/home/s//SECAS02ANS/Images/file.txt","r"))==NULL)
      { 
         system("cd www.cs.rmit.edu./images | ls > /home/s//SECAS02ANS/Images/file.txt");
	 system("md5sum www.cs.rmit.edu./images/*.* > /home/s//SECAS02ANS/Images/file.txt");
	 fclose(fp);
	 exit(0);
      }
      else
      {          
         fp=fopen("/home/s//SECAS02ANS/Images/file.txt","r");
	 system("cd www.cs.rmit.edu./images | ls > www.cs.rmit.edu./file.txt");
	 system("md5sum www.cs.rmit.edu./images/*.* > www.cs.rmit.edu./file.txt");
	 system("diff /home/s//SECAS02ANS/Images/file.txt www.cs.rmit.edu./file.txt | mail @cs.rmit.edu.");
	 system("mv www.cs.rmit.edu./file.txt /home/s//SECAS02ANS/Images");
	 fclose(fp);
      }
      
      
      
      system("mkdir Text");
      
      if((fp=fopen("/home/s//SECAS02ANS/Text/index.html","r"))==NULL)
      { 
         system("cp www.cs.rmit.edu./students/index.html /home/s//SECAS02ANS/Text");
	 exit(0);
      }
      else
      {          
      	 fopen("/home/s//SECAS02ANS/Text/index.html","r");
	 system("diff /home/s//SECAS02ANS/Text/index.html www.cs.rmit.edu./students/index.html | mail @cs.rmit.edu.");
	 system("mv www.cs.rmit.edu./students/index.html /home/s//SECAS02ANS/Text");
	 fclose(fp);
      }     
       
      
      
      sleep(86400);
    }	 
    return (EXIT_SUCCESS);
}
     
	   
	  	
