garten

diff 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
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/main.c	Wed Jul 23 15:20:35 2008 +0200
     1.3 @@ -0,0 +1,40 @@
     1.4 +#include <stdio.h>
     1.5 +#include <stdlib.h>
     1.6 +#include "db.h"
     1.7 +#include "game.h"
     1.8 +
     1.9 +
    1.10 +void run_module(char* name, void (*module)(void)) {
    1.11 +	printf("  --> %s\n", name);
    1.12 +	module();
    1.13 +	printf("  --< %s\n", name);
    1.14 +}
    1.15 +
    1.16 +
    1.17 +int main(int argc, char* argv[]) {
    1.18 +	if (argc != 2) {
    1.19 +		printf("usage: %s <database>\n", argv[0]);
    1.20 +		exit(1);
    1.21 +	}
    1.22 +	database = argv[1];
    1.23 +	printf("database '%s'\n", database);
    1.24 +
    1.25 +	/* echo "started backend cycle at `date +%F\ %H:%M:%S`" */
    1.26 +	db_connect();
    1.27 +	read_time();
    1.28 +
    1.29 +
    1.30 +	/* modules */
    1.31 +	run_module("clock", worldclock);
    1.32 +	run_module("weather", weather);
    1.33 +	run_module("environment", environment);
    1.34 +	/* run_module("market", market); */
    1.35 +	run_module("growth", growth);
    1.36 +	/* run_module("orderexec", orderexec); */
    1.37 +
    1.38 +
    1.39 +	db_close();
    1.40 +	/* echo "finished backend cycle at `date +%F\ %H:%M:%S`" */
    1.41 +
    1.42 +	return 0;
    1.43 +}