+
+int options_parse_key_value_file(const char* filename, key_value_storage_t* storage)
+{
+ FILE* file = fopen(filename, "r");
+ if(file) {
+ char buf[100];
+ while(fgets(buf, 100, file) != NULL) {
+ char* tmp, *key, *value;
+ for(tmp = buf;*tmp == ' '; ++tmp);
+ if(*(key = tmp) == 0) continue;
+ for(;*tmp != ' ' && *tmp != 0;++tmp);
+ if(*tmp == 0) continue;
+ *tmp=0;
+ ++tmp;
+ for(;*tmp == ' ';++tmp);
+ if(*(value = tmp) == 0) continue;
+ for(;*tmp != ' ' && *tmp != 0 && *tmp != '\n';++tmp);
+ *tmp = 0;
+
+ if(key_value_storage_add(storage, key, value))
+ return -2;
+ }
+ fclose(file);
+ }
+ else {
+ log_printf(ERROR,"unable to open conf file (%s): %s", filename, strerror(errno));
+ return -1;
+ }
+}
+
+int options_parse_post(options_t* opt)