+ key_buf[section_len] = '\0';
+ strncat(key_buf, "up_cmd", MAXCONFKEYLEN);
+ hosts[i]->up_cmd = strdup(iniparser_getstring(conf, key_buf, NULL));
+
+ key_buf[section_len] = '\0';
+ strncat(key_buf, "down_cmd", MAXCONFKEYLEN);
+ hosts[i]->down_cmd = strdup(iniparser_getstring(conf, key_buf, NULL));
+
+ key_buf[section_len] = '\0';
+ /* TODO: Parse for up/down/auto in start_condition. */
+ /* TODO: Do a host up/down check if necessary. */
+ hosts[i]->host_up = true;
+
+ /* TODO: Do I want to make any checks for start_condition? */
+ if (hosts[i]->name == NULL || hosts[i]->ping_interval == -1 || hosts[i]->max_delay == -1) {
+ fprintf(stderr, "ERROR: Problems parsing section %s.\n", iniparser_getsecname(conf, i));
+ exit(EXIT_FAILURE);
+ }
+
+ hosts[i]->socket = -1;
+ hosts[i]->next = NULL;
+ if (i>0) hosts[i-1]->next = hosts[i];
+ gettimeofday(&(hosts[i]->last_ping_received), (struct timezone *) NULL);