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

int ()
{

 FILE *fp;
 char [100];
 int flag = 0;
 system("rm index.html*");
 system("wget http://www.cs.rmit.edu./students/");
 system("wget -p --convert-links http://www.cs.rmit.edu./students/");
 system("mv index.html index1.html");
 sleep(8640);
 system("wget http://www.cs.rmit.edu./students/");
 system("wget -p --convert-links http://www.cs.rmit.edu./students/");

 system("diff index1.html index.html > out.txt");

 fp = fopen("out.txt","r");

 if (fgets(,100,fp) != NULL)
 {

   flag = 1;
   printf("\nThere  changes in the website.Check your mail\n");
   system("mailx -s \"output of watchdog\"  < out.txt");

 }

  if(flag == 0 )
   printf("\n    changes in the website\n ");
 fclose(fp);
 exit(1);

 }















#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/time.h>



void emptyFile(char* name)
{
	FILE* myFile;
	myFile = fopen(name,"w");
	fclose(myFile);
}

int (void)
{
	FILE* myFile;
	char* myString;
	
	myString = malloc(sizeof(char ) * 100);

	
	
	emptyFile(".old.html");
	emptyFile(".new.html");

	
	system("wget -O .old.html -q http://www.cs.rmit.edu./students/");

	while(1)
	{
		
		emptyFile(".new.html");

		
		system("wget -O .new.html -q http://www.cs.rmit.edu./students/");
		
		
		system("diff .old.html .new.html > watch.txt");

		myFile = fopen("watch.txt","r");
		if(myFile != (FILE*) NULL)
		{
			fgets(myString,100,myFile);
			if(strlen(myString) > 0)
			{
				
				
				system("mail @cs.rmit.edu. < watch.txt");
				
				system("cp .new.html .old.html");
			}
		}
		
		sleep(60*60*24);
	}
	
	return 1;
}


