aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorarf20 <aruizfernandez05@gmail.com>2025-10-27 16:54:00 +0100
committerarf20 <aruizfernandez05@gmail.com>2025-10-27 16:54:00 +0100
commit52dc621b426fcb55ef3887e67de08a612b15480d (patch)
tree2f4fcef15f5ce15f1bb482d2bc6148a15094ba2b /main.c
parent8e937f139b118317fdaf7c2dbbb0669b508eb5ed (diff)
downloadarfnet2-status-52dc621b426fcb55ef3887e67de08a612b15480d.tar.gz
arfnet2-status-52dc621b426fcb55ef3887e67de08a612b15480d.zip
implemented commiting events to disk
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/main.c b/main.c
index 197d1b2..d262ac0 100644
--- a/main.c
+++ b/main.c
@@ -16,9 +16,15 @@
#include "monitor.h"
-#define PORT 8888
#define RES_BUFF 65535
+
+#define PORT 8888
+
+#define CFG_FILE "monitor.cfg"
+#define TMPL_FILE "index.htm.tmpl"
+#define LOG_FILE "events.log"
+
static char *index_format_template = NULL;
@@ -71,7 +77,7 @@ enum MHD_Result answer_to_connection(
int main() {
/* read index template file */
- FILE *tf = fopen("index.htm.tmpl", "r");
+ FILE *tf = fopen(TMPL_FILE, "r");
if (!tf) {
fprintf(stderr, "error opening index template file: %s\n",
strerror(errno));
@@ -97,11 +103,11 @@ int main() {
return 1;
}
- monitor_init("monitor.cfg", "events.log");
+ monitor_init(CFG_FILE, LOG_FILE);
while (1) {
monitor_check();
- monitor_update_events();
+ monitor_update_events(LOG_FILE);
sleep(5);
}
}