initial commit
[old-and-random.git] / ccdc / syslogd.c
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 int count, r, c;
5
6 unsigned time_seed()
7 {
8   time_t now = time ( 0 );
9   unsigned char *p = (unsigned char *)&now;
10   unsigned seed = 0;
11   size_t i;
12
13   for ( i = 0; i < sizeof now; i++ )
14     seed = seed * ( 100 + 2U ) + p[i];
15
16   return seed;
17 }
18
19 unsigned help() {
20   printf("usage: syslogd [-drvh] [-l hostlist] [-m markinterval] [-n] [-p path] [-s domainlist] [-f conffile]\n");
21   exit(0);
22 }
23  
24 int main(int argc, char *argv[ ]) {
25   //printf("goodtimes\n");
26   sleep(1);
27   //usleep
28   //printf("now");
29   srand ( time_seed() );
30   while ((c = getopt(argc, argv, ":hbf:")) != -1) {
31     switch(c) {
32       case 'h':
33         help();
34         break;
35     }
36   }
37   while(1) {
38     //printf("cpu\n");
39     //srand ( time_seed() );
40     r = rand() %(1000-1)+1;
41     while (count<(rand()+rand())) {
42       count++;
43     }
44     //printf("%d - %d\n",r, time_seed());
45     usleep(r);
46     r=0;
47     count=0;
48   }
49 }
50