Mercurial > garten
comparison main.c @ 13:f1d43b52ed36
and here now is the main program
author | meillo@marmaro.de |
---|---|
date | Wed, 23 Jul 2008 15:20:35 +0200 |
parents | |
children | 5937504619f2 |
comparison
equal
deleted
inserted
replaced
12:8db6497d6065 | 13:f1d43b52ed36 |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 #include "db.h" | |
4 #include "game.h" | |
5 | |
6 | |
7 void run_module(char* name, void (*module)(void)) { | |
8 printf(" --> %s\n", name); | |
9 module(); | |
10 printf(" --< %s\n", name); | |
11 } | |
12 | |
13 | |
14 int main(int argc, char* argv[]) { | |
15 if (argc != 2) { | |
16 printf("usage: %s <database>\n", argv[0]); | |
17 exit(1); | |
18 } | |
19 database = argv[1]; | |
20 printf("database '%s'\n", database); | |
21 | |
22 /* echo "started backend cycle at `date +%F\ %H:%M:%S`" */ | |
23 db_connect(); | |
24 read_time(); | |
25 | |
26 | |
27 /* modules */ | |
28 run_module("clock", worldclock); | |
29 run_module("weather", weather); | |
30 run_module("environment", environment); | |
31 /* run_module("market", market); */ | |
32 run_module("growth", growth); | |
33 /* run_module("orderexec", orderexec); */ | |
34 | |
35 | |
36 db_close(); | |
37 /* echo "finished backend cycle at `date +%F\ %H:%M:%S`" */ | |
38 | |
39 return 0; | |
40 } |