view 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 wrap: on
line source

#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;
}