Mercurial > garten
changeset 13:f1d43b52ed36
and here now is the main program
author | meillo@marmaro.de |
---|---|
date | Wed, 23 Jul 2008 15:20:35 +0200 |
parents | 8db6497d6065 |
children | bbc214c6fa6f |
files | .hgignore main.c |
diffstat | 2 files changed, 43 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Wed Jul 23 15:19:45 2008 +0200 +++ b/.hgignore Wed Jul 23 15:20:35 2008 +0200 @@ -8,3 +8,6 @@ *.tar.gz ChangeLog +bu +sql +garten
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.c Wed Jul 23 15:20:35 2008 +0200 @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <stdlib.h> +#include "db.h" +#include "game.h" + + +void run_module(char* name, void (*module)(void)) { + printf(" --> %s\n", name); + module(); + printf(" --< %s\n", name); +} + + +int main(int argc, char* argv[]) { + if (argc != 2) { + printf("usage: %s <database>\n", argv[0]); + exit(1); + } + database = argv[1]; + printf("database '%s'\n", database); + + /* echo "started backend cycle at `date +%F\ %H:%M:%S`" */ + db_connect(); + read_time(); + + + /* modules */ + run_module("clock", worldclock); + run_module("weather", weather); + run_module("environment", environment); + /* run_module("market", market); */ + run_module("growth", growth); + /* run_module("orderexec", orderexec); */ + + + db_close(); + /* echo "finished backend cycle at `date +%F\ %H:%M:%S`" */ + + return 0; +}