Allow specifying address in configuration file

This commit is contained in:
Iwan Timmer 2015-08-02 15:30:56 +02:00
parent 169e5da06f
commit db3173bd80

View File

@ -193,9 +193,13 @@ void config_file_parse(char* filename, PCONFIGURATION config) {
while (getline(&line, &len, fd) != -1) {
char *key = NULL, *value = NULL;
if (sscanf(line, "%ms = %ms", &key, &value) == 2) {
for (int i=0;long_options[i].name != NULL;i++) {
if (long_options[i].has_arg = required_argument && strcmp(long_options[i].name, key) == 0) {
parse_argument(long_options[i].val, value, config);
if (strcmp(key, "address") == 0) {
config->address = value;
} else {
for (int i=0;long_options[i].name != NULL;i++) {
if (long_options[i].has_arg = required_argument && strcmp(long_options[i].name, key) == 0) {
parse_argument(long_options[i].val, value, config);
}
}
}
}