home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
linuxmafia.com 2016
/
linuxmafia.com.tar
/
linuxmafia.com
/
waygate
/
machin.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-26
|
4KB
|
184 lines
/*
* Machin Shin Auto-Haunter for the Wheel of Time WWW Archives at
* faser.cs.olemiss.edu and polyhymnia.iwr.uni-heidelberg.de
*
* compile it and run it in the background from the jordan directory.
* before starting it, do 'ln no-haunt/* .' in the jordan
* directory.
* If you don't like the setup, move all from no-haunt into this directory
* and don't run it.
*
* (c) HG 1995
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <strings.h>
#include <signal.h>
#define DIR "no-haunt/"
#define SECONDS 10
#define DEBUG 0
#define HAUNTS 10
int filenumber[10];
char truename[1024];
char *Files[100]={"DOD.html",
"FAQ-1.html",
"FAQ-10.html",
"FAQ-11.html",
"FAQ-2.html",
"FAQ-3.html",
"FAQ-4.html",
"FAQ-5.html",
"FAQ-6.html",
"FAQ-7.html",
"FAQ-8.html",
"FAQ-9.html",
"FAQ.html",
"GH.html",
"GH_OP.html",
"JordanFilk.html",
"Loony_Ideas.html",
"Manetheren_Girls.html",
"MissLoC.html",
"Money_for_nothing.html",
"Old.Humor-1.html",
"Old.Humor-2.html",
"Old.Humor.html",
"RollingAiel.html",
"TheyMight.html",
"Wheel_of_Pooh.html",
"comment-form.html",
"dc-social.html",
"erica-poem.html",
"hoax.expose.html",
"hoax.summary.html",
"homepages.html",
"jordanites.html",
"loc-contest-1.html",
"loc-contest-10.html",
"loc-contest-11.html",
"loc-contest-12.html",
"loc-contest-13.html",
"loc-contest-14.html",
"loc-contest-15.html",
"loc-contest-16.html",
"loc-contest-17.html",
"loc-contest-18.html",
"loc-contest-19.html",
"loc-contest-2.html",
"loc-contest-20.html",
"loc-contest-21.html",
"loc-contest-3.html",
"loc-contest-4.html",
"loc-contest-5.html",
"loc-contest-6.html",
"loc-contest-7.html",
"loc-contest-8.html",
"loc-contest-9.html",
"loc-contest.html",
"mistress-madwen.html",
"preLoC-1.html",
"preLoC-2.html",
"preLoC-3.html",
"preLoC-4.html",
"preLoC-5.html",
"preLoC-6.html",
"preLoC-7.html",
"preLoC-8.html",
"preLoC-9.html",
"preLoC.html",
"second.survey.results.html",
"tfoh.plot.contest-1.html",
"tfoh.plot.contest-10.html",
"tfoh.plot.contest-11.html",
"tfoh.plot.contest-12.html",
"tfoh.plot.contest-13.html",
"tfoh.plot.contest-14.html",
"tfoh.plot.contest-15.html",
"tfoh.plot.contest-2.html",
"tfoh.plot.contest-3.html",
"tfoh.plot.contest-4.html",
"tfoh.plot.contest-5.html",
"tfoh.plot.contest-6.html",
"tfoh.plot.contest-7.html",
"tfoh.plot.contest-8.html",
"tfoh.plot.contest-9.html",
"tfoh.plot.contest.html",
"two.rivers.plot.contest-1.html",
"two.rivers.plot.contest-10.html",
"two.rivers.plot.contest-11.html",
"two.rivers.plot.contest-2.html",
"two.rivers.plot.contest-3.html",
"two.rivers.plot.contest-4.html",
"two.rivers.plot.contest-5.html",
"two.rivers.plot.contest-6.html",
"two.rivers.plot.contest-7.html",
"two.rivers.plot.contest-8.html",
"two.rivers.plot.contest-9.html",
"two.rivers.plot.contest.html" ,
"MachinShin.html"};
#define NOFFILES 95
void sighandler()
{
int i;
for (i=0;i<HAUNTS;i++) {
strcpy(truename,DIR);
strcat(truename,Files[filenumber[i]]);
unlink (Files[filenumber[i]]);
link (truename,Files[filenumber[i]]);
}
exit(0);
}
void main()
{
int i;
struct sigaction act;
struct timeval tp;
struct timezone tzp;
act.sa_handler = sighandler;
act.sa_mask = 0;
act.sa_flags = 0;
sigaction(SIGHUP, &act, NULL);
sigaction(SIGINT, &act, NULL);
sigaction(SIGQUIT, &act, NULL);
sigaction(SIGTERM, &act, NULL);
sigaction(SIGUSR1, &act, NULL);
sigaction(SIGUSR2, &act, NULL);
i=gettimeofday(&tp,&tzp);
srand ((int) tp.tv_sec);
while (1) {
for (i=0;i<HAUNTS;i++) {
filenumber[i] = rand() % NOFFILES;
strcpy(truename,DIR);
strcat(truename,Files[NOFFILES]);
unlink (Files[filenumber[i]]);
link (truename,Files[filenumber[i]]);
#if DEBUG
fprintf(stderr, "Haunting %s\n", Files[filenumber[i]]);
#endif
}
sleep (SECONDS);
for (i=0;i<HAUNTS;i++) {
strcpy(truename,DIR);
strcat(truename,Files[filenumber[i]]);
unlink (Files[filenumber[i]]);
link (truename,Files[filenumber[i]]);
}
}
}