]> jfr.im git - irc/quakenet/newserv.git/blob - core/main.c
sync Dan's live P changes - a) dont start scanning for first 120s after boot b) dont...
[irc/quakenet/newserv.git] / core / main.c
1 #include "../lib/sstring.h"
2 #include "events.h"
3 #include "schedule.h"
4 #include "hooks.h"
5 #include "modules.h"
6 #include "config.h"
7 #include "error.h"
8
9 #include <stdlib.h>
10 #include <stdio.h>
11 #include <time.h>
12 #include <sys/time.h>
13
14 void initseed();
15
16 int main(int argc, char **argv) {
17 initseed();
18 inithooks();
19 inithandlers();
20 initschedule();
21
22 initsstring();
23
24 if (argc>1) {
25 initconfig(argv[1]);
26 } else {
27 initconfig("newserv.conf");
28 }
29
30 /* Loading the modules will bring in the bulk of the code */
31 initmodules();
32
33 /* Main loop */
34 for(;;) {
35 handleevents(10);
36 doscheduledevents(time(NULL));
37 }
38 }
39
40 /*
41 * seed the pseudo-random number generator, rand()
42 */
43 void initseed() {
44 struct timeval t;
45
46 gettimeofday(&t, NULL);
47 srand(t.tv_usec);
48 }