Mercurial > garten
comparison main.c @ 19:eb8db0d906de
updated runtick.sh to current program
author | meillo@marmaro.de |
---|---|
date | Wed, 23 Jul 2008 17:44:15 +0200 |
parents | 5937504619f2 |
children |
comparison
equal
deleted
inserted
replaced
18:5937504619f2 | 19:eb8db0d906de |
---|---|
3 #include "db.h" | 3 #include "db.h" |
4 #include "modules.h" | 4 #include "modules.h" |
5 | 5 |
6 | 6 |
7 void init(void) { | 7 void init(void) { |
8 /* echo "started backend cycle at `date +%F\ %H:%M:%S`" */ | |
9 db_connect(); | 8 db_connect(); |
10 read_time(); | 9 read_time(); |
11 } | 10 } |
12 | 11 |
13 | 12 |
14 void cleanup(void) { | 13 void cleanup(void) { |
15 db_close(); | 14 db_close(); |
16 /* echo "finished backend cycle at `date +%F\ %H:%M:%S`" */ | |
17 } | 15 } |
18 | 16 |
19 | 17 |
20 void run_module(char* name, int (*module)(void)) { | 18 void run_module(char* name, int (*module)(void)) { |
21 printf(" --> %s\n", name); | 19 printf(" --> %s\n", name); |
32 if (argc != 2) { | 30 if (argc != 2) { |
33 printf("usage: %s <database>\n", argv[0]); | 31 printf("usage: %s <database>\n", argv[0]); |
34 exit(1); | 32 exit(1); |
35 } | 33 } |
36 database = argv[1]; | 34 database = argv[1]; |
37 printf("database '%s'\n", database); | |
38 init(); | 35 init(); |
39 | 36 |
40 /* modules */ | 37 /* modules */ |
41 run_module("clock", worldclock); | 38 run_module("clock", worldclock); |
42 run_module("weather", weather); | 39 run_module("weather", weather); |