Updates how config options are set on command line
This commit is contained in:
parent
8bed39700e
commit
f392af92c3
5 changed files with 56 additions and 22 deletions
18
src/config.c
18
src/config.c
|
@ -63,3 +63,21 @@ char* getDefaultUserConfigLoc(){
|
|||
return strdup(configFile);
|
||||
}
|
||||
|
||||
void setConfig(Config *config, char option[], char value[]){
|
||||
if ( strcmp( option, "database" ) == 0 ){
|
||||
config->database = value;
|
||||
} else if ( strcmp( option, "localConfig" ) == 0 ){
|
||||
config->localConfig = value;
|
||||
} else if ( strcmp( option, "userConfig" ) == 0 ){
|
||||
config->userConfig = value;
|
||||
} else if ( strcmp( option, "port" ) == 0 ){
|
||||
config->port = atoi(value);
|
||||
}
|
||||
}
|
||||
|
||||
void printConfig(Config *config){
|
||||
printf("Database: %s\n", config->database);
|
||||
printf("localConfig: %s\n", config->localConfig);
|
||||
printf("userConfig: %s\n", config->userConfig);
|
||||
printf("port: %i\n", config->port);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue